Skip to Navigation Skip to Content

In this guide, we’ll show you how to setup Google Consent Mode v2 (advanced consent mode) using a Consent Management Platform (CMP) and Google Tag Manager. We’ll be using GetTerms as our CMP of choice, but all of the settings and features mentioned should be available if you’re using a CMP that supports Advanced Consent Mode.

What you’ll need

Try Google Consent Mode with GetTerms

Try our CMP

How consent mode works

Google Consent Mode works by communicating a user’s consent states to Google tags and tools, so they can adjust their behavior in accordance to the users consent preferences and in compliance with privacy laws like the GDPR.

What is Google Consent Mode?

Part 1: Install Google Tag Manager on your website

This guides uses Google Tag Manager to configure Google Consent Mode correctly. If you’ve installed your Google Tag directly into your site’s <head>, we strongly recommend removing it and installing it with Google Tag Manager to ensure it doesn’t fire before consent settings are updated.

If you haven’t installed Google Tag Manager yet, follow this guide first.

Part 2: Enable Google Consent Mode in your CMP

  1. Log into GetTerms (or your chosen CMP).
  2. Open your chosen Policy Pack with a CMP enabled.
  3. Select ‘Configuration’ under the Cookie Banner section of the sidebar menu.
  4. Toggle “Enable Google Consent Mode” to On.

 

Part 3: Embed your Consent Banner on your website correctly.

  1. Go to the Installation tab of your consent banner and make sure the embed code includes the consent mode initialisation code.
  2. Ensure that your consent banner script is embedded on your website correctly. It should be the first <script> in the head section of your website.

Part 4: Setup Advanced Consent Mode in Google Tag Manager

Add the GetTerms Consent Management Tag Template to your workspace

  1. In your GTM workspace, go to the Templates tab.

  2. Under Tag Templates, click Search Gallery.

  3. Search for “GetTerms” or your CMP’s tag template.

  4. Select GetTerms Consent Management.

  5. Click Add to workspace.

  6. Review the required permissions, then click Add.

Add the Consent Management Template to a new tag

  1. Open the Tags tab in GTM and click New.

  2. Click anywhere in the Tag Configuration box to open the ‘Choose tag type’ menu.

  3. Select the GetTerms Consent Management tag template (or your chosen CMP’s tag template).

  4. Leave the default consent preferences as denied.

  5. Scroll down and click within the Triggering box.

  6. Select Consent Initialization – All Pages.

Part 5: Configure your tags for Consent Mode in GTM

Enable Consent Overview

While not explicitly required, enabling the consent overview panel helps you identify and edit which tags have or haven’t been configured for consent. You may find it useful if you have several tags to configure as it enables you to set tag consent settings in bulk.

  1. Open your container settings from the Admin tab.

  2. Enable Consent Overview.

  3. Once enabled, the consent overview panel can be opened from the tag tab of your work space.

  4. If you’ve never setup your tags for consent, the consent overview window should inform you that none of your tags are configured for consent.

Configure Your Google Tag for Advanced Consent Mode

If Advanced Consent Mode is implemented, tags will fire without waiting for user consent but block data collection if the current consent status is denied. For this reason, you should only use advanced consent mode with tags that have built-in consent checks such as your Google Tag.

You can see in the above image that our HotJar tag does not contain built in consent checks.

  1. From the consent overview window or your tag tab, select your Google Tag.
  2. Click anywhere within the tag configuration box to expand it.
  3. Scroll down to ‘advanced settings‘ and expand the accordion.
  4. Find the section for Consent settings and expand it.
  5. Select the radial button labeled ‘No additional consent required‘.

Set your Google Tag to fire on ‘Initialization – All Pages’

  1. Click anywhere within the triggering box to open the triggering settings for your Google Tag.
  2. Select Initialization – All Pages as your primary trigger.

    Note: Do not use ‘Consent initialization – All Pages’ as this may result in your Google Tag firing before the the current consent state is updated by your CMP. If this happens, the current consent state may still be set to the default state – denied – and your Google Tags built in consent checks will block data from being collected.

Add a second trigger that fires when a user updates their consent preferences

  1. Click the + button to add another trigger.

  2. Choose Custom Event as the trigger type.

  3. Enter consentUpdate as the event name. This is an event sent by our consent banner that contains the users updated consent preferences. It fires on every page load or when a user updates their consent preferences.

Configure firing behavior of your tag

  1. Click anywhere within the tag configuration box to expand it’s settings.
  2. Under advanced settings, set the ‘Tag firing options‘ to ‘Once per page‘. This prevents the tag from firing multiple times if a user updates their consent preferences later in the session.
  3. Save the tag configuration.

How to configure Basic Consent Mode for non-Google tags

In a Basic Consent Mode setup, tags are configured to require additional consent checks before they can fire. This is perfect for non-Google any non-Google tracking codes, e.g. your HotJar or Klaviyo tacking codes.

  1. From the consent overview window, select the tag you wish to configure for Basic Consent Mode.
  2. Click anywhere within the tag configuration box to expand it.
  3. Scroll down to ‘advanced settings‘ and expand the accordion.
  4. Find the section for Consent settings and expand it.
  5. Select the radial button labeled ‘Require additional consent for tag to fire’.

For these tags, you can use the same triggering and tag firing settings used by your Google Tag.

Part 6: Publish your GTM container.

Publish your GTM container by clicking ‘submit’ in the top right of the window, your GTM is configured and consent mode should be active!

Part 7: Verify Consent Mode is installed correctly

Use GTM debug view to check consent state is being updated by your CMP

  1. Open Preview / Debug mode in GTM using the ‘Preview’ button in the top right of your workspace.

  2. Input your websites URL in the tag assistant popup.
  3. Two tabs should load, one containing your tag assistant, the other containing your website.
  4. Wait for your website to load.
  5. If your consent banner, do not interact with it yet – continue to step 10.
  6. If your consent banner doesn’t load, you may have already have saved cookie preferences on your site. You’ll need to delete them.
  7. Open your browsers developer tools and open the application tab.
  8. Under local storage for your domain, select and delete the ‘getterms_cookie_consent‘ line item to remove your current preferences.
  9. Refresh your page and wait for your consent banner to load.
  10. Open the browser tab that contains your tag assistant window.
  11. Select the most recent initialization event in the summary side panel.
  12. You should see that your Google tag was fired, but any tags setup for basic consent were blocked as they required additional consent.
  13. Navigate to the Consent tab in the box labelled Output of GTM-########.

  14. Confirm that consent values match the settings from your consent banner. If you haven’t accepted cookies, all except Security storage should show Denied.

  15. Open the tab containing the preview of your website.
  16. Accept all cookies using your Consent Banner.
  17. Open your tag assistant tab and select the new initializaton event.
  18. Navigate to the Consent tab in the box labelled Output of GTM-########.
  19. The default state should still say denied for all storage types, but the on-page update and current state should display all storage types set to ‘Granted’.
    If you reject all cookies, the consent tab should show all cookies except security storage as ‘Denied’.

Troubleshooting

Consent showing denied for all storage types?

If you have consented to all cookies, but the event your Google Tag fires on displays all types of cookies as ‘denied’, you may be firing our cookie banner or the GetTerms Consent Management tag after your Google Tag. This means we are not able to update the current state of consent state before your Google Tag fires.

If all consent types display as Denied despite full user consent:

  • Check the firing order of your tags.

  • Ensure the Consent Management tag or banner fires on Consent Initialization.

  • Ensure your Google Tag fires on Initialization – All Pages.

  • Confirm your CMP installation includes Google Consent Mode initialization code. It should look something like this:

    <!– 1. Initialise Google Consent Mode –>
    <script>
    window.dataLayer = window.dataLayer || [];
    function gtag() { dataLayer.push(arguments); }
    // Set all consent categories to “denied” by default.
    gtag(“consent”, “default”, {
    “ad_storage”: “denied”,
    “ad_user_data”: “denied”,
    “ad_personalization”: “denied”,
    “analytics_storage”: “denied”,
    “functionality_storage”: “denied”,
    “personalization_storage”: “denied”,
    “security_storage”: “denied”,
    });
    </script>