Back to Community

Why Your Purchase Event Might Not Be Firing in GTM4WP

Content

One of the most common issues reported by users of the 'GTM4WP – A Google Tag Manager (GTM) plugin for WordPress' is the purchase event failing to fire. This critical ecommerce event is essential for tracking revenue and conversions in tools like Google Analytics and Facebook Pixel. Let's explore the typical reasons this happens and how to resolve them.

The Problem: Missing Purchase Data

When the purchase event doesn't fire, you'll notice missing transaction data in your analytics dashboards. The order confirmation (thank you) page loads, but the crucial gtm4wp.orderCompleted or purchase event is absent from the dataLayer.

Why This Happens

Based on community reports, the issue is rarely a bug in the plugin itself. Instead, it's almost always caused by a conflict between the plugin's expected environment and a site's specific configuration.

Common Causes and Solutions

1. Custom Thank You Page URL

The Issue: The plugin is designed to push the purchase event to the dataLayer on the default WooCommerce order-received endpoint (/checkout/order-received/). If you are using a custom thank you page with a different URL structure (e.g., /dankeseite/ or /afronden/bestelling-ontvangen), the plugin may not recognize it as the order confirmation page.

The Solution: Ensure your custom thank you page mimics all the features of the default WooCommerce order received page. Most importantly, the order ID must be present in the URL. The plugin relies on this to trigger the event. If you are using a page builder or a custom template, you may need to manually ensure the necessary GTM4WP code is output on that page.

2. 8kB dataLayer Size Limit

The Issue: The data pushed on the gtm4wp.orderCompleted event can be very large, sometimes containing duplicate product and customer data. If the total payload exceeds roughly 8kB, the entire event can be dropped, preventing it from being processed by Tag Manager.

The Solution: To reduce the payload size, navigate to the plugin's settings (GTM4WP > Integration > WooCommerce) and review which data layers you have enabled. Only check the options that are absolutely necessary for your tracking. Unchecking superfluous options can significantly reduce the dataLayer size and prevent this cutoff issue.

3. Third-Party Plugin and Theme Conflicts

The Issue: Other plugins or your theme can interfere with the standard WooCommerce hooks that GTM4WP uses to trigger the purchase event.

The Solution: Perform basic conflict troubleshooting. Disable other plugins one by one (on a staging site) and switch to a default WordPress theme like Twenty Twenty-One to see if the purchase event begins firing. This will help you identify the conflicting software.

4. Incorrect GTM Trigger

The Issue: Even if the dataLayer event is firing correctly, your Google Tag Manager setup might be misconfigured and not listening for it.

The Solution: In Google Tag Manager, create a Custom Event trigger with the following settings:

  • Trigger Name: Custom Event - Purchase
  • Trigger Type: Custom Event
  • Event Name: gtm4wp.orderCompleted
Use this trigger to fire your Google Analytics or Facebook Pixel purchase tags. Note: Some analytics platforms like Facebook may require the event name to be in lowercase (purchase), so you may need to create a separate trigger for that.

Need More Help?

If you've worked through these steps and are still experiencing issues, the best course of action is to provide a detailed report on the plugin's official support forums. Be sure to include your site's URL and describe any customizations you've made to your checkout and thank you pages. The more information you can provide, the easier it will be for the community to help diagnose the problem.

Related Support Threads Support