Added "Product Viewed" with GTM but company_id where the tag is send is wrong

  • 14 December 2020
  • 6 replies

Badge +2

Hi all,

Could you please help?

We have integrated Klaviyo into 2 Shopify plus stores.

We are getting most data except Product Viewed and Add to Cart. 

I have added the above 2 tags through GTM using the below code snippet: (please have in mind the base Klaviyo tag is installed directly in the theme)

<script type="text/javascript">
var _learnq = _learnq || [];
var item = {
"Name": "{{dlv - Product View - Name}}",
"ProductID": "{{dlv - Product View - Product ID}}",
"ImageURL": "{{DOM - PDP - Image URL}}",
"SKU": "{{dlv - Product View - SKU}}",
"URL": "https://{{Page Hostname}}{{Page Path}}",
"Brand": "{{dlv - Product View - Brand}}",
"Price": "{{dlv - Product View - Price}}",
"CompareAtPrice": "{{dlv - Product View - Variant Compare At Price}}"

_learnq.push(["track", "Viewed Product", item]);

_learnq.push(["trackViewedItem", {
"Title": item.ProductName,
"ItemId": item.ProductID,
"Categories": item.Categories,
"ImageUrl": item.ImageURL,
"SKU": item.ID,
"Url": item.URL,
"Metadata": {
"Brand": item.Brand,
"Price": item.Price,
"CompareAtPrice": item.CompareAtPrice

however in one of the stores I can see the company_id is wrong in the developer tools > Network so data is not sent to the right Klaviyo account.

I would expect it to go to API key / Site ID (MY API KEY), but it goes to another API Key


How could I make sure that data is sent to the correct public API key / Site ID since the base Klaviyo tag is installed directly in the theme and not in GTM?


Thank you in advance



Best answer by dim78 16 December 2020, 13:48

View original

6 replies

Badge +2

It looks like on page load there are 4 instances with different company ids.

The correct is the 3rd one but it is not picked up


Userlevel 6
Badge +9

Hi @dim78

Based on the details you’ve provided, I’d recommend reviewing your Shopify integration settings, or looking through this guide to manually installing Klaviyo.js. I’d suggest looking through your main site’s template theme and check what the company ID is in the active onsite snippet (should look like below and “API_KEY” should be your store)

<script type="text/javascript" async 

It should have “YOUR API KEY” as the Public API Key, so if it’s not, you can go ahead and make that change. 

If the API Key in the Active Onsite code snippet is the correct one for your store, can you drop a comment back and let us know? There may be other causes to explore. 


Badge +2

In case anyone experiences the same issue, reach out to Klaviyo.

In my case, there was an integration issue, resolved by Klaviyo team

Userlevel 6
Badge +9

Thanks so much for sharing this update with the Community, and glad to hear you were able to get this resolved! 

Badge +5

Has the same integration issue. Can it be solve by just updating the integration settings by unchecking the first box  when integrating?

Userlevel 7
Badge +61

Hello @karen1628,

Unchecking the box “automatically add Klaviyo onsite javascript” in the integration settings could work, but it is not a 100% reliable solution.

With that said, if you are noticing a single Klaviyo javascript snippet with the wrong API key on your site, I recommend updating it using the advice outlined by @cassy.lee in her last post -- locate the onsite javascript snippet and updating the public API key to the public API key of the correct Klaviyo account.

<script type="text/javascript" async src=""></script>

If you are noticing multiple Klaviyo javascript snippets with different API keys, I recommend reaching out to to support and providing them with the public API key of the Klaviyo account you want the events to be sent to. They will be able to remove the other keys from your site.

I hope that is helpful!