Openli
IntroductionGetting StartedTechnical DocumentationGet help
  • Getting started
    • Introduction
    • Dictionary
    • FAQ
      • IAB TCF v2.0
  • Privacy hub
    • How to create your privacy profile
    • How can I get an Openli Privacy Badge?
    • Vendor owners
    • Why are custom properties on vendors super valuable?
    • Setting up custom properties
  • Tasks
  • Cookie Consent Management
    • Quickstart
    • Checklist: Cookies
    • Cookie widget
      • Create a cookie policy
      • Create a cookie widget
      • Install the widget
      • Manually add any cookies
      • Customise your widget
      • How to get color codes
      • Set the widget language
      • Use custom link/button instead of Cookie Shield
      • Add company name to cookie pop-up
    • Categorise your cookies
    • Adding information to cookies
    • Adding information to your cookie providers
    • Blocking Cookies with Openli
    • Cookie expiration dates and lifespan
      • Changing expiration on Google Analytics cookies
  • Policy and agreement management
    • Generate your privacy policy
    • Changing an old cookie policy to a new on autopilot
    • Embed your policies and legal agreements
      • Embedding agreements without displaying a widget
    • Install the Privacy Badge
  • General Openli guides
    • Setting up SSO (Single Sign-On)
      • SSO with Azure AD (Microsoft)
      • SSO with Google
      • SSO with Okta
      • How to log in with SSO
    • Add a website to your Openli account
    • Using projects to handle multiple languages
    • Collect consents without storing IP addresses or user-agents
  • Technical documentation
    • Widget
      • Collect cookie consent
        • Blocking cookies
        • Blocking embedded media
        • Cookie-widget options
        • Consent state API
    • API
      • Services
        • Personal data
        • Subprocessors
    • Cookies set by Openli
  • System Specific Integration Guides
    • Cloudflare
  • Legacy integrations
    • Google Consent Mode
    • Google Tag Manager
      • Block cookies with GTM
      • Install Openli with GTM
      • Prevent triggers from firing in GTM
    • HubSpot
    • Pardot
    • Shopify
      • Install cookie widget
      • Integrate consent with checkout
    • Square Online
    • Squarespace
    • Webflow
    • Wix
Powered by GitBook
On this page
  • What is Google Consent Mode?
  • How to setup GCM to control Google Analytics with Openli.
  • My data is not looking right after setting this up.
  • Relevant Caveats using GCM in beta
  1. Legacy integrations

Google Consent Mode

PreviousCloudflareNextGoogle Tag Manager

Last updated 8 months ago

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

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:

<script>
    // Initialize the data layer for Google Tag Manager (this should mandatorily be done before the Cookie Solution is loaded)
    window.dataLayer = window.dataLayer || [];
    function gtag() {
        dataLayer.push(arguments);
    }
    // Default consent mode is "denied" for both ads and analytics, but delay for 5 seconds until the Cookie Solution is loaded
    gtag("consent", "default", {
        ad_storage: "denied",
        analytics_storage: "denied",
        wait_for_update: 5000 // milliseconds
    });
    // Improve ad click measurement quality (optional)
    gtag("set", "url_passthrough", true);
    // Further redact your ads data (optional)
    gtag("set", "ads_data_redaction", true);
</script>

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.

Relevant Caveats using GCM in beta

Be aware that there are a few important caveats to keep in mind when using Google Consent Mode.

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

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

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
September 3rd, 2020
indicate whether consent was granted
more about Google Consent Mode here
consent-state events