Solved

Active On Site (and following) events not working – Shopify App Embed Integration

  • 2 April 2024
  • 4 replies
  • 137 views

Userlevel 1
Badge +4

Hi, 

we’ve been successfully using the the Klaviyo App embed integration in our Shopify and were able to receive Active On Site, Viewed Product and Added to Cart events. 

Recently we changed our Theme to Broadcast and when I failed to implement the “back in stock” event + flow I realized that none of the Active on site events etc. are being received by Klavyio. 
I double-checkend the integration via the app embed, tried manual installation of the code snippet and lastly also the integration via Google Tag Manager. The snippet shows up in the source code but now events are coming trough. At last I removed all manual snippets, tags etc., removed the Shopify/Klaviyo integration and reconnected – no success, same effect! This is how it’s currently NOT working: https://aboutcompanions.com
(All consent given trough the Cookiebot CMP)

Does anyone have an idea?! I searched a lot in the community but didn’t find a solution. 

And then also the back in stock code snippet fails and causes error messages in the console (see screenshot). 

Any hint is greatly appreciated!! 

Thanks
Stephan

 

icon

Best answer by stephan 15 April 2024, 09:06

View original

4 replies

Userlevel 1
Badge +4

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.)

Userlevel 1
Badge +4

@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!!

Userlevel 1
Badge +4

@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”?!

Userlevel 7
Badge +58

@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! 

Reply