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?
Best answer by alex.hongView original
Welcome to the Community,
To start, have you tried this step mentioned in the troubleshooting section
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:
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
_learnqto the console in Google Chrome DevTools if the script was correctly loaded directly onto the website or in Google Tag Manager:
You can see this for yourself by:
learnqinto 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,
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.
@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.hong -- that’s the confirmation I needed. We will switch to using the `utm_email` approach and validating that `_learnq` is defined.