Skip to main content
All CollectionsGoogle consent mode v2
Set up Google consent mode v2 using Google Tag Manager tag template
Set up Google consent mode v2 using Google Tag Manager tag template

Learn to set up Google consent mode v2 with Cookie Information using Google Tag Manager or code.

Updated over a month ago

In this article, we'll show you two ways to set up Google Consent Mode v2 with Cookie Information: using the Google Tag Manager (GTM) tag template or by adding the main installation code to your website's source code. You can choose either method.

You can also watch our video tutorial on YouTube.

Before you start

Here are a few things to know before you start:

  • Google consent mode v2 comes in two modes: basic and advanced. You can set up both in Cookie Information. The basic consent mode doesn’t allow you to collect any user data, not even consent status, until the user agrees. In the advanced consent mode, Google tags are loaded before the consent popup displays to users. Google collects cookieless data without personal identifiers.


    This guide shows how to implement Google consent mode v2 using the advanced mode. If you would like to implement the basic mode, see this article.

  • To configure a tag, you’ll need to add a Cookie Information consent banner, using the GTM tag template or by adding the banner directly to the website's source code.

  • The data-culture = "EN" attribute controls the language that the popup will appear in on the site – in this example, it will be displayed in the English language. To change the language, set the data-culture attribute to a different language code. For more details, see this article.

  • If the language options are not visible in your tag template, check if the template is up to date.

  • If you previously used our Google consent mode v1 consent banner template, pause or delete it. The Google consent mode v2 template replaces the older version and shouldn’t be used simultaneously.

  • Steps 17-21 of the instructions to set up Google consent mode v2 are optional. They’re dedicated to our customers who were updating their Google consent mode into version 2 and haven't updated their consent banner. New customers that use Google consent mode v2 from the beginning will have the new consent templates set up by default.

  • Here's the list of Google consent types and categories:

Consent type

Description

Consent category

ad_storage

Allows storage (such as cookies) related to advertising

Marketing

analytics_storage

Allows storage (such as cookies) related to analytics e.g. visit duration

Statistical

functionality_storage

Allows storage that supports the functionality of the website or app e.g. language settings

Functional

personalization_storage

Allows storage related to personalization e.g. video recommendations

Functional

security_storage

Allows storage related to security such as authentication functionality, fraud prevention, and other user protection

Necessary

ad_user_data

Sets consent for sending user data related to advertising to Google

Marketing

ad_personalization

Sets consent for personalized advertising

Marketing

Implement Google consent mode v2 using Google Tag Manager tag template

To implement Google consent mode v2 through Google Tag Manager, follow these steps:


1. Log in to your Google Tag Manager account.


2. Go to Menu > Tags and click New.

ad a new tag

3. Name the tag, e.g. Cookie Information + Consent Mode v2.


4. Click on the Tag Configuration panel.

Name a tag in tag manager

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

browse tag templates

6. Type in the name of the Cookie Information + Consent Mode v2 tag template in the search box.

search for Cookie Information tag template

Note: Make sure you used our updated tag template, not the old one:

Cookie Information tag template

7. Once you’ve selected Cookie Information + Consent Mode v2 template, click Add to workspace. Confirm adding the template.

add a tag template to your workspace

Note: There’s an alternative way to add the banner directly to the website's source code. To use this method, see the instructions here.

8. In Tag Configuration, select Add Cookie Information Consent Banner.

add Cookie Information Consent Banner

9. In Language options, choose a method for managing language versions:

  • None (Default language value will be used): This option is for websites that only need the popup in one language. For these settings, the Default Language menu below determines the language of the consent banner. This setting is for websites that only need the popup in one language.

    set up language options in tag templates

Note: You must select a language that was set up within the Cookie Information platform, otherwise you can’t display the banner.

  • By GTM variable: This method allows you to build more sophisticated mechanics using custom variables. The expected input for a language version is the same language code used with the data-culture attribute. For more details, see this article.

  • Different languages for specific domains: You can add different languages for specific domains. Provide the canonical domain without 'https://', 'http://', or 'www', for example, my-domain.com. Ensure the canonical domain matches those defined in the Cookie Information platform.

set up different language for specific domain

10. In Default consent settings, click Add Row. All parameters must be set to denied.

Default consent settings

11. Click Add.

set up consent parameters to denied]


12. In Advanced Settings, set the tag firing priority to 999 to ensure it is the first one to fire.

set the tag firing priority

13. Click on the Triggering panel and choose the trigger Consent Initialization - All Pages.


14. Click Save.

save tag configuartion

15. Click Publish to publish your container.

