Skip to main content

I managed to integrate my shopify account with Klaviyo but even after pasting the snippet code into product.liquid in the shopify theme, the web tracking won’t successfully get set up - it just says ‘waiting for data’ at the bottom and won’t receive anything. 

What should I do?

You can check the active on site metric or viewed product metric to see if anyone qualifies. It might take some time to render the changes


Apologies for the delay in responding - just to chime in and agree with @quagrowth on this. There can be a little bit of a delay for when the data is synced and for the changes to apply. You can also run a test for a Checkout Started event to see if the data comes in. 
More details on how to test web tracking here


I’ve waited for 1 hour but the button never turns green. I am not sure how long the delay will last.


Hey @manyquests ,

Thank you for asking about the delay in your Shopify Web Tracking. 

Your Shopify Web Tracking should happen in real time, however sometimes there can be a slight delay, but usually does not take a hour to complete. I would suggest manually testing your site by cookieing your own browser and attempt to trigger the active onsite and viewed product metrics, like @cassy.lee  suggested previously. The Guide to Klaviyo Web Tracking will go in depth on how Klaviyo web tracking works and how to test your site. Often times the web tracking is already enabled through automatically being injected as part of your Shopify integration , 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 example@gmail.com with your email address:
    ?utm_email=example@gmail.com
  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. Manually testing your account in this manner tends to be a more reliable and immediate way to verify that it was set up correctly, rather than waiting for the integrated tool to inform you.

If this does not solve your challenge, please refer to the Help Center article How to Install Klaviyo.JS to your Shopify Store. By adding the relevant code snippets to your site manually you can accomplish the same outcome, if the automatic installation of the code wasn’t successful.

 

Thank you for being a new member of the Klaviyo Community!!!


Hello,

How can I do the code for Web Tracking on the Dawn Theme? There is no product.liquid in template section. Thank you!


Hey there @Bellabeauties 

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 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:

?name=Img+1.png

*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: 

?name=Img+2.png

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

?name=Img+3.png

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. 
 

Hope this helped!

Alex


I’m having trouble with this as well.

I have the Out of the Sandbox Flex theme - updated to Shopify 2.0. I tried pasting my code into the product_main.liquid above the schema line, but I get an error message. I also tried the product-sections__main.liquid and get the error message. These are all the product sections I have in my theme. Which would I use?

 


Hi there @Leslie Nicole,

Would you mind sharing a screenshot of the error message you get after following the instructions above?

 

Thank you!

Alex


Hi there @Leslie Nicole,

Would you mind sharing a screenshot of the error message you get after following the instructions above?

 

 


Hey @Leslie Nicole,

So the reason behind why you are encountering this issue come down to how Shopify 2.0 and Klaviyo integrate and what code to use to implement viewed product.

In our documentation regarding this topic, please note that 2.0 themes don't have the same implementation method for viewed product compared to other themes. For Shopify 2.0 themes, it is required for a custom liquid block to be integrated as well. 

I would just review your code, make sure syntax and formatting is preserved when pasting in code, and check over our instructions on our documentation regarding 2.0 themes as well.

 

Thank you!
Alex


 

Hey Alex,

 

I’ve managed to get the code right in the Dawn Template that is a Shopify 2.0 theme via the main-product.liquid file.

 

However, it’s taking forever at the Setup Web Tracking part wherein I am constantly at the “Waiting for data...” screen for ages. What could be the problem there?


Hi there @bennylee!

Is your page possibly a password protected site?  You'll need to continue with the steps to add the product tracking for your Shopify store, then check the installation when the site is live: How to Integrate with Shopify.

If not, it could be that the onsite snippet for activity tracking was not installed.  Could you try unchecking both options here and updating? Then, enable both, and update once more.  Once you do that, search your HTML here for "onsite": view-source:https://www.yoursite.xyz. At this point, it is important to check that you do not have two versions of the klaviyo.js snippet installed. Having two versions of the JS installed creates a "race condition," so they have to compete to decide which will load on the page every time a users views your site. When one account's JS "wins," that will cause issues with anything you've set up through the other integration. But, if you don't see anything you can manually install it by pasting the following script in your index.liquid file: 

<script type="text/javascript" async 
src="https://static.klaviyo.com/onsite/js/klaviyo.js?company_id=XXXXXX"></script>

Please let me know if that helped!
Alex 


Hi there @bennylee!

Is your page possibly a password protected site?  You'll need to continue with the steps to add the product tracking for your Shopify store, then check the installation when the site is live: How to Integrate with Shopify.

If not, it could be that the onsite snippet for activity tracking was not installed.  Could you try unchecking both options here and updating? Then, enable both, and update once more.  Once you do that, search your HTML here for "onsite": view-source:https://www.yoursite.xyz. At this point, it is important to check that you do not have two versions of the klaviyo.js snippet installed. Having two versions of the JS installed creates a "race condition," so they have to compete to decide which will load on the page every time a users views your site. When one account's JS "wins," that will cause issues with anything you've set up through the other integration. But, if you don't see anything you can manually install it by pasting the following script in your index.liquid file: 

<script type="text/javascript" async 
src="https://static.klaviyo.com/onsite/js/klaviyo.js?company_id=XXXXXX"></script>

Please let me know if that helped!
Alex 

hey @alex.hong,

 

Thank you for reaching back. Your suggestion for Unchecking and then Rechecking the “Automatically add Klaviyo onsite javascript (recommended)” sort of did the trick - managed to get “Data Received” (finally).

 

However, one caveat is that I don’t see the Activity Feed in my Klaviyo dashboard updating, however, when I launch the link generated via “3. Once you've added those snippets, enter the URL of your Shopify store below:” in Setup Web Tracking via an Incognito Window, I can see live updates on my Activity Feed. Is this cause for concern or should I be fine as long as I’ve got the “Data Received” confirmation?


Hi there @bennylee,

Glad you found it helpful!

I would also recommend to manually check if the Klaviyo.js is present through self cookieing as opposed to using a “checker”. Although the checker is typically reliable, we still recommend manually checking if you have any doubts. The activity feed should be find as long as you’re seeing the data received but again I would check manually as well.

 

Have a good day!
Alex


Reply