Troubleshooting GTM4WP Purchase Event Not Firing on WooCommerce Thank You Pages
Content
One of the most common issues reported by users of the 'GTM4WP – A Google Tag Manager (GTM) plugin for WordPress' is the sudden disappearance of the crucial 'purchase' event from the data layer. This event is vital for tracking conversions and revenue in tools like Google Analytics. Based on extensive community reports, this guide will walk you through the primary causes and their solutions.
Why the Purchase Event Might Not Be Firing
The purchase event is designed to fire when a customer lands on the WooCommerce order received (thank you) page. However, several factors can prevent this from happening. The most common causes, identified from user experiences, are:
- Plugin or Theme Conflicts: Other plugins, especially those related to caching, consent management (like Real Cookie Banner), SEO (like Yoast SEO), or order numbers, can interfere with the timing or execution of the GTM4WP code.
- Custom Thank You Pages: Using page builders like Elementor or Breakdance to create a custom order received page can sometimes remove or alter the essential
woocommerce_thankyouhook that the plugin relies on. - Custom Order IDs: Plugins that modify the WooCommerce order number to use a string prefix (e.g., 'GW-12345') instead of a simple integer can cause JavaScript errors that halt the tracking script.
- Order Status: The event may be configured to fire only on specific order statuses, like 'processing', and not on 'pending' or 'on-hold'.
- Plugin Regression: Updates to the GTM4WP plugin itself have occasionally introduced bugs that break purchase tracking for some users, making a version rollback a common temporary fix.
Step-by-Step Troubleshooting Guide
Follow these steps to identify and resolve the issue with your purchase event.
Step 1: Conduct a Conflict Test
The first and most critical step is to rule out conflicts with other software on your site.
- Temporarily switch your theme to a default WordPress theme like Twenty Twenty-Four.
- Deactivate all plugins except for WooCommerce and GTM4WP.
- Place a test order using a payment method like 'Cash on delivery' to simulate a successful transaction.
- Check if the purchase event now appears in the data layer using your browser's console or a tool like Google Tag Manager's Preview mode.
- If the event fires, reactivate your theme and plugins one-by-one, testing after each activation, to find the culprit.
Step 2: Verify Your Thank You Page Hook
If you use a custom thank you page built with a page builder, you must confirm it supports the necessary WooCommerce hook.
- Ensure your custom thank you page template includes the action
do_action( 'woocommerce_thankyou', $order_id );. - If this hook is missing, the GTM4WP plugin cannot inject the purchase event code. You may need to consult your theme or page builder's documentation for support on adding this hook.
- As a test, temporarily switch back to the default WooCommerce thank you page to see if the event works there.
Step 3: Check for Custom Order Number Conflicts
If your order IDs contain letters (e.g., 'SON-123'), a known JavaScript issue in the plugin could be causing an error.
- On the thank you page, open your browser's developer console (F12) and look for any JavaScript errors.
- If you see errors referencing
gtm4wp_orderid_tracked, this is likely the cause. - This specific bug requires a code fix from the GTM4WP development team. Users have reported that rolling back to plugin version 1.18.1 can resolve this particular issue.
Step 4: Review Plugin and GTM Configuration
Incorrect settings within the plugin or Google Tag Manager can also be the source of the problem.
- In your WordPress admin, go to GTM4WP -> Integration -> WooCommerce.
- Ensure that "Track transactions" is enabled.
- Experiment with the "Do not flag orders as being tracked" option. Toggling this setting has resolved the issue for some users.
- In your GTM container, ensure your purchase trigger is set up correctly to listen for the
purchaseCustom Event.
Step 5: Roll Back the Plugin Version
If your purchase event stopped working immediately after a plugin update, a regression may be the cause. Rolling back to a previous version is a widely used diagnostic and temporary solution.
- Identify the last working version of the plugin (e.g., 1.20.3, 1.21, or 1.18.1).
- Use a plugin like 'WP Rollback' to easily revert to that version.
- You can also download older versions directly from the WordPress.org plugin archive (scroll down to "Previous Versions").
- Important: Remember that rolling back is a temporary workaround. Always keep an eye on future update changelogs to see when a permanent fix is released.
Conclusion
A non-firing purchase event is a high-priority issue that directly impacts revenue tracking. The most effective approach is to methodically test for conflicts, verify your thank you page setup, and consider a temporary rollback if a recent update is to blame. The community has found that these steps resolve the majority of reported cases. For ongoing issues, sharing your specific findings (like theme name, conflicting plugins, and console errors) on community forums can help others provide more targeted assistance.
Related Support Threads Support
-
Conflict with “Sequential Order Number ” pluginhttps://wordpress.org/support/topic/conflict-with-sequential-order-number-plugin/
-
Update 1.14.1 broke E-commerce eventshttps://wordpress.org/support/topic/update-1-14-1-broke-e-commerce-events/
-
Update dont trigger purchasehttps://wordpress.org/support/topic/update-dont-trigger-purchase/
-
Purchase event not Firinghttps://wordpress.org/support/topic/purchase-event-not-recording/
-
Form start event not work againhttps://wordpress.org/support/topic/form-start-event-not-work-again/
-
No Purchase event triggeredhttps://wordpress.org/support/topic/no-purchase-event-triggered/
-
Purchase event firing even if payment failedhttps://wordpress.org/support/topic/purchase-event-firing-even-if-payment-failed/
-
purchase event not workinghttps://wordpress.org/support/topic/purchase-event-not-working-3/
-
1.18 -> 1.20.2 not tracking ecommerce eventshttps://wordpress.org/support/topic/1-18-1-20-2-not-tracking-ecommerce-events/
-
Purchase event not fired with custom order IDhttps://wordpress.org/support/topic/purchase-event-not-fired-with-custom-order-id/
-
Purchase event not firinghttps://wordpress.org/support/topic/purchase-event-not-firing-16/
-
Initiate Checkout & Purchase Event Is not firing For Server Side Trackinghttps://wordpress.org/support/topic/initiate-checkout-purchase-event-is-not-firing-for-server-side-tracking/
-
Clarification on Purchase Event Trigger on Thank You Pagehttps://wordpress.org/support/topic/clarification-on-purchase-event-trigger-on-thank-you-page/
-
“purchase” event not firing anymore after cancellationhttps://wordpress.org/support/topic/purchase-event-not-firing-11/
-
triggering the purchase event earlierhttps://wordpress.org/support/topic/triggering-the-purchase-event-earlier/
-
Purchase Event Missing in GTM4WP v1.22 – Regression from v1.21https://wordpress.org/support/topic/purchase-event-missing-in-gtm4wp-v1-22-regression-from-v1-21/
-
Plugin Update Causing Purchase Events Not To Firehttps://wordpress.org/support/topic/plugin-update-causing-purchase-events-not-to-fire/
-
Purchase event not working when using Elementor custom order received pagehttps://wordpress.org/support/topic/purchase-event-not-working-when-using-elementor-custom-order-received-page/
-
GTM purchase event not firinghttps://wordpress.org/support/topic/gtm-purchase-event-not-firing/
-
Purchase tracking not workinghttps://wordpress.org/support/topic/purchase-tracking-not-working/
-
Purchase event not workinghttps://wordpress.org/support/topic/purchase-event-not-working-4/
-
Purchase events no longer pushed to data layerhttps://wordpress.org/support/topic/purchase-events-no-longer-pushed-to-data-layer/
-
no purchase eventshttps://wordpress.org/support/topic/no-purchase-events/
-
Purchase event not triggeringhttps://wordpress.org/support/topic/purchase-event-not-triggering-2/
-
1.21 update breaks tracking in checkout with Real Cookie Banner pluginhttps://wordpress.org/support/topic/1-21-update-breaks-tracking-in-checkout-with-real-cookie-banner-plugin/
-
Data protection issue: customer data sent even though disabled!https://wordpress.org/support/topic/data-security-issue-customer-data-sent-even-though-disabled/
-
Remove purchase eventhttps://wordpress.org/support/topic/remove-purchase-event/
-
Purchase event Data layer- Someone please Fixhttps://wordpress.org/support/topic/purchase-event-data-layer-someone-please-fix/
-
Having conflict with Yoast SEOhttps://wordpress.org/support/topic/having-conflict-with-yoast-seo/