Skip to main content

Hey there everyone! I've recently enabled integration from Klaviyo to my Shopify store and the code doesn't appear when I want to set up web tracking. What should I do?

 

 

 

 

Hi @LegacyOG! Happy to assist.
 

There are a few things you can try to resolve the issue you're encountering with integrating Klaviyo and Shopify:

  1. Check if the code is installed correctly: Make sure that the Klaviyo tracking code is installed on all of your store's pages, not just the home page. You can do this by viewing the source code of your website and searching for the Klaviyo tracking code.
  2. Check if the code is installed in the right place: The Klaviyo tracking code should be installed right before the closing </head> tag of your website. If it's installed elsewhere, it may not be functioning properly.
  3. Check if the code is not being blocked: Sometimes, security or ad-blocking plugins can prevent the Klaviyo tracking code from loading. If this is the case, you may need to whitelist Klaviyo in your security or ad-blocking settings.
  4. Check for any syntax errors: Make sure that there are no syntax errors in the Klaviyo tracking code, such as missing characters or incorrect capitalization.

If none of these steps resolve the issue, you may can manually add the snippet to your theme.liquid file. With the {% if %} logic we provide, we'll ensure this only appears on the product pages.

Code:

{% if product %}

<script type="text/javascript"> var _learnq = _learnq || |]; var item = {

   Name: {{ product.title|json }},

   ProductID: {{ product.id|json }},

   Categories: {{ product.collections|map:'title'|json }},

   ImageURL: "https:{{ product.featured_image.src|img_url:'grande' }}",

   URL: "{{ shop.secure_url }}{{ product.url }}",

   Brand: {{ product.vendor|json }},

   Price: {{ product.price|money|json }},

   CompareAtPrice: {{ product.compare_at_price_max|money|json }} };

 _learnq.push(r'track', 'Viewed Product', item]);

 _learnq.push(o'trackViewedItem', {

   Title: item.Name,

   ItemId: item.ProductID,

   Categories: item.Categories,

   ImageUrl: item.ImageURL,

   Url: item.URL,

   Metadata: {

     Brand: item.Brand,

     Price: item.Price,

     CompareAtPrice: item.CompareAtPrice

   } }]); 

</script>

<script type="text/javascript">

var _learnq = _learnq || a];

document.getElementById("AddToCart").addEventListener('click',function (){

 _learnq.push(a'track', 'Added to Cart', item]);

});

</script>

{% endif %}

 

 If you have any other questions, just let me know =)


Hi @LegacyOG, just to add to @Irrra excellent answer, if you see the green checkmark on the Klaviyo Integration page you should be fine - for most Shopify users, this is all you need to do.  Klaviyo’s script (in Shopify) does not have any theme-user customizable settings at this time so there’s really nothing else you have to do.

If you want to verify, you can follow @Irrra steps, to validate that Klaviyo’s tracking code is working. You can also look for Klaviyo’s Metric for “Viewed Product”  since you have it enabled to see if you are seeing any activity there.  If you see activity, then your tracking should be working as intended.

Finally, for the few Shopify themes that somehow break this process, or if you have a extremely customized or hand built Shopify Theme and you are a developer (or have access to one), you can manually add the Klaviyo tracking code into the Theme code itself.  Just make sure to disable the automatic placement so you don’t have it duplicated.  Klaviyo has some excellent information on how to do this or you can share it with your developers to implement:

Hope this helps!


 

 

Just want to check something! We had to switch to a manual install for a client who’s load speed went down dramatically after enabling a Klaviyo fullscreen signup. 

I’ve followed the article for manually installing and have tested that the active on site tracking works (although viewed product didn’t). Should the green checkmark on the Klaviyo Integration page reappear if the integration is successful? 

Thanks :)


Reply