Jump to content

Google Tag Manager (GTM) Add To Cart button tracking


Recommended Posts

Dear all,

 

I am using Google Tag Manager (GTM) for facebook pixel tracking. I also have a module on Prestashop that push necessary information into dataLayer. The problem that I have is with event AddToCart. I cannot set a trigger in GTM so that a tracking tag is fired when a user click 'Add to Cart' button on a webpage.

 

The problem is that when clicking 'Add to Cart' on a product page, nothing is passed to gtm.elementId value. Please see attached file. However, when clicking on product thumbnail image or other buttons on a webpage, some data is passed to gtm variables.

 

post-1076717-0-69173200-1481459308_thumb.png

 

In the attached image, Click 10 and 11 is from clicking on product image thumbnails. You can see there is a value for 'gtm.elementId'. But with click 12 and 13, which are from clicking on 'Add to Cart' button, 'gtm.elementId' has no value. Without a value, I cannot use a filter in GTM to setup a trigger.

 

How can I set the value for gtm.dlementId for 'Add to Cart' button?

 

Any advised is very much appreciated.

 

Thank you

Boon

Link to comment
Share on other sites

I figured out a solution! The problem is that the Add to Cart on a product page is coded as <span>Add to Cart</span>. When clicking, GTM cannot get any value. So I edit this to <span id="myID">Add to Cart</span>.

 

This way GTM will get the id information. Then you can filter the trigger.

  • Like 3
Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...