Google Consent Mode
Openli has no current plans to add support for Google's Consent Mode v2 at any point.
If you require support for Consent Mode v2, we recommend that you choose an alternative cookie-consent solution.
This courtesy guide is no longer actively tested by Openli, although it might still work.
Our cookie-consent widget intentionally uses a highly-compatible, highly-generic approach to integration. In most cases, it will be possible for your developers to adapt this guide's steps to any changes that might have been made to the target platform, in combination with their own general documentation. Our consent-state events might be useful for this.
What is Google Consent Mode?
Google Consent Mode (GCM) is a new API (currently in beta), which helps you to adjust the behaviour of some Google services based on the consent status of your users.
Overall, it helps to run your website’s marketing and advertising, while respecting users' consent choices.
Google Consent Mode was launched on September 3rd, 2020. It is another big step in the direction of a more privacy-focused Internet. GCM builds a more sustainable future - where advertisement and data collection are still possible, but much more based on user consent.
So, it is a win-win: websites can still access some data and generate revenue and at the same time respect user privacy.
For example, with the help of Google Consent Mode, you can indicate whether consent was granted for Analytics and Ads (marketing) cookies. If there is no consent, some basic data will still be passed to Google products, but ads will be much less targeted.
You can read much more about Google Consent Mode here.
How to setup GCM to control Google Analytics with Openli.
To make Google Consent Mode work with Openli is not too difficult.
Be aware that this only works if you are using GA4. This will likely not work with UA (the old Google Analytics).
You simply need to make sure the google datalayer is initialised and that it sets the consent states as "denied" before the Google analytics and the Openli scripts are loaded. You can do this by adding this HTML to the head
block of your site:
Secondly you will need to unblock the GA script in your Google Tag Manager if you already blocked it using the Openli triggers, as GCM is used instead of those, and they conflict with it. If you set up GA using a script directly in the code and blocked it manually, you will need to remove this blocking.
Once this is done you are good to go.
Openli pings the data layer to change the settings for ad_storage
and analytics_storage
and either grant or deny data-storage and -collection, so our widget will take care of the rest. If done correctly, you should start to see data coming in.
To check if the cookies are now not being set, you can open a private session in your browser ("Incognito mode"), and open the developer tools (F12
or ctrl
+shift
+i
). Without giving consent, browse your website a little. If set up correctly, you shouldn't see the _ga
, _gid
, or _gat
cookies being set in the cookie or storage related section of the developer tools.
My data is not looking right after setting this up.
So at this point you've taken the steps above, and everything looks to be doing what it should, but you do not see the data you expect. Unfortunately, because Google Consent Mode is just an API which Openli uses to pass consent data to Google Tag Manager, the specific details of how the different tags are meant to respond to this data is beyond our control. We have no insight into what tags do with these settings due to the relatively black-box approach Google has taken, which means that we can't say anything about how Google Analytics (or another tag) should behave when it receives the Consent Mode instructions. If you want to learn more, you can visit Google's developer documentation here.
Relevant Caveats using GCM in beta
Be aware that there are a few important caveats to keep in mind when using Google Consent Mode.
Google Consent Mode is still in Beta from Google, meaning it is still subject to change and issues with the method can be unsolved. Openli has set it up to specification, but we cannot guarantee functionality if Google makes changes or if consent is not collected due to issues with GCM.
Based on the information provided by Google, it looks like using GCM is compliant, however, we cannot know for sure if Google is following GDPR rules completely, hence using GCM might not be GDPR compliant.
With those caveats in mind, it does look like it is safe to use GCM from a compliance perspective, but until any real information is available on the matter from the data authorities, no guarantees of compliance can be made.
Last updated