My Add to Cart Tag is Not Firing
If your add to cart tag is not firing after installing GTM Suite then follow this guide to add a backup trigger.
Data Layer 1.0. has been depreciated
Please follow our upgrade guide to update to our latest version.
If you've installed and tested the GTM Suite but are still not seeing the add to cart events fire on your product page then follow these steps to fix:
Step 1: Custom HTML Add to Cart Tag
Ensure you have this tag in your GTM container:
If you don't have this then download the GTM container here
Once you've downloaded it then import this into your own GTM account and be sure you select MERGE and not overwrite.
Step 2: Update Trigger
Your next step is to put GTM into preview mode so you can browse your site to see the GTM console-like shown below.
Navigation to your product page > click add to cart > and you should see a Click event on the left like this:
If you have a Click Class, Click Element, Click ID or Click Text then go back to GTM and update the Trigger to match the variable detail from the add to cart click.
In my example above I'm using the Click Classes so I've updated my trigger to look like this:
One you save then you are good to go.
Inside of GTM click "Refresh" on your preview mode > then refresh your product page browser of your website. Once it reloads then click add to cart again and you should see the add to cart tags fire successfully.
Step 3: Update elevar-body-end.liquid file - (For App installations prior to 11/1/2019 )
We have found that for more customized, non-native themes the add to cart tag may still not fire even after making the adjustment described above. For stores that installed the Shopify GTM App prior to 11/1/2019, all that is needed is a small update to the elevar-body-end.liquid file for an immediate fix.
If you installed the App after 11/1/2019, the most up to date code is already in place!
Here is how you make this update:
- On your Shopify Theme Preferences, select 'edit code' in the actions dropdown
- Search for elevar-body-end.liquid
- Replace this line:
With this:
document.querySelectorAll("form[action^='/cart/add'] [type='submit']")[0].addEventListener('click', function() {
- Save and you're all set!
Worried You’re Making Decisions on Data You Can’t Trust?
Check out our blog and discover Shopify Optimization & Analytics Tips from Elevar's data experts.
Updated about 1 month ago