Solved

Where does klaviyo put the code in shopify?

  • 15 December 2020
  • 2 replies
  • 413 views

Badge

Somehow there are more than one klaviyo codes in my shop. Support have told me to deactivate and it will automatically remove it which it hasn’t. So they have asked me to remove the code manually which I am struggling with.

I have tracked it down to something happening within jquery.min or at least seems to be. However the code means very little to me. I am assuming it is pulling data from somewhere to get the url to pull for the code, however that is as far as I have got. Any ideas?

icon

Best answer by retention 16 December 2020, 01:11

View original

2 replies

Userlevel 7
Badge +5

@MClausen -  I ran into this issue with a past client where their embedded Signup Forms weren’t loading half the time.  We discovered that there was a race condition between two (or three?) different Klaviyo accounts that were loading on the same page in their Shopify instance. 

 

It turns out that if you installed Klaviyo via the Shopify App and “Registered a New Klaviyo Account” multiple times, it can link Shopify to more than one Klaviyo account.  This can sometime happen when someone clicks on the Shopify Klaviyo App, and instead of logging in, creates a new account by accident.

What makes matters worse, Shopify “Injects” these App dependent libraries at runtime, so you don’t see them in your Shopify Template code (as far as I know). 

  1. The easiest way to resolve this is to see if you have access to any “rogue” Klaviyo account out there, try to login to with that Klaviyo account and disable/delete the Shopify Integration.  
  2. If that doesn’t work, or you can’t find access to those Klaviyo accounts, try uninstalling the Shopify Klaviyo App. Unless you installed Klaviyo manually, you should no longer see any traces of Klaviyo.js anywhere on your site.
  3. If you still do, then you have some strange artifact leftover from the Klaviyo Shopify App and may need to reach out to Klaviyo to help determine what’s going on.  It’s helpful to find which Klaviyo Account ID is linked so they can track down the right account and try to deactivate Shopify integration.

Hope this helps and report back how you fixed it!

Userlevel 2
Badge +1

Yea to echo what @retention said (great description) this is most likely due to integrating 1 Shopify store with different Klaviyo accounts, thus creating multiple js scripts on 1 Shopify site.  

From the technical approach, if you’re interested in deleting the scripts yourself, you would need to utilize the API to do so. 

You would use the GET scripttags endpoint https://shopify.dev/docs/admin-api/rest/reference/online-store/scripttag#index-2020-10 to fetch a list of the tags.  In the response there would be an ID and then you would run a DELETE request: https://shopify.dev/docs/admin-api/rest/reference/online-store/scripttag#destroy-2020-10 with that ID.  

Reply