Boonyawat Posted December 11, 2016 Share Posted December 11, 2016 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. 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 More sharing options...
Boonyawat Posted December 15, 2016 Author Share Posted December 15, 2016 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. 3 Link to comment Share on other sites More sharing options...
bedandw Posted December 15, 2017 Share Posted December 15, 2017 Thanks for this very helpful, what did you replace in myID- your UA number? Link to comment Share on other sites More sharing options...
Boonyawat Posted December 16, 2017 Author Share Posted December 16, 2017 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now