- π¬π§United Kingdom alexharries
I'm sad to see there hasn't been a response to your suggestion @JFeltkamp.
I'm unfortunately not knowledgeable enough about the Google Tag module to know whether I can help you code up a solution, but the organisation I work for use Google Tag and COOKiES and we have received a request to evaluate whether using Google's Consent Mode can be achieved.
If we can create a patch for the GTag module in-house which we think might have some benefit to other users, we will be sure to post it here.
Following this topic in the hope that someone much more capable comes up with a decent solution in the meantime!
/Al
- π©πͺGermany Anybody Porta Westfalica
@alexharries FYI: https://www.drupal.org/project/cookies β contains a Google Tag Manager submodule - is that what you're looking for or are you aware of that and your comment was about Google Consent Mode additions to that?
- π¬π§United Kingdom alexharries
Thank you @Anybody.
The issue here I think (/assume) is that there might need to be some change in how the GTag module loads the Google Tag script in order to let Google know that the user has declined consent.
When the COOKiES module is installed, the GTag module can determine if the user has declined consent from the COOKiES module - how I don't yet know - but it would be this check and the subsequent change to how the Google Tag is loaded which would presumably either need to happen in the GTag module, or potentially through a couple of strategically-placed hook alters in the GTag module which an external module could make use of to change how the tag script is loaded.
All of the above is vapourware/presumption until we can get a clear understanding of how this might work and what capability we already have in the GTag and COOKiES modules.
Β―\_(γ)_/Β―
/Al
- π§πͺBelgium tijsdeboeck Antwerp π§πͺ πͺπΊ π
Hi @alexharries, I've posted a comment on this in the cookies issue queue, maybe it helps you: https://www.drupal.org/project/cookies/issues/3364470#comment-15120948 β¨ Add GA4 snippet support in cookies_ga Fixed
- π¬π§United Kingdom alexharries
Thank you @tijsdeboeck.
So it looks like there is a sandbox module which should provide this functionality:
https://www.drupal.org/sandbox/gresko8/3267405 βDownloading and testing now - many thanks.
/Al
- πΊπΈUnited States DamienMcKenna NH, USA
Apparently this should work with the Cookies module for a while thanks to changes in π Google Tag manager is loaded without consent Fixed - has anyone confirmed this?
- πΊπΈUnited States hbrokmeier Wisconsin
π Google Tag manager is loaded without consent Fixed does not solve this issue. When consent mode is enabled in google_tag, consent is hardcoded to `denied`:
if (config.consentMode === true) { gtag('consent', 'default', { ad_storage: 'denied', analytics_storage: 'denied', ad_user_data: 'denied', ad_personalization: 'denied', wait_for_update: 500, }); }
If the default consent setting in google_tag wasn't hardcoded and could be defined in the module, we could set the default to `granted` and then cookies and google_tag would work nicely together.
@alexharries, @hbrokmeier, @damienmckenna @tijsdeboeck
Everyone, please stop.....let's take a time out for a minute before more damage is done. The information about Google's Consent Mode in these comments is incorrect.
*No Module should be setting defaults for consent: they shouldn't be hardcoded, nor should they be defined. In fact, no damn Module needs to screw with Consent Mode at all. If you choose to disobey this principle, you WILL pay a price, and you WILL have problems
*Consent mode defaults are preferably handed in GTM through the use of a template, as Google recommends. Simo Hava is an expert:
https://www.simoahava.com/custom-templates/consent-mode*Consent Mode is NOT a switch or setting that somebody activates like a light switch.
"Google Consent Mode allows you to configure how Google tags behave based on the consent users choose to provide or withhold through Cookie Consent." and "Google Consent Mode is an alternative to script blocking." -OneTrust
Why is the approach to Consent Mode so troubled in this Module?
Here's what's going on: simplistically, there are two ways to deal with consent mode: one through Google Tag Manager, and another through GTAG. You're supposed to choose one, or the other. You are not supposed to do both. But that's exactly what the Module developers have essentially done.
Since they chose the Google Tag Manager route, they shouln't be using any type of GTAG command. But they are....and you see how f'd up this is.
By taking the GTAG approach, they have f'ed all the people who might choose to use GTM to interact with their Cookie Consent Banners.
I'm excited to hear about the Cookies module possibilities....we've about given up on this Module because it hasn't worked correctly since being installed. We're desperate for alternatives.