-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accesses global variables: Prohibited read on global variable: google_tag_data.ics.entries. #5
Comments
Onetrust have been wanting to update this CMP for half a year or more @jmpate |
I just ran into this issue also. Tried to add 'google_tag_data.ics.entries' to the permissions tab under "Access global variables", and got the following message "The value must not start with any key predefined on global scope (i.e. in Window), or any JavaScript |
@lewis-lynchpin, I was able to get past the error by doing the following: Removing the lines related to "google_tag_data.ics.entries", it seems @jmpate added that for debugging purposes only. You also need to adjust the permissions on the default template: |
@ciejason Brilliant - that works! Hopefully the plugin gets an update soon to resolve this, as for containers not managed exclusively by ourselves I'm wary of having a template that requires custom modifications. |
@jmpate ? |
@lewis-lynchpin @simonmadsen @jmpate, I ran into another issue when testing my integration. Maybe I'm missing something, but at what point does the updateConsent method get called?
Passes updateConsent to a method window.updateGCM, but that method doesn't seem to exist? (I thought maybe OneTrust's script would define it on the window). The problem is that the consent is supposed to be updated before my other tags are triggered so that they can be blocked/allowed by the consent settings defined on the tag. Looking at OneScript's minified code, I see this: It appears to be updating my consent for each type (based on my selections/interaction with the cookies banner), but it does it too late in the process if I am not mistaken. See this note from Google's Docs https://developers.google.com/tag-platform/tag-manager/templates/consent-apis#update_consent_state Any ideas? |
From OneTrust's documentation:
I'm reading this to mean that if your tag was triggered, and it is one that adjusts it's behavior based on the consent types granted, then everything will work as expected. This does not address tags that were not fired on page load. I'm at a loss of how to accomplish this, other than listening for the "OneTrustGroupUpdated" custom event detailed in the OneTrust knowledge base article "Cookie Consent Integration with Google Tag Manager". However, I thought the Google Consent mode was supposed to replace this method |
@simonmadsen @lewis-lynchpin , I was able to get a proof of concept working to synchronously grab the user's saved consent via OneTrust's OptanonConsent cookie. This is the recommended method in Google's documentation for creating a GTM Consent Mode Template. From https://developers.google.com/tag-platform/tag-manager/templates/consent-apis#update_consent_state
The only concern with this method would be if OneTrust ever changes the cookie name or format of the value stored. I'll post back once I'm able to run a few more tests. |
@ciejason I just took a look at the global variables window.OneTrust and window.Optanon and there is a function there called I am convinced this was the intention of @jmpate but unfortunately I still cannot get this to work even with this update. |
Two things I noticed wrong with the update code:
I couldn't figure out how to get the |
Hi @simonmadsen and @cbravo, I am just now able to revisit this. I did not understand why the updateConsent method was needed since OneTrust performs the update as I mentioned here #5 (comment). I believe the main concern, and what is missing from the template is the ability to set the default consent based on a users previously selected preference. In order to do this I followed Google's documentation and read OneTrust's cookie that stores the user's preferences. Here is some rough code from my POC, I still need to refine it and add some error handling, and map the OT consent group to Google's. I need to parse otGroups, and then set the default state accordingly. I'll report back when I've completed an end to end test. |
Something missing from this template out of the box is the ability to take advantage of any category mapping done on a geolocation basis for your defaults. For example if you are using multiple templates in onetrust (GDPR, CCPA for california) the cookie categories and how they map to each google consent category may be different. Instead of setting the defaults before injecting the onetrust script I wrote this small template that fires only once per page on the OneTrustLoaded event AFTER onetrust is loaded the very first time so that I can set the defaults based on the settings in OneTrust (see screenshot). If the user already has set their preferences OneTrust should set those right after and override these defaults so it should work in that case too. If you do use this code make sure to set permissions so that you have access to the appropriate globals.
|
I really hope you
I really hope you'll succeed. |
@cbravo @ciejason (@lewis-lynchpin @jmpate @thematan) the onetrust option for google consent works in all ways currently as i see it except for one thing. this means that for all non google tags using the all pages trigger (gtm.start/container loaded) the custom event trigger OneTrustGroupsUpdated must be applied. alternatively all tags can be changed to trigger with window.loaded but that is an even less sub-optimal solution TLDR: onetrust has done all the programming but sets previously set consent too late. @ciejason i see you worked on a solution to this in your latest comment. any progress? see pic for reference |
Btw i just realized. |
Hi, do you have any update on your progress? |
Sorry. It worked for me and I didn’t do more
…________________________________
From: Bill Tindal ***@***.***>
Sent: Monday, March 27, 2023 6:02:07 AM
To: jmpate/ot-cmp-gcm-template ***@***.***>
Cc: simonmadsen ***@***.***>; Mention ***@***.***>
Subject: Re: [jmpate/ot-cmp-gcm-template] Accesses global variables: Prohibited read on global variable: google_tag_data.ics.entries. (Issue #5)
Hi @simonmadsen<https://github.com/simonmadsen> and @cbravo<https://github.com/cbravo>,
I am just now able to revisit this. I did not understand why the updateConsent method was needed since OneTrust performs the update as I mentioned here #5 (comment)<#5 (comment)>.
I believe the main concern, and what is missing from the template is the ability to set the default consent based on a users previously selected preference. In order to do this I followed Google's documentation and read OneTrust's cookie that stores the user's preferences.
Here is some rough code from my POC, I still need to refine it and add some error handling, and map the OT consent group to Google's. const otCookie = getCookie('OptanonConsent',true)[0]; const otCookieParams = parseUrl("https://test.com?"+otCookie).searchParams; const otGroups = otCookieParams.groups; log(otGroups); // Returns something like C0003:1,C0001:1,C0002:1,C0004:1,BG88:1
I need to parse otGroups, and then set the default state accordingly. I'll report back when I've completed an end to end test.
Hi, do you have any update on your progress?
—
Reply to this email directly, view it on GitHub<#5 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAJ7WVFPRAPWG6TD3K46Z3DW6EGL7ANCNFSM6AAAAAARLKNWIQ>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@malpaso , I have a working solution that seemed to satisfy my particular need. I will post it towards the end of this week. |
Do an update fork on GitHub?
Include the changes in the fork i made?
Fra: ***@***.***>
Sendt: 27. marts 2023 21:41
Til: ***@***.***>
Cc: ***@***.***>; ***@***.***>
Emne: Re: [jmpate/ot-cmp-gcm-template] Accesses global variables: Prohibited read on global variable: google_tag_data.ics.entries. (Issue #5)
@malpaso<https://github.com/malpaso> , I have a working solution that seemed to satisfy my particular need. I will post it towards the end of this week.
—
Reply to this email directly, view it on GitHub<#5 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAJ7WVCBE2O2C7EXFG2SL2LW6HUOJANCNFSM6AAAAAARLKNWIQ>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
This is exactly what I did already ;) But interested to see what @ciejason has done. |
I described further up that it works and how
…________________________________
From: hello-nclvn ***@***.***>
Sent: Thursday, June 8, 2023 7:45:39 PM
To: jmpate/ot-cmp-gcm-template ***@***.***>
Cc: simonmadsen ***@***.***>; Mention ***@***.***>
Subject: Re: [jmpate/ot-cmp-gcm-template] Accesses global variables: Prohibited read on global variable: google_tag_data.ics.entries. (Issue #5)
@ciejason<https://github.com/ciejason> @malpaso<https://github.com/malpaso> Also curious about the solution; I'm struggling to integrate OneTrust with GCM via Tag Manager. Thanks so much in advance!
—
Reply to this email directly, view it on GitHub<#5 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAJ7WVAWLOEJLARYHEAZAILXKIFUHANCNFSM6AAAAAARLKNWIQ>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
This error message is thrown unfortunately when simply trying to run the Preview in the Template editor. Subsequently the tag does not work as intended.
Any thoughts at all on how to resolve this?
Thanks in advance!
The text was updated successfully, but these errors were encountered: