Just to clarify where you are in this process, what is the main point of trouble you are experiencing? (i.e. you’ve pasted the snippet but it’s not tracking anything, you don’t know where to paste, Shopify can’t validate the code, etc.) It might be helpful for myself and other Community members to understand the issue with some more context about where you’re stuck.Â
Â
One thing that is important to understand is that you must have Klaviyo onsite tracking enabled and the user must have been previously cookied by Klaviyo for the event to be tracked, so if you are testing the metric without these prerequisites established, nothing will appear in Klaviyo.
Â
Here are some other Community threads regarding the Added to Cart metric that might help provide clarity:
Â
I hope this helps, and thanks for using the Community!
Â
- Brian
Hi Brian,
The metric isn’t tracking when people are adding items into their cart. I have tried to force an add to cart using incognito but still doesn’t work. I was wondering if maybe my code that I had modified and input was incorrect or something, I have read over the Klaviyo guide many times yet I am still can’t get it.Â
I am using the theme debutify.
This is the snippet off code that I used:
{% if product %} <script type="text/javascript"> var _learnq = _learnq || e]; Â Â Â document.getElementById("AddToCart--template--15445490532397__main").addEventListener('click',function (){ Â Â Â Â Â Â Â _learnq.push( 'track', 'Added to Cart', item]); Â Â Â });</script> {% endif %}
Â
Please help me,
Thank you
Hey @Brian Turcotte ,
I was wondering if you saw my reply? Any help in the code is appreciated!
Â
Thanks Peterial
Hi @peterialshop,
Â
There could be two issues going on here. The first is that the Added to Cart metric only works if the user has been cookied, which means that they’ve entered their email on your store at some point. Therefore, using a private browser to test the metric wouldn’t work.Â
If you need more hands on assistance on getting this resolved, I would recommend reaching out and working with a developer you’re familiar with, or with an official Klaviyo Partner.
Â
I hope this helps, and thanks for using the Community!
- Brian
@Brian Turcotte ,
Thank you so much for all the help I appreciate it! I had just activated my metric!