All Collections
Google Consent Mode
Consent Mode v2 implementation
Consent Mode v2 implementation

This article will walk you through implementing Consent Mode v2 with Cookie Information by changing the uc.js script and the template.

Katarina Hansen avatar
Written by Katarina Hansen
Updated over a week ago

Read more about Consent Mode v2 in general and see other options of implementing it here.

Important! It is important to note that to continue to use Google Advertisement products after March 2024, you have to have at least the basic mode implemented. The advanced mode is optional.

Basic vs Advanced Mode

There are two different modes available in this version: Basic and Advanced. Our solution can be used to implement either one and this guide gives you all the details on how to do so.

In the basic consent mode implementation, no information from users is collected at all, not even consent status. However, in the advanced consent mode implementation, Google tags are loaded before users are presented with the consent pop-up and Google collects cookieless data that lack personal identifiers.


Implementing Basic Mode

Enabling CMv2 through our uc.js script involves a few steps:

1. In the platform, you will need to change your pop-up template. The new templates are very similar to our Overlay v2/Overlay v3 templates and have Google's privacy policy in the main text.

To do so, you should navigate to your chosen consent solution -> "Pop Up Appearance" tab found on the left-hand side and then click on the dropdown menu under "Change Template".

You can choose between "Overlay v2 - Google Consent Mode v2" and "Overlay v3 - Google Consent Mode v2".

The default version of Overlay v2 looks like this without any customisation or styling:



The default version of Overlay v3 looks like this without any customisation or styling:

View our template showcase to see all of our template designs.

Important! Please be aware that changing your template will reset any customisations you have made including any text or styling changes. Please take a look at our style guide to find out how to customise your template.

If your pop-up banner is heavily customized:

You can add the following HTML link to the main text in the HTML section under the advanced settings. Adding the following code snippet enables CMv2 as well:


<a class="coi-banner__google-privacy-policy" aria-label="{{{translations.google_privacy_policy_link}}}" href="https://policies.google.com/privacy">{{{translations.google_privacy_policy_link}}}</a>



2. Update the implementation script in the source code of your website to include the HTML attribute called 'data-gcm-version' with the value set to “2.0". The script should be placed as high in the <head> tag as possible. This is to help to ensure that the script is loaded first and the cookies can be blocked before consent has been given.

It should look like the following:


<script id="CookieConsent" type="text/javascript" data-culture="EN" src="https://policy.app.cookieinformation.com/uc.js" data-gcm-version="2.0"></script>


Important! The 'data-culture= "EN"' attribute controls the language that the pop-up will appear in on the site: in this case, it will be displayed in the English language. To change the language, set the data-culture attribute to a different language code.

Implementing Advanced Mode

If you would like to utilise the advanced mode, please continue with the next step below:

3) Place the script with the default settings before the uc.js script.

The final advanced mode implementation should look as follows:

<script>

window.dataLayer = window.dataLayer || [];

function gtag(){ dataLayer.push(arguments); }

// Set default consent to 'denied' as a placeholder

// Determine actual values based on customer's own requirements

gtag('consent', 'default', {

'ad_storage': 'denied',

'ad_user_data': 'denied',

'ad_personalization': 'denied',

'analytics_storage': 'denied',

'wait_for_update': 500

});

gtag('set', 'ads_data_redaction', true);

</script>

<!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=TAG_ID"> </script>

<script id="CookieConsent" type="text/javascript" data-culture="EN" src="https://policy.app.cookieinformation.com/uc.js" data-gcm-version="2.0"></script>

Note: In the Google tag (gtag.js) script above, you should change the 'TAG_ID' to your own Google Tag ID.

It is possible to modify the default consent type values to "granted" or "denied" if you wish to establish a default opt-in status before the end user provides consent. This adjustment allows, for instance, implementing a default opt-in approach compliant with CCPA (California Consumer Privacy Act) requirements.

Did this answer your question?