Solved

Where to set up view web tracking code in shopify 8.2.0 ?

  • 4 March 2022
  • 1 reply
  • 165 views

Badge +2

Hi there,

In this store I didn’t find any product.liquid file as you can see that in image below:

Where should I put the snippet code?

And i don’t have custum liqquid section in my store ?

Please help me. Thank you

Theme version 8.2.0


 

icon

Best answer by alex.hong 4 March 2022, 19:25

View original

1 reply

Userlevel 7
Badge +58

Hi @Abdelkrim,

I understand you are having some difficulty with some of Klaviyo’s code snippets, since migrating to Shopify 2.0.

Shopify 2.0 was introduced to allow developers more freedom to edit code in JSON instead of Liquid template theme files within Shopify. The main difference you'll face after upgrading to Shopify 2.0 is that 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 said, Klaviyo's Viewed Product snippet and Added to Cart snippets can now very easily be added via a Custom Liquid block for Shopify 2.0 Themes. To do this, please follow the steps below:
 

  1. In Shopify, navigate to your theme and click Customize
     

  2. At the top of the page, click the Home page dropdown, and select Products > Default product to be brought to your default product page. 
    ?name=inline685893383.png
    ?name=inline-1331390334.png
    ​​​

  3. Click Add section in the left sidebar, and then select Custom Liquid.
    ?name=inline-2043703939.png
    ?name=inline-343879352.png
    ​​

  4. Paste the Viewed Product snippet and/or the Add to Cart snippet into the Custom Liquid text box.
    mceclip2.png
    *If you are pasting both snippets, you can do this all at once with the Add to Cart snippet directly beneath the Viewed Product snippet. 
     

  5. Click Save in the upper right. 


After making this update, Viewed Product tracking and/or Add to Cart Tracking should now be applied to all of your product pages. You can test this out as a cookied (identified) profile by doing the following: 
 

  1. Go to your website

  2. Add ?utm_email=youremail@example.com to the end of your website URL (of course using your email address in place of this example email address) like this: www.yoursite.com?utm_email=youremail@example.com

  3. Proceed to view a product page 

  4. Press the Add to Cart button (if applicable)

  5. Check your profile within Klaviyo to see that the Viewed Product metric and Added to Cart metric were properly recorded!

 

All the best,

Alex

Reply