Google Consent Mode v2 | Blue Frog Docs

Google Consent Mode v2

Understanding and implementing Google Consent Mode v2 for privacy-compliant analytics and advertising.

Google Consent Mode v2

What This Means

Google Consent Mode v2 is Google's updated framework for adapting Google tag behavior based on user consent choices. Starting March 2024, it's required for using Google Ads remarketing and audience features in the EEA/UK.

Key Changes in v2:

  • Two new parameters: ad_user_data and ad_personalization
  • Required for EEA/UK remarketing and similar audiences
  • Impacts data collection and modeling capabilities

Impact Assessment

Business Impact

  • Critical for EU/UK Markets: Required for remarketing and audience building
  • Data Gaps: Non-consented users create measurement gaps
  • Modeling Dependency: Behavioral modeling fills gaps but requires sufficient data

Technical Impact

How to Diagnose

Check Current Implementation

Browser Console Test:

// Check consent state
console.log('Consent state:',
  window.dataLayer?.filter(e => e[0] === 'consent')
);

GTM Preview Mode:

  1. Open GTM Preview
  2. Look for Consent Initialization trigger
  3. Verify consent parameters are set

Required Parameters

Parameter Purpose Values
ad_storage Advertising cookies granted/denied
analytics_storage Analytics cookies granted/denied
ad_user_data NEW User data for ads granted/denied
ad_personalization NEW Personalized ads granted/denied

Validation Checklist

  • Default consent set before Google tags load
  • All four parameters included
  • CMP correctly updates consent state
  • Consent persists across pages
  • Server-side GTM handles consent (if applicable)

General Fixes

// Set default consent BEFORE gtag loads
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',
  'wait_for_update': 500  // Wait for CMP
});
// When user grants consent
gtag('consent', 'update', {
  'ad_storage': 'granted',
  'ad_user_data': 'granted',
  'ad_personalization': 'granted',
  'analytics_storage': 'granted'
});

3. GTM Implementation

Consent Initialization Tag:

// In GTM custom HTML tag (Consent Initialization trigger)
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}

  // Default: denied for EEA users
  var isEEA = {{DLV - User Region}} === 'EEA';

  gtag('consent', 'default', {
    'ad_storage': isEEA ? 'denied' : 'granted',
    'ad_user_data': isEEA ? 'denied' : 'granted',
    'ad_personalization': isEEA ? 'denied' : 'granted',
    'analytics_storage': isEEA ? 'denied' : 'granted',
    'region': ['EEA']  // Apply to EEA only
  });
</script>

4. CMP Integration Example

OneTrust Example:

// OneTrust callback to update consent
window.OneTrust?.OnConsentChanged(() => {
  const groups = window.OnetrustActiveGroups || '';

  gtag('consent', 'update', {
    'ad_storage': groups.includes('C0004') ? 'granted' : 'denied',
    'ad_user_data': groups.includes('C0004') ? 'granted' : 'denied',
    'ad_personalization': groups.includes('C0004') ? 'granted' : 'denied',
    'analytics_storage': groups.includes('C0002') ? 'granted' : 'denied'
  });
});

Cookiebot Example:

// Cookiebot callback
window.addEventListener('CookiebotOnAccept', function() {
  gtag('consent', 'update', {
    'ad_storage': Cookiebot.consent.marketing ? 'granted' : 'denied',
    'ad_user_data': Cookiebot.consent.marketing ? 'granted' : 'denied',
    'ad_personalization': Cookiebot.consent.marketing ? 'granted' : 'denied',
    'analytics_storage': Cookiebot.consent.statistics ? 'granted' : 'denied'
  });
});

5. Enable Behavioral Modeling

To compensate for consent gaps:

  1. Go to Google Analytics 4 > Admin > Data Settings
  2. Enable Consent Mode modeling
  3. Ensure sufficient traffic (1000+ events/day) for modeling

Advanced Mode vs Basic Mode

  • Tags load with consent denied
  • Cookieless pings sent
  • Enables behavioral modeling
  • Better data completeness

Basic Mode

  • Tags blocked until consent
  • No cookieless pings
  • Less data for modeling
  • Simpler implementation

Platform-Specific Guides

Platform Guide
Shopify Shopify Consent Mode
WordPress WordPress Consent Mode
Wix Wix Consent Mode

Testing Your Implementation

Google Tag Assistant

  1. Install Google Tag Assistant
  2. Record a session
  3. Verify consent events fire correctly
  4. Check parameter values match user choice

Chrome DevTools

// Monitor consent updates
const observer = new MutationObserver(() => {
  const consentEvents = dataLayer.filter(e => e[0] === 'consent');
  console.table(consentEvents);
});

Real-Time Reports

  1. Open GA4 Real-Time report
  2. Trigger consent changes
  3. Verify events appear correctly
  4. Check modeling indicators

Common Issues

  • Check cookie domain settings
  • Verify CMP localStorage usage
  • Test cross-subdomain scenarios
  • Verify tag sequencing in GTM
  • Check for hardcoded gtag.js
  • Review third-party integrations

Modeling Not Working

  • Confirm Advanced Mode is active
  • Verify sufficient traffic volume
  • Allow 30+ days for modeling data

Compliance Timeline

Date Requirement
March 2024 Required for EEA remarketing
Ongoing Required for new Google Ads features

Further Reading

// SYS.FOOTER