Solved

Checking install of web tracking via Google Tag Manager (GTM)

  • 9 June 2022
  • 5 replies
  • 161 views

Badge

I’ve set up onsite tracking using GTM following the instructions here: https://help.klaviyo.com/hc/en-us/articles/360015392131-How-to-Add-Klaviyo-Onsite-Tracking-using-Google-Tag-Manager

When I test using the `utm_email` query parameter as suggested in that article, everything seems to be working.  However, if I try to validate the tracking setup using the “Setup Web Tracking” wizard here: https://www.klaviyo.com/wizard/web-tracking. I get a error message: “Script was not installed correctly”.

Does anyone know if that wizard checks something important about the setup?  Or is the error maybe because GTM creates a script tag that looks a little different from the provided snippet?

 

 

icon

Best answer by alex.hong 9 June 2022, 23:18

View original

5 replies

Userlevel 6
Badge +52

Hi there @BartMosley,

Welcome to the Community,

To start, have you tried this step mentioned in the troubleshooting section

If you get an error when trying to save either of the tracking snippets in Google Tag Manager, you will have to paste the snippets directly into your site.

I would also test to see if you can get to the active on site part.

It could be good to see if Active on Site would fire after you cookied myself. If it does, this means the code has indeed been installed correctly. Since it is working, you can feel free to ignore that error message you are seeing. 
 
Here is how you can test as well: 
 
Navigate to your site and add the following to the end of the URL:
 
?utm_email=EMAIL@gmail.com
 
Press enter to reload the page.

 

If that step did not work:

Please check to see if the klaviyo.js is on your site. We found that sometimes this can cause issues if it is not there. 

Also, you should be able to log _learnq to the console in Google Chrome DevTools if the script was correctly loaded directly onto the website or in Google Tag Manager:
?name=image.png
 
You can see this for yourself by:

  1. visit your website
  2. right click > inspect to open up the console
  3. type in learnq into the console.

 

 Did you add the install scripts for HTM on your site? More info on that in the video on this page.

 

Let me know if that helped first,

Alex

Badge

Thanks, I have confirmed that `_learnq` is loaded, and the events we want to capture are being captured.

I just want to check that the “Setup Onsite Tracking” wizard is not doing anything that I should be worried about, since it seems to be erroneously reporting that the script is not installed correctly.

I have the exact same situation. The setup wizard says there’s an error, but the script seems to be loaded on the website just fine and I can also log see the _learnq object in the console. 

Userlevel 6
Badge +52

Hey there @lehar001 and @BartMosley,

Thanks for sharing and helping with that troubleshooting. It is expected behavior when using Google Tag Manager (GTM) to install our Klaviyo.js that our validator won't see it. Only if you hard code it either manually or through the integration auto-injection will it validate. I would also recommend checking to see if your Klaviyo.js/onsite code is working by manually testing through self-cookieing and ensure the active on-site metric is firing.

A related community post can be found here:

 

Hope that helped,

Alex

Badge

Thanks, @alex.hong -- that’s the confirmation I needed.  We will switch to using the `utm_email` approach and validating that `_learnq` is defined.  

Reply