I can’t seem to figure this out after reading other discussions’ on ATC and Viewed Product. I’ve just added the Viewed Product code and Add to Cart code to my client’s Shopify store but both of these events do not seem to work. Here’s the screenshot of the codes:
(ps. I got the add to cart ID by following these steps)
I’ve also tested it with putting the ?firstname.lastname@example.org at the end of the store’s url but it didn’t trigger any of these two events.
Also, the store also has other product pages as shown below. Do I need to insert these codes in all 4 pages?
Please let me know if I’m missing a step or did this incorrectly. Thank you!
Best answer by David ToView original
From your screenshots it does appear the Viewed Product snippet is installed correctly. The Add to Cart snippet though, I would advise reviewing further. In my experience when an add to cart button is identified by a numeric value as yours has, chances are these add to cart button IDs are unique. This means they’ll often times have a global class notation associated with this. In this case, you’ll want to reformat and use the alternate code mentioned in the Alternate Snippet for "Add to Cart" Button without a Button ID section of the Guide to Creating an "Added to Cart" Event for Shopify Help Center article.
There’s also been a number of Community topics on this as well which highlights the use of the alternate code snippet when a class notation is defined such as the ones below:
If you need further hands on assistance and troubleshooting, I would advise reaching out to your site developer who can further review your site code and troubleshoot. You can also consider reaching out to a Klaviyo Partner for assistance.
I hope this helps!
@David To, thanks for the response.
As per your suggestion, I checked to see if I’ve installed the Klaviyo.js correct and if I have multiple Klaviyo accounts associated by going to view page source. I found three company_id tags as shown in the screenshots above. One has a different company ID and the other two are the same company IDs. Does this mean that there are multiple Klaviyo accounts associate with the website?
I took the liberty of editing your post and removing your screenshots as they displayed your various account’s site/public ID for security purposes.
If there were any company IDs present on your website that do not align with your own account’s ID, then this would mean you would have multiple Klaviyo accounts associated with your site. As mentioned prior, this is known to cause a variety of issues including events not recording accurately within your desired account. This has to do with whichever account ID gets loaded first will record those viewed product, active onsite, etc. events that’s based on the web tracking.
I would suggest taking the steps outlined in the previously linked Community post to alleviate this. You can also reach out to our wonderful Support colleagues to have the accidentally created and linked account cancelled if you wish.