Info
Content

Working with Google Consent Mode

If enabled, the CMP will send additional consent information to GTM, Google Ads and Google Analytics.

What is Google Consent Mode?

The main idea behind Google Consent Mode is to always run analytics on a page: In cases when the user consents, the full reporting will be generated. And in cases when the user does not give consent, only limited data is sent to Google. This limited data can be used in order to model the missing data (see modelling below).

What is Google Consent Mode NOT?

Please also note, that one of the main features of consent mode is the modelling. The modelling comes with some minimum requirements (e.g. 100 ad clicks per day per country and domain). If you do not reach the minimum requirements, the modelling will not be used or may produce very limited data.

Note: The use of Google Consent Mode makes most sense when no blocking is active. Anyhow, if you use blocking of Google Analytics, Consent Mode can help to (re-)model the missing users.

Note: Please note that Consent Mode will work only if it is setup in the right order. A wrong setup might cause less data to be tracked compared to when not using consent mode at all.

Note: Please note that in most cases any measurment will require consent. We therefore recommend to always block Google Analytics on your website until consent is given.

One of the advantages of using Google Consent Mode is modelling that happens for users that rejected. If an sufficient amount of data is generated (current required minimum is 100 ad clicks per day), GA will take the data from users that accepted and try to apply the data on the users that rejected. This way, modelled tracking data can be generated, even for users that rejected.

Example Screenshot from Google's Modelling description:


(Source: Google)

The example above shows 1000 ad clicks (users coming to your website), from which 50% click on accept and 50% on reject. From the data that is generated by consented users, GA can forecast the data for unconsented users. As a result, the website will see more data in their GA reports.

Working with Google Consent Mode

In order to activate the Google Consent Mode, a website must send a specific signal to the Google Analytics code. Without the signal, Consent Mode will not work!

Although the CMP will automatically set the default status for gtag to denied, it is necessary to set the status manually in your Google Analytics code in order to ensure that the Consent Mode is enabled before Google Analytics starts. To ensure this, it is required to add the following lines of code. We recommend to add the following code to the page ahead of any other Google tags:

<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}

  gtag('consent', 'default', {
    'ad_storage': 'denied',
    'analytics_storage': 'denied',
    'wait_for_update': 500
  });

  dataLayer.push({
    'event': 'default_consent'
  });
</script>

The code example above, sets the default status for ad_storage and analytics_storage to denied. Please note that there are other status that you can set in order to fine-tune the behavior.

Please note: Blocking Google tags until consent is granted in conjunction with using Consent Mode will have an impact on the functionality of Consent Mode.

Please note: When using our GTM consentmanager template, this additional code is not needed.

Enabling Google Consent Mode in consentmanager

In order to enable the Google Consent Mode, please go to Menu > CMPs > Edit > Other settings and enable Google Consent Mode. It is required to enable Consent Mode in the CMP settings AND perform the above described code adjustments.

GTM also offers the possibility to work with Consent Mode in order to protect tags from triggering. In order to use this feature you can use our GTM Template and or you can manually implement the CMP into the page or the tag manager.

Please note that the Consent Mode feature for GTM is ONLY a visual help and will not perform any actual blocking.

In order to enable the Consent Mode in GTM please follow these steps:

  1. Login to your account and click on Admin > Container Settings

  2. Check the box "Enable consent overview" and press Save

  3. Once enabled, you will find a shield icon under Tags which will show you which Consent Mode settings are applied to which tag:



  4. Update every tag for which you want to use Consent Mode (e.g. Google Analytics, Google Ads and so on), click on Advanced Settings > Consent Settings and set it to "Require additional consent for tag to fire". Add the Consent Mode names that are required for the tag, e.g. analytics_storage or ad_storage.

How to check if Consent Mode is working?

  1. Open your website with cleared cache or incognito mode. In your developer console open the dataLayer object and search for the very first "consent" event and analytics_storage should say "denied":

  2. In the cookie layer, accept the vendor Google Analytics (or accept all)
  3. Now search in the dataLayer for the updated "consent" event, analytics_storage should be "granted":

Once the Google Consent Mode is activated, the CMP will automatically send the consent information granted or denied to gtag/GTM. The CMP will automatically distinguish which Google Vendor is activated/deactivated and will send the correct info to Google. Currently the mapping is as follows:

Vendor ID Google Consent Type Description
s1, s1498 ad_storage Will enable/disable advertising cookies
s1498 (Google Advertising Products 755)
s1 (Google Ads)
s26 analytics_storage Will enable/disable analytics cookies.
s26 (Google Analytics)
every other vendor cmp_[vendorid] Will enable/disable the vendor (e.g. cmp_s123 for vendor 123)
every purpose cmp_purpose_[purposeid] Will enable/disable the purpose (e.g. cmp_purpose_5 for purpose 5)

Please note: The additional vendor/purpose support in GTM is currently very limited. We therefore do not recommend to use cmp_... and cmp_purpose_... but instead adjust your triggers.

More Information

More Information can be found here:

 

Back to top