In a sandboxed environment, addEventListener may not behave as expected.

In a sandboxed environment, addEventListener may not behave as expected.

karolk95
New Member
4 0 0

I'm trying to set up conversion tracking (sending ecommerce data to the data layer via Customer Events custom pixel, and retrieving and sending it to the respective vendors like GA4 through GTM) and Consent Mode (via CookieBot). 

However, I'm struggling with passing the consent data from the top JavaScript context (since CookieBot is installed via theme.liquid file) to the Sandbox context (that's where all the conversion events are happening via Customer Events). 

I've tried using postMessageAPI for the theme.liquid to send consent data to sandbox context, and addEventListener() method in Customer Events to listen for those messages. However, I'm getting the following warning in console:
In a sandboxed environment, addEventListener may not behave as expected.

Due to which this is not working.

 

Does anybody know of a workaround? 

Replies 2 (2)

Sam_Mahmud
Shopify Partner
195 5 10

Hi Karolk95,

Thanks for your query.

 

could you please share your website?

 

which datalayer did you use to track ?theme dependent or independent?

 

 

Your COFFEE TIP! Can Create something incredible!
Require Assistance with website design or enhanced conversion tracking ?
sam.analyst4@gmail.com! or WhatsApp!
Solved? accept it as solution with like
karolk95
New Member
4 0 0

Hello Sam, 

 

the website is www.moblax.cz

 

I've used data layer inside Customer Events (sandboxed one).

 

Thanks