pesac
Forum Replies Created
-
@geraltrivia, Below are my screenshots and System Info. Note that “Send all site’s emails with: default WordPress sending method” is set because of the issue I am having.
name: Removed
email: [email protected]
PHP version: 8.3.17
MailPoet Free version: 5.10.0
MailPoet Premium version: N/A
MailPoet Premium/MSS key: f16a3602b64d5ffe****************
WordPress version: 6.7.2
Database version: 10.6.21-MariaDB-log
Web server: Apache
Server OS: Linux ecngx318.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
WP info: WP_MEMORY_LIMIT: 40M - WP_MAX_MEMORY_LIMIT: 712M - WP_DEBUG: - WordPress language: en_US - WordPress timezone: America/Chicago
PHP info: PHP max_execution_time: 90 - PHP memory_limit: 712M - PHP upload_max_filesize: 2M - PHP post_max_size: 8M
Multisite environment?: No
Current Theme: Blocksy Child (version )
Active Plugin names: aftership-woocommerce-tracking/aftership-woocommerce-tracking.php, all-in-one-wp-security-and-firewall/wp-security.php, autodescription/autodescription.php, blocksy-companion/blocksy-companion.php, complianz-gdpr/complianz-gpdr.php, gtm-kit/gtm-kit.php, heartbeat-control/heartbeat-control.php, insert-headers-and-footers/ihaf.php, mailpoet/mailpoet.php, pymntpl-paypal-woocommerce/pymntpl-paypal-woocommerce.php, reading-progress-bar/reading-progressbar.php, slicewp/index.php, stackable-ultimate-gutenberg-blocks/plugin.php, tiktok-for-business/tiktok-for-woocommerce.php, woo-order-export-lite/woo-order-export-lite.php, woo-smart-quick-view/wpc-smart-quick-view.php, woo-stripe-payment/stripe-payments.php, woo-update-manager/woo-update-manager.php, woocommerce-product-dependencies/woocommerce-product-dependencies.php, woocommerce-services/woocommerce-services.php, woocommerce/woocommerce.php, wp-consent-api/wp-consent-api.php, wp-optimize/wp-optimize.php, wp-smushit/wp-smush.php, wpc-composite-products/wpc-composite-products.php, wpforms-lite/wpforms.php, x-currency-pro/x-currency-pro.php, x-currency/x-currency.php
Sending Method: MailPoet
MailPoet Sending Service: Is reachable: Yes - Ping response: 200 HTTP status code - API key state: valid - Premium key state: valid_underprivileged
Sending Frequency: 25 emails every 5 minutes
MailPoet sending info: Send all site's emails with: default WordPress sending method - Task Scheduler method: Linux Cron - Default FROM address: [email protected] - Default Reply-To address: [email protected] - Bounce Email Address: [email protected]
MailPoet Cron / Action Scheduler: Status: active - Is reachable: Yes - Ping URL: https://defendmyvehicle.com?mailpoet_router&endpoint=cron_daemon&action=ping - Ping response: pong - Last run start: 2025-03-21 21:30:07 - Last run end: 2025-03-21 21:30:07 - Last seen error: None
Total number of subscribers: 17
Plugin installed at: 2024-05-02 02:38:59
Installed via WooCommerce onboarding wizard: false
Sending queue status: Status: Unknown - Started at: 2025-03-18 22:00:16 - Emails sent: 0 - Retry attempts: 0 - Last seen error: None
Data inconsistency status: Orphaned sending tasks: 0 - Orphaned sending task subscribers: 0 - Sending queue without newsletter: 0 - Orphaned subscriptions: 0 - Orphaned links: 0 - Orphaned newsletter posts: 0@adamdunnage Thanks for checking in, but I’ve decided to give up on the plugin. I’m using GTM Kit plugin, GTM, GA4 and it’s working great.
@adamdunnage I have a screen recording. How can I send to you?
- This reply was modified 4 weeks, 1 day ago by pesac.
@adamdunnage Publishing on GTM didn’t make a difference. And in fact I no longer see the Tag Assistant window on the page when I try preview mode. I will try to get a recording today. This is very frustrating.
@adamdunnage Yes sir, exactly. It seems like Site Kit is only adding the code snippet for logged in users.
I may have found a lead. I set up another fake test site that only had site kit installed and it is having the same problem. I can only see the tags when logged in. If I open in incognito mode or another browser where I’m not logged in there are no tags. I didn’t check incognito using your tastewp link but I bet it would have had the same problem. I only checked with a logged in tab. This is the same site at the same time made with jurassic.ninja. No cache, no nothing. See below.
logged in
incognito
- This reply was modified 1 month ago by pesac.
I just created a php snippet myself for now as a workaround, so if you resume troubleshooting and see it that’s why.
I set up Site Kit on that site and I was able to see my tag in the page source.
On my live site I reset Site Kit in the admin settings and then set it up from scratch again. GTM now says container quality is excellent, however Tag Assistant still does not see the tag.
- This reply was modified 1 month ago by pesac.
@adamdunnage, I have a staging site that has all other plugins besides Site Kit deleted. I still am not getting the tag to show in the page source.
Ok I am going to have to work on this later. I will check back in soon once I have the staging site set up!
Could I create a staging site instead? Since my site is live I don’t want to deactivate everything on the live site.
I paused them directly in GTM. I disconnected GTM from Site Kit and tried the GTM Kit plugin to insert the code and set up the datalayer but I had problems with the purchase tag, so I paused the tags in GTM, deleted GTM Kit, and reconnected GTM in Site Kit. Everything was connected fine still at that point. I didn’t notice any issues until I learned that I could still use tags in GTM while connected with Site Kit so I unpaused them.
I have deactivated WP-Optimize. I looked for the tag again and it’s not there. Tag Assistant still says tag not found. I tried the troubleshooting method of using the health check plugin to deactivate all plugins but Site Kit and had the same problem, so I don’t know if the problem is related to other plugins but I’ll try whatever you suggest.
- This reply was modified 1 month ago by pesac. Reason: clarification on plugins
Hi @adamdunnage,
See screenshot below. Container ID is triple checked confirmed correct. I just submitted the form. I don’t know if this has anything to do with it, but everything used to be connected fine, and I was messing around with tags and couldn’t get purchases to work right, so I decided to pause all tags. Then today I decided to try and get the tags working and unpaused them. I noticed right away that there was a problem with the container (text of error below). I tried troubleshooting with Tag Assistant and after pulling out a sufficient amount of my hair I posted here.
Container quality
Urgent
Container issues are likely impacting your measurement. Learn more
Action items
1 item
Tag stopped sending data
This tag has not been detected in the last 48 hours. Use Tag Assistant to check that the tag is correctly installed on your website.
- This reply was modified 1 month ago by pesac. Reason: updated image
@elliotvs and @generosus,
I actually found a solution that works. I can give you the code I wrote but I don’t know how to work github so I don’t know how to submit a PR or any of that.
The html for the widget needs to be in the form before the submit button. I used custom html block in my mailpoet form:
<div style="display: block; flex-flow: row;">
<div
id="cf-turnstile-widget"
class="cf-turnstile"
data-sitekey="your-sitekey"
data-size="flexible"
data-callback="cfTurnstileCallback"
></div>
</div>And then this is in functions.php:
<?php
function add_cf_turnstile_script() {
echo '<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>';
}
add_action( 'wp_head', 'add_cf_turnstile_script' );
function add_turnstile_token_to_mailpoet() {
?>
<script>
document.addEventListener("DOMContentLoaded", function() {
// Attach a submit event handler to MailPoet forms
jQuery("form.mailpoet_form").on("submit", function(event) {
var form = jQuery(this);
// Look for the token that Cloudflare's widget inserted
var tokenElem = document.querySelector("input[name='cf-turnstile-response']");
if (tokenElem && tokenElem.value) {
// Remove any previous copy of the token (if it exists)
form.find("input[name='data[cf-turnstile-response]']").remove();
// Append a hidden input with the token value to the form data
form.append('<input type="hidden" name="data[cf-turnstile-response]" value="' + tokenElem.value + '">');
// Let the form submit normally
} else {
// No token was found—prevent submission and alert the user.
event.preventDefault();
alert("Please complete the Turnstile challenge before submitting the form.");
}
});
});
</script>
<?php
}
add_action('wp_footer', 'add_turnstile_token_to_mailpoet');
add_action(
'mailpoet_subscription_before_subscribe',
function( $subscriber_data, $segment_ids, $form ) {
// Debugging: Log function execution
error_log("Turnstile validation triggered.");
// Retrieve the Turnstile token from the submitted form data.
$token = isset($_POST['data']['cf-turnstile-response']) ? sanitize_text_field($_POST['data']['cf-turnstile-response']) : '';
if (empty($token)) {
error_log("Turnstile token missing.");
throw new \MailPoet\UnexpectedValueException("Turnstile verification failed: No token received.");
}
// Retrieve your secret key.
$secret = defined('DEFINE_SECRET_KEY') ? DEFINE_SECRET_KEY : '';
if (empty($secret)) {
error_log("Turnstile secret key missing.");
throw new \MailPoet\UnexpectedValueException("Turnstile verification failed: Secret key missing.");
}
// Build the POST data for Cloudflare's siteverify endpoint.
$body = [
'secret' => $secret,
'response' => $token,
'remoteip' => $_SERVER['REMOTE_ADDR'] ?? '',
];
// Optional: Add idempotency key for retry safety
if (function_exists('wp_generate_uuid4')) {
$body['idempotency_key'] = wp_generate_uuid4();
} else {
$body['idempotency_key'] = uniqid('', true);
}
// Prepare and execute the verification request.
$args = [
'body' => http_build_query($body),
'headers' => [ 'Content-Type' => 'application/x-www-form-urlencoded' ],
'timeout' => 10,
];
$verify_response = wp_remote_post('https://challenges.cloudflare.com/turnstile/v0/siteverify', $args);
if (is_wp_error($verify_response)) {
error_log("Turnstile API request failed: " . $verify_response->get_error_message());
throw new \MailPoet\UnexpectedValueException("Turnstile verification failed: API error.");
}
// Decode the JSON response.
$response_data = json_decode(wp_remote_retrieve_body($verify_response), true);
// Check that the response is valid.
if (empty($response_data['success'])) {
$error_codes = !empty($response_data['error-codes']) ? implode(', ', $response_data['error-codes']) : 'Unknown error';
error_log("Turnstile verification failed: " . $error_codes);
throw new \MailPoet\UnexpectedValueException("Turnstile verification failed: " . $error_codes);
}
// Success: Log and allow the subscription to proceed.
error_log("Turnstile verification successful.");
},
10,
3
);Created a new recaptcha profile and it’s working now. There was something wrong with the other one. Marking as resolved.