Common reasons add-to-cart tracking doesn’t fire
- GTM container not published - You imported the container but didn’t click Submit → Publish.
- GTM snippet not installed on your site - The GTM code needs to be in your site’s <head> and <body>.
- AJAX add-to-cart doesn’t trigger a page load - Most modern stores add items to the cart via AJAX. A Page View trigger won’t fire. You need a Custom Event or DOM listener that detects the AJAX request.
- Button selector changed after theme update - Theme updates often rename CSS classes. If your trigger targets
.add-to-cart-btnand the new theme uses.product-add-btn, the trigger silently breaks. - Product data not extractable from DOM - Your tag needs product name, price, and ID. If these aren’t in the dataLayer or in predictable DOM elements, the tag fires but sends incomplete data.
- WooCommerce AJAX vs non-AJAX add-to-cart - WooCommerce supports both AJAX and traditional (page reload) add-to-cart. Check WooCommerce → Settings → Products to see if “Enable AJAX add to cart” is on. If it is, you need a Custom Event or fetch interception approach.
Step-by-step debugging checklist
- Verify GTM is installed - Visit your site, right-click → View Page Source, search for “GTM-”. If you don’t see it, GTM isn’t installed.
- Check GTM Preview mode - In GTM, click Preview. Navigate your site and trigger the event. Look for your tag in the Tags Fired section.
- Check the trigger - If the tag shows as “Not Fired”, click on it to see which trigger conditions aren’t met.
- Click the add-to-cart button with GTM Preview open - Check if any event fires at all. If you see nothing, the click isn’t reaching GTM (likely AJAX). If a Click event fires but your tag doesn’t, your trigger conditions are wrong.
- Inspect the network tab - Open DevTools → Network, click add to cart, and look for an AJAX request to a cart endpoint (e.g.,
/cart/addon Shopify,?wc-ajax=add_to_carton WooCommerce). This confirms the add-to-cart mechanism.
WordPress / WooCommerce-specific issues
WooCommerce has two add-to-cart modes. When AJAX is enabled (WooCommerce → Settings → Products), clicking “Add to cart” sends an AJAX request to /?wc-ajax=add_to_cart without reloading the page. When AJAX is disabled, the page reloads after adding the product.
For AJAX mode, you can either intercept the added_to_cart jQuery event that WooCommerce fires, or monitor XHR requests containing wc-ajax=add_to_cart in the URL. For non-AJAX mode, a standard Page View trigger on the cart page works.
How to verify it’s working
- Open GTM Preview/Debug mode
- Navigate to your site
- Trigger the event (click add to cart)
- Check the GTM debug panel - your tag should appear under “Tags Fired”
- Check GA4 DebugView (GA4 → Admin → DebugView) to confirm the event arrived
Still didn’t work?
Our team can help. Describe what’s happening and we’ll get back to you within 24 hours.