We are receiving the error that “Klaviyo is not defined” while triggering the event and the whole page is frozen in WordPress. It looks like Klaviyo is not initialized/loaded correctly. Is there any method or callback to ensure that Klaviyo is loaded successfully?
Page 1 / 1
Hi @Citrusbits!
I would start by closing the site and clearing your browser cache/history. Then, open a new window and log back into Klaviyo/WordPress.
Also, is this a custom integration with your WordPress site, or are you using a pre-built integration with an e-commerce platform/app like WooCommerce? This will help myself and other Community members obtain a better understanding of the issue.
In the meantime, here are some Community threads that might help you get some context:
Thanks for using the Community!
- Brian
Hi @Brian Turcotte!
I’m having a similar issue.
I inject the two snippets using two tags in Google Tag Manager:
I see the difference is the presence of _learnq and not of klaviyo, but I also saw on the API reference that the new versions do not use learnq.
Thanks for any help!
P.S.: I’m using GTM because I’m working on with a custom platform and making changes to it involves a long time.
Hi @federico.vitale!
My apologies for the delay here. Others that have encountered this issue have resolved it by ensuring that the Klaviyo.js script is present on your site/renders upon page load:
It's important to note that the updated documentation's use of klaviyo is specifically referencing the klaviyo object we introduce in our documentation here:
To use this klaviyo object, the Klaviyo.js needs to actually render on the webpage you are on; loading it within the console is rarely sufficient.
I hope this helps!
- Brian
Hey there @Brian Turcotte!
I am encountering a similar issue . After reading through the thread and reading through the associated documentation that you sent, I am still at an impasse.
For context, I am loading Klaviyo via GTM (as seen below)
This tag is sent to fire once per page on page view.
On a specific route on my website, I want to track a custom metric using klaviyo.track(k...]). Given that this event (loading the Klaviyo Script) is asynchronous, I have setup the following code block:
Hi @Brian Turcotte, I might have solved the issue in the way I wrote in my last reply :)
For those who use GTM, the thing I saw is that it is important the order the tags fire (I know it might be obvious), so just to make sure the tag that loads the Klaviyo object fires before any other klavio.js operation.