Solved

Added To Cart Event is not appearing on my analytics\metrics!

  • 24 January 2021
  • 7 replies
  • 1323 views

Badge +2

Hi Klaviyo team!

i was setting up the added to cart event on one of my stores and when i add the snippet code in product.liquid with my ID, the added to cart doesn’t show in my metrics!

i tried adding a product to cart but nothing happened

 

icon

Best answer by Dov 5 April 2021, 16:23

View original

7 replies

Userlevel 7
Badge +57

@ChakiryWelcome to Klaviyo Community.

The snipped you’ve used looks OK, but I’m not sure about the ID you’ve used in the snippet. Can you please provide a screenshot of the HTML from your “add to cart” button in Shopify? Maybe you’ve used the wrong ID.

Let’s start with that and see if we’ll find a way to troubleshoot this.

Badge +2

yeah sure!

here is a screenshot of my ATC button HTML

 

Badge +2

Hi @Chakiry - are you familiar with using console logging?

One useful approach to testing or debugging things like this is adding some logging to the script to narrow down possible causes, or locate the specific portion of the code that is not working as expected. In this case, for example, it could be helpful to add a console.log statement above where you reference _learnq… This would effectively make the script say, “Listen for the click of a button with this ID and when that is observed, first log some text to the console, then make the track call to Klaviyo.”

If you add this code and then test it - and watch the dev console to see if this logs out - you’ll be able to determine if your event listener is working as expected. If the statement does log, it suggests that the event listener is properly configured. And if that’s the case, the most likely reason for the track call not going through is that you are trying to make that call, but without having a known identity to Klaviyo. In other words, the code could be perfectly fine, but if Klaviyo’s cookie doesn’t know who you are, that track call won’t get sent (by design).

If you find yourself in this scenario, I recommend using this approach to identify yourself and then retry. Specifically, you can add a param to the URL that says “utm_email=” followed by your email. That will cause you to get cookied and then I would expect your track call to go through as expected (provided that your event listener is working, as demonstrated by the console logging mentioned above).

Phew, that was long, but hopefully helpful!

Userlevel 7
Badge +61

Hi @Chakiry,

Thank you for sharing this information with the Klaviyo Community. 

In addition to taking into consideration the points made by @mkprkr, you will have to add a discrete item to your cart after you have self-identified your browser to log an Added to Cart event. And, as @mkprkr pointed out, self-identifying the browser can be achieved by following the instructions here. Only after this step is done, will an Added to Cart metric appear under Analytics > Metrics in Klaviyo after you add an item to your cart.

Also, you must already have Viewed Product tracking installed in order for the Added to Cart event to appear and function . The Viewed Product snippet must be installed above the Added to Cart snippet in the code for your website. We have more details in our article on this topic here.

Thanks, and have a great day.

 

Badge

Your event listener will function as intended if you add this code, test it, and then keep an eye on the dev console to see if this logs out. If the statement really logs something, it can mean that the event listener is set up correctly. If so, the fact that you are attempting to make the track call without first providing Klaviyo with your known identify is the most likely cause of it failing.

If the "Added to Cart" event is not appearing on your analytics, it could be due to several reasons. Check if the event tracking code is correctly implemented on your website, verify if the event is firing correctly, and ensure that there are no issues with the analytics platform configuration or integration.


 

If the statement logs, it indicates correct configuration of the event listener. In the scenario where a track call isn't successful, it's probable that the call is made without a recognized identity in Klaviyo. Essentially, the code might be sound, but without a known igg game user identity in Klaviyo's cookie, the track call won't be transmitted intentionally.


 

Reply