Viewed Product tracking - how to add for a new shopify theme like Motion

  • 26 January 2022
  • 3 replies

Badge +2

I have a browse abondement flow, but it’s not activated because viewed product tracking is not enabled by default. How can I enable this for a new shopify theme like: Motion. I don’t have a standard product.liquid file in the code of this theme.

The second part of the question: what results will I actually achieve with this, will it actually be able to find email addresses of users who go on my website to only view a product and not ATC (if they come from a source like Facebook). 

Thanks in advance.


Best answer by alex.hong 26 January 2022, 19:39

View original

3 replies

Userlevel 7
Badge +58

Hey there @Fashionshop123,

Welcome and thank you for posting to the Community!

It looks like you might be using Shopify 2.0. In Shopify 2.0 you edit code in JSON instead of Liquid template theme files within Shopify. Most of the features now rely on JSON templates. Shopify has created this guide, which provides step by step instructions for converting a Liquid template into a JSON template, and moving any required Liquid code into sections that you can include in the new JSON template. 

That being said, Klaviyo's Viewed Product snippet and Added to Cart snippets were designed to be installed within Shopify's product.liquid theme files. If you navigate to your Shopify admin > Online Store > Edit Code, you should now see a product.json template instead. 

Click on the product.json template and refer to the name you see listed within sections > main > type:


*Please note that the names within your “sections” may vary.

In this example, the name is product-template. Then locate that title within the Sections folder: 


In this example, it is the product-template.liquid section file that we would open up, and search for the characters
'{ schema %}'


Then, you can proceed to insert the Viewed Product snippet and Add to Cart snippet (if desired) directly above the '{ schema %}' line and click Save.


When product page tracking is installed, a Viewed Product metric will be tracked whenever an identifiable browser views a product page on your website. 

After enabling tracking on your site, you can test that tracking is set up properly by following these steps:

  1. Navigate to your website
  2. Add the following to the end of your store url, replacing with your email address:
  3. After you reload the page, search in Klaviyo for your email address

You should see that a Klaviyo profile has been created for you (if one didn't exist already) and that this site visit has been tracked on your activity feed.

Over time, to see a live feed of all tracked activity for the Active on Site and Viewed Product metrics, when you navigate to the Activity Feed on your dashboard. Here, you can filter for the metric of your choice by clicking into the dropdown menu next to Showing Feed for. You can also navigate to the Analytics tab of your account and click on each metric to analyze tracked data through an activity feed, activity map, charts, best people, and cohort reports.

When you add Klaviyo's web tracking to your site, we only track the browsing activity of "known browsers" — i.e. browsers that have visited and engaged at least once before. Klaviyo will not track anonymous browsers.

An example of a subscriber profile when they have engaged with your website before, as Klaviyo does not track anonymous browsers

There are three key ways Klaviyo will be able to identify a site visitor for web tracking purposes:

  • If someone has, at some point, clicked through a Klaviyo email to your website
  • If someone has, at some point, subscribed/opted-in through a Klaviyo form
  • If someone has, at some point, logged into your site and you have identify tracking installed

As a result, until you start sending emails with Klaviyo and growing your lists, you probably won't see a lot of tracked web activity. Over time, Klaviyo will identify more and more of your contact-base and your web tracking data will become more comprehensive.


If you wish to troubleshoot your viewed product tracking, I recommend checking out this documentation.


Hope this helped!

Badge +2

Very detailed answer, everything is working. Thank you! 

Userlevel 7
Badge +58

Glad I could help!