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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
  • 1 year later...

It can be anything like “btn_addtocart’. And then in google tag manager you condition variable that has this value when setting a trigger. Using UA number should be fine but I don’t think it is appropriate for this situation. 

 

Cheers

Share this post


Link to post
Share on other sites

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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More