Updated weekly with evidence Published scoring methodology No paid placements

implementation

Implement Google Consent Mode v2

Step-by-step guide to implementing Google Consent Mode v2 for GDPR compliance with Google Ads and Analytics.

At a glance

Difficulty

intermediate

Time estimate

30-90 minutes

Last updated

22/01/2024

Disclosure

This playbook may include affiliate links to supporting tools.

Summary

Google Consent Mode v2 is required for EU advertisers using Google Ads and Analytics starting March 2024. This playbook walks you through implementation with your existing CMP.

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': ['EU', 'EEA', 'GB']
});

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

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.