publish your conmtainter in tag manager

16. See the Version Summary of the changes to your container.

see Version Summary of the changes to your container

17. All set!

The following steps are optional and are specifically for customers who upgraded to Google consent mode version 2 but haven’t updated their consent banner. New customers using Google consent mode v2 from the start will have the new consent templates set up by default.

18. (Optional) Log into Cookie Information.


19. (Optional) Go to Consent solutions.


20. (Optional) Find the consent solution you want to set up the consent template for.

find you consent solution in Cookie Information

21. (Optional) Navigate to Pop-up appearance and click the Template drop-down list under Change template.

change consent template in Cookie Information

22. (Optional) Choose Overlay v2 - Google consent mode v2 and Overlay v3 - Google consent mode v2.

Choose Overlays for Google consent mode v2 in Cookie Information

The default versions of overlay v2 and v3 without any customization, look like this:

see the default versions of consent overlays in Cookie Information

View our template showcase to see all template designs.

Note: Changing your template will reset any customizations including text or styling, you have made earlier.

23. You can customize your template if you want. For more details see this guide.


24. Done!

Check if your Google consent mode v2 is set up correctly

To see if your Google consent mode v2 implementation using Google tag template works correctly, follow these steps:


1. Log in to your Google Tag Manager account.


2. Navigate to Preview.

turn on tag manager preview mode

3. Enter your website’s URL and click Connect to turn on the preview mode.

connect tag assistant to your site

4. After a successful connection, Tag Manager will display a dedicated popup

and your website will open in a new window.

tag assistant connected to your site popup

5. Go to your website.


6. In the browser, click View site information, and choose Cookies and site data.

Note: You need to remove cookies but only for the website you’re verifying the Google consent mode v2 implementation for. Otherwise you could be logged out of websites that keep you signed in, and the preferences you've saved might be lost. This happens every time a cookie is deleted.


7. Clear website cookies and cache, click Done.

clear cookies and cache in your website

8. Without interacting with the cookie consent popup, go to GTM Tag Assistant.


9. Navigate to Consent events > Consent Default. Under Consent, all the consent statuses should be set to denied.

consent statuses set to denied

10. Go back to your website and click Accept all cookies.


11. Navigate to the GTM Tag Assistant page.


​12. Click the Consent Update in the left-hand side panel. The consent statuses under On-page update should be set to granted.

consent statuses set to granted

13. Done.


Add Cookie Information consent banner to the website's source code

This method is suitable if you use Tag Manager and want to add the Cookie Information consent banner to your website's source code.

To add the Cookie Information consent banner, follow these steps:


1. Add Cookie Information main installation code (uc.js) into the <head> tag of your website's source code.


2. Add to the code a new attribute: data-gcm-enabled="false". Your script should appear as follows:

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

Note: If you copy the full script from above, you should change the data-culture attribute to match your language preferences. For more details, see this article.

Troubleshooting

  • What can I do when the banner loads asynchronously and it might not execute before your Google tags?

    You can use the 'Wait for update' setting with a specified millisecond value to control the delay before data transmission occurs. We recommend setting this up for 15,000. For more details, see Google consent mode v2 documentation.

Set up wait for update in tag configuration
  • If you haven’t updated your Google consent mode into consent mode v2 and your popup banner is heavily customized, you can add the following HTML code to the main text of your banner:


    1. Go to Consent solutions.

    2. Find the consent solution you want to set up the consent template for.

    3. In Pop-up appearance, go to the HTML section under Advanced options.

    4. Add this HTML code to the main text of your banner:

    ​<a class="coi-banner__google-privacy-policy" aria-label="{{{translations.google_privacy_policy_link}}}" href="https://business.safety.google/privacy/" target="_blank">{{{translations.google_privacy_policy_link}}}</a>

add privcay policy link to consent banner in Cookie Information

Additional information

Here is some additional information to keep in mind about implementing Google consent mode v2 implementation.

Redact ads data

When you select Redact Ads Data in Tag Configuration 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, see the Google documentation.

set up redact ads data


Pass through URL parameters

When someone clicks on an ad and comes to your website, details about the ad might be added to your website's URL as a query parameter. This information helps track how well the ad is performing and is usually saved in first-party cookies on your domain.


However, when the Pass through URL parameters option in Tag Configuration is selected, and either ad_storage or analytics_storage is set to denied, this information won’t be stored locally on your domain. Instead, you can choose to transmit information about ad clicks and analytics events through URL parameters across pages, provided certain conditions are met. For more information, see the Google consent mode v2 documentation.

Related articles

Did this answer your question?