Solved

Why is My Added to Cart Not Showing in my Metrics?

  • 29 September 2021
  • 7 replies
  • 1658 views

Badge +2

Hi there, 

I believe this question has been answered numerous times but it doesn’t seem to be working for me. So I have already input the code snippet (with Class Notation) into my product.liquid file: 

 

& when I go over to Klaviyo > Analytics, I can’t seem to locate ‘Added to Cart’ under metrics: 

 

 

Is there something that I am missing out here? :sweat_smile:

icon

Best answer by Taylor Tarpley 1 October 2021, 22:25

View original

7 replies

Userlevel 7
Badge +57

Hey @YJ Lee, welcome to the community!

Can you share with us the HTML source code for what your “Add to Cart” button looks like?  A lot of times this isn’t working is because it’s not referencing the correct Class name of the button HTML source. In your code, you’re referencing the Class name product-form__cart-submit (notice the two underscores), so I just want verify that is indeed the Button’s Class name.

Userlevel 7
Badge +60

Hi @YJ Lee

 

Thanks for sharing your question with us! I know Add-To-Cart can be a little tricky to get installed, I’d love to help! 

 

With installing the added to cart metric, it appears that you’ve followed three vital steps when installing this feature:

  • installing a code specific to your integration
  • installing the add-to-metric below the viewed product code on your product.liquid file
  • Determining whether you have a button ID or class notation upon inspection the button’s code and adding it accordingly

Can you share with us the HTML source code for what your “Add to Cart” button looks like?  A lot of times this isn’t working is because it’s not referencing the correct Class name of the button HTML source. In your code, you’re referencing the Class name product-form__cart-submit (notice the two underscores), so I just want verify that is indeed the Button’s Class name.

 

@retention brought up a very important point. It is imperative that if your Button Doesn't have an ID, but a Class notation, you will need to insert the exact code you find on your button HTML source that is found in quotations after “ class= ” , into the parentheses after getElementsByClassName in your addd-to-cart code. It appears that everything is coded correctly, but I would follow @retention’s suggestion and double check the button class code you inserted is correct. 

 

Additionally, two other things to keep in mind which might be the reason why the metric isn’t firing correctly. First, you could have a custom Shopify theme and your ‘viewed product’ metric isn’t installed on all your product.liquid theme pages. Second, if no one has fired the ‘add to cart’ metric so there is nothing to record yet. Only until someone fires the metric will an Added to Cart metric appear under Analytics > Metrics in Klaviyo. This is further explained in this Community Post below.

 

 

To rule out that your code is incorrect and you wish to trigger the event by Test Web Tracking, follow these steps to see if the metric fires in your account:

  1. Navigate to your website
  2. Add the following to the end of your store url, replacing example@gmail.com with your email address:
    ?utm_email=example@gmail.com
  3. After you reload the page, add a product to your cart 
  4. Navigate back to Klaviyo and look up your profile to see if you see the event recorded 

 

For more insight into similar conversations other users are having about this issue, check out the posts below! 

 

Thank you for being a part of the Community! 

 

-Taylor 

Badge +2

Hi both, thank you for the quick reply! As requested, here’s a screenshot of the source code of my Add to Cart button: 

 

:) 

Badge +2

Thanks Taylor. So I included the full class code in it: 

 

Here’s a reference of my Add to Cart button: 

 

But the Add to Cart function is still not showing on Klaviyo: 

 

Am I missing on anything ?? 

 

Best, 

YJ

Userlevel 7
Badge +60

Hi @YJ Lee

 

Can you confirm that you have triggered the ‘Added to Cart’ metric on your website? The Added to Cart metric will only appear under Analytics > Metrics in Klaviyo once it is triggered, meaning someone has activated the event. I would suggest cooking your browser as I outlined above and testing the metric to see if it will fire. 

 

If no one has fired the ‘add to cart’ metric so there is nothing to record yet.

 This is further explained in this Community Post below.

 

To rule out that your code is incorrect and you wish to trigger the event by Test Web Tracking, follow these steps to see if the metric fires in your account:

  1. Navigate to your website
  2. Add the following to the end of your store url, replacing example@gmail.com with your email address:
    ?utm_email=example@gmail.com
  3. After you reload the page, add a product to your cart 
  4. Navigate back to Klaviyo and look up your profile to see if you see the event recorded 

 

 

 

Please let us know if the issue is solved after this process!

 

-Taylor 

Badge +2

Thanks Taylor!! All good now. Thank you so much for guiding me through. Have a good weekend : ) 

Badge +1

i am unable to get the profiles that add to cart the products , when i go to analytics i did not find anyother profile , i only get the email from which i test with utm link,

Reply