All Collections
Google Consent Mode
Consent Mode v2 implementation - GTM Tag Template
Consent Mode v2 implementation - GTM Tag Template

This article will walk you through implementing Consent Mode v2 with Cookie Information using the Google Tag 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 for implementing it here.

  • There is a live demo of the Google Consent Mode v2 installation at the end of this guide.

This guide demonstrates how to implement Google CMv2 using our GTM tag template. CMv2 offers two modes: Basic and Advanced. Learn more about the differences between them here.

Please be aware that our tag template implementation will implement the Advanced Mode of CMv2.

If you would like to only implement the basic mode, please see our CMv2 Implementation guide.

Importing the Tag Template from the Gallery

To implement Consent Mode v2 through Google Tag Manager, search for our tag template named Cookie Information + Consent Mode v2 in the Community Template Gallery and add it to your container.

  1. Navigate to Google Tag Manager, open the Tags menu, and click New.

  2. Name the tag (e.g., Cookie Information + Consent Mode v2) and then click on the Tag Configuration panel.

  3. Click Discover more tag types in the community template gallery.

  4. Search for the Cookie Information + Consent Mode v2 tag template, select it and click Add to workspace. Confirm adding the community template.

Tag configuration

Add Cookie Information Consent Banner

In this step, you can either add a Cookie Information consent banner using the GTM template or directly to the website's source code.

Option 1: Add Cookie Information consent banner using the GTM template.

Select the Add Cookie Information Consent Banner option to directly manage the consent banner code deployment through the template. Please note: If you choose this option, the cookie banner snippet should not be implemented in the source code of your website.

Language version management

Selecting the Add Cookie Information Consent Banner option unlocks three different modes for managing language versions, including dynamic management of the consent banner's language versions.

  • None - The language drop-down menu located further below simply dictates the consent banner's language.

  • By GTM variable - The most versatile mode enables you to build more sophisticated mechanics using custom variables. The expected input for a language version is the language code you would normally use with the data-culture attribute. Please see this article to learn more.

  • Different language for specific domain - This mode allows you to dynamically manage the language versions of the consent banner based on specific domains. Please ensure to pass only canonical domains that match the domains defined in the Cookie Information platform. Also, please omit "https://", "http://", and "www" at all times.

It is crucial to select a language that has been configured within Cookie Information; otherwise, the banner will not be displayed.

If the language management options are not visible in your tag template, please ensure it is updated first.

Option 2: Add Cookie Information consent banner directly to the website's source code.

If you implement our pop-up script (uc.js) in your source code, you will need to add a new attribute to it: data-gcm-enabled="false". After adding this new attribute to the script, it should look as follows:

​<script id="CookieConsent" src="https://policy.app.cookieinformation.com/uc.js" data-culture="DA" type="text/javascript" data-gcm-enabled=”false”></script>

By adding this attribute, uc.js will disable its logic for Google Consent Mode, as this will be managed by the CI GCM tag template within GTM.

Please note that if you copy the full script from above, you should change the data-culture attribute to match your language preferences.

Default settings

Under Default settings, click Add Row. Ensure that all parameters are set to denied, then click Add in the top right-hand corner.

Redact Ads Data

When the Redact Ads Data checkbox is ticked, and ad_storage is set to denied, ad click identifiers sent in network requests by Google Ads and Floodlight tags will be redacted. Additionally, network requests will be sent through a cookieless domain as an extra privacy measure. For more information about this setting, please refer to the Google Consent Mode v2 documentation.

Pass through URL parameters

When a user lands on your website after clicking an ad, information about the ad may be appended to your landing page URLs as a query parameter. To enhance conversion accuracy, this information is typically stored in first-party cookies on your domain. However, when the Pass through URL parameters checkbox is ticked, and either ad_storage or analytics_storage is set to denied, information that would normally be stored in cookies will not be stored locally on your domain. To preserve the quality of ad click measurement and ensure analytics accuracy when cookies cannot be utilized, you can choose to transmit information about ad clicks and analytics events through URL parameters across pages. Certain conditions must be met for URL passthrough to function effectively. For comprehensive instructions on configuring URL passthrough, please refer to the Google Consent Mode v2 documentation.

Wait for update

In scenarios where your banner loads asynchronously, there's a chance it might not execute before your Google tags. To address this, you can use the 'Wait for update' setting with a specified millisecond value to control the delay before data transmission occurs. For more information, please refer to the Google Consent Mode v2 documentation.

Advanced Settings

Click on Advanced Settings and set the tag firing priority to 999 to ensure it is the first one to fire.

Trigger configuration

Next, click on the Triggering panel and select Consent Initialization - All Pages as the trigger type.

  1. Click Save and then click Preview to test your tag.

  2. When you're ready, click Submit.

If you previously used our CMv1 tag template, please remember to pause or delete it. The CMv2 tag template replaces the older version and should not be used simultaneously.

Validate the Google Consent Mode v2 setup

To ensure the setup is correct, please refer to this article.

Live demo video

Please view the live demo recording of the Google Consent Mode v2 setup using the Cookie Information tag template below:

Did this answer your question?