@stephan - This is a head scratcher, I took a look at the console of your site and saw the same error (Chrome/Mac). You did everything I would have tried as well (reconnect, reinstall, add snippet manually).
It seems like something (Shopify?) is blocking the code injection (or _klOnsite
library from loading) since it’s checking if it has a value there. Do you have any other libraries or frameworks could potentially be blocking javascript from loading? Have you tried re-ordering the Klaviyo snippet higher (or lower) in your code?
I sort of suspect Cookiebot to be the culprit here, because it’s job is actually to block javascript/cookies from loading so maybe double check its settings/filters - I’m not familiar with it so I can’t be really helpful here. I know you said you let it “Allow All” - but perhaps re-ordering Cookiebot code might help due to some race condition.
See this documentation:
Maybe that will send you on the right track. If you get it to work, let us know how!
@retention Thank you very much for your reply. I’ll have a closer look into the impact of Cookiebot. However, I’ve also in the meantime deactivated the auto-blocking which didn’t help. I’ll try to move it further down. But at the same time, it can’t be a solution to outrun Cookiebot?!
And I was thinking that so far Klaviyo always managed to work/had a pretty high “threshold” until it’s actually being blocked. Now when I open the website in Firefox with the Standard Privacy setting I already receive the notification in the console:
Request for access to cookies or storage for "https://static.klaviyo.com/onsite/js/klaviyo.js?company_id=YugZdJ" has been blocked because it originates from an activity tracking element (tracker) and page element blocking is enabled.
Not sure if this is already part of the problem, but I expect most of the users to have at least these settings active (and remember, I still have “allow all” in my cookie settings) and the integration shouldn’t be so “delicate”?!
@retention Following up: I just did a quick test of deactivating the Cookiebot script completely.
This solves the back in stock error messages in the console - but the back in stock functionality still does not appear on the product page.
Also the Active On Site event is not being tracked on Klavyio-side, tested with the method described here: https://help.klaviyo.com/hc/en-us/articles/4425956184731
Any ideas welcome!!
In case someone comes across this thread: I managed to fix the issue (my mistake), the Klaviyo support kindly pointed out that at that time when he executed the command
window.Shopify.customerPrivacy.userCanBeTracked()
with the console log, the return was false, which leads to that Klaviyo will not track onsite events for the user, independent of the Klaviyo snippets and codes installed.
(More information on how to set and update this in the Shopify documentation here: https://shopify.dev/docs/api/customer-privacy)
It appeared that the analytics consent tracking field needed to be set to True, which was then not the case.
Solution:
It was already described in the Cookiebot manual: https://support.cookiebot.com/hc/en-us/articles/360006184253-Shopify-installation
I missed the first part "Enabling the Customer Privacy API ", after setting this up, all works (also the Shopify session tracking which was broken until that point, btw.)