Updated weekly with evidence Published scoring methodology No paid placements

implementation

Consent Mode v2 Setup in GTM: Step-by-Step Guide

Set up Consent Mode v2 in Google Tag Manager in 30 to 90 minutes: consent defaults, update calls, CMP mapping for Cookiebot or Usercentrics, and checks.

At a glance

Difficulty

intermediate

Time estimate

30-90 minutes

Last updated

28/09/2026

Disclosure

This playbook may include affiliate links to supporting tools.

Summary

Since March 2024, Google has required Consent Mode v2 signals for EEA traffic when you use Google Ads measurement, remarketing or ad personalisation, including GA4 data linked to Google Ads. This playbook walks you through implementation with your existing CMP. For how the consent signals and basic vs advanced modes work, read the Google Consent Mode v2 guide first.

Prerequisites Checklist

  • Google tag (gtag.js) or GTM installed
  • CMP displaying consent banner
  • Access to edit website code or GTM
  • Test environment available

Decision Tree

Do you use Google Tag Manager?
├── YES → Use GTM Consent Mode template
│   └── Does your CMP have GTM integration?
│       ├── YES → Use CMP's GTM template
│       └── NO → Use manual dataLayer implementation
└── NO → Implement directly in gtag.js
    └── Does your CMP support Consent Mode?
        ├── YES → Enable in CMP settings
        └── NO → Implement custom JavaScript bridge

Implementation Steps

Add this code before any Google tags load:

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

gtag('consent', 'default', {
  'ad_storage': 'denied',
  'ad_user_data': 'denied',
  'ad_personalization': 'denied',
  'analytics_storage': 'denied',
  'functionality_storage': 'denied',
  'personalization_storage': 'denied',
  'security_storage': 'granted',
  'wait_for_update': 500,
  'region': [
    'AT', 'BE', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR',
    'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL',
    'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'IS', 'LI', 'NO',
    'GB', 'CH'
  ]
});

The region key takes ISO 3166-2 country codes, so values such as ‘EU’ or ‘EEA’ are not valid. This list covers the EEA countries plus the UK and Switzerland. Remove the key if you want the denied default to apply to every visitor.

Time estimate: 5-10 minutes

When user grants consent, update the state:

gtag('consent', 'update', {
  'ad_storage': 'granted',
  'ad_user_data': 'granted',
  'ad_personalization': 'granted',
  'analytics_storage': 'granted'
});

Time estimate: 10-20 minutes

Step 3: Connect Your CMP

For Cookiebot:

  1. Go to Cookiebot dashboard → Settings → Google Consent Mode
  2. Enable “Google Consent Mode v2”
  3. Map consent categories to Google consent types
  4. Save and republish

For Usercentrics:

  1. Go to Admin Interface → Implementation
  2. Enable “Google Consent Mode”
  3. Configure consent type mappings
  4. Deploy updated script

In Google Tag Manager:

  1. Go to Admin → Container Settings and tick “Enable consent overview”
  2. Add your CMP’s template from the Community Template Gallery (Cookiebot and Usercentrics both publish one), set all four consent types to denied as the default, and fire it on the Consent Initialization - All Pages trigger
  3. Open Tags → Consent Overview and confirm each Google tag shows its built-in consent checks; add consent requirements to non-Google tags
  4. In Preview mode, select the first event, open the Consent tab and confirm the On-page Default shows denied, then check the On-page Update after you click accept or reject

Time estimate: 10-15 minutes

Step 4: Enable Advanced Features (Optional)

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

Time estimate: 5 minutes

Step 5: Verify Implementation

  1. Open Chrome DevTools → Console
  2. Type: dataLayer.filter(e => e[0] === 'consent')
  3. Verify default and update events appear
  4. Use Google Tag Assistant to validate

Time estimate: 10-15 minutes

Failure Modes

Symptom: No consent events in dataLayer

Cause: Script loading order issue

Fix: Ensure consent default is set before gtag loads. Use async loading for gtag but sync for consent default.

Symptom: Default state never changes to granted

Cause: CMP callback not connected

Fix: Check CMP documentation for consent callback. Verify event listener is properly configured.

Region detection not working

Symptom: All users see consent banner (or none do)

Cause: Geo-detection misconfigured

Fix: Verify CMP geo-detection settings. Consider using server-side detection for accuracy.

Downloadable Resources

Sources


Disclosure: We may earn a commission if you sign up for recommended tools through our links. This never affects our recommendations or methodology.