Development4 min read

Google Tag Manager Consent Mode v2: What WordPress Sites Need to Know

Google's Consent Mode v2 became mandatory for EEA users in March 2024. Here's what it means for your WordPress + GTM setup and how to implement it correctly.

JO

James Okafor

Frontend Engineer · 22 January 2026

What Is Consent Mode v2?

Google Consent Mode v2 is Google's framework for adjusting the behaviour of Google tags (GA4, Google Ads, Floodlight) based on the consent status of a user. It was introduced in 2020 and updated to v2 in November 2023.

From March 2024, Google requires all EEA-based advertisers using Google Ads and Google Analytics to implement Consent Mode v2 if they want to:

  • Use audience features in Google Analytics
  • Measure conversions in Google Ads
  • Remarketing and personalised advertising

Without Consent Mode v2, Google will restrict data collection for non-consenting users in ways that degrade campaign measurement.

The Two New Parameters in v2

Consent Mode v2 adds two new consent parameters to the original four:

ParameterWhat It Controls
ad_storageCookies for advertising (existing)
analytics_storageCookies for analytics (existing)
ad_user_dataNEW — Sending user data to Google for advertising
ad_personalizationNEW — Personalised advertising (remarketing)

All four must be set for full Consent Mode v2 compliance.

Basic vs Advanced Consent Mode

There are two implementation modes:

Basic Consent Mode: Google tags only fire after consent is granted. No data is collected for non-consenting users. Simpler to implement.

Advanced Consent Mode: Google tags fire immediately but behave differently based on consent. For non-consenting users, tags use cookieless pings and modelled data to partially fill measurement gaps. More complex, better data quality.

Advanced mode requires careful implementation to ensure non-essential tracking genuinely doesn't occur without consent.

Implementing Consent Mode v2 in WordPress

Step 1: Initialise Consent Mode Before GTM

The consent state must be set before GTM loads. Add this to your <head>, before the GTM snippet:

<script>
  // Initialise dataLayer and gtag function
  window.dataLayer = window.dataLayer || [];
  function gtag() { dataLayer.push(arguments); }

  // Set default consent state (deny all — wait for user choice)
  gtag('consent', 'default', {
    'ad_storage': 'denied',
    'analytics_storage': 'denied',
    'ad_user_data': 'denied',
    'ad_personalization': 'denied',
    'wait_for_update': 500 // Wait 500ms for consent platform to update
  });
</script>

<!-- Google Tag Manager -->
<script>/* GTM snippet here */</script>

Step 2: Update Consent on User Choice

When a user grants or denies consent, update the consent state:

// Called when user accepts analytics cookies
function grantAnalyticsConsent() {
  gtag('consent', 'update', {
    'analytics_storage': 'granted'
  });
}

// Called when user accepts all cookies
function grantAllConsent() {
  gtag('consent', 'update', {
    'ad_storage': 'granted',
    'analytics_storage': 'granted',
    'ad_user_data': 'granted',
    'ad_personalization': 'granted'
  });
}

// Called when user declines all non-essential cookies
function denyAllConsent() {
  gtag('consent', 'update', {
    'ad_storage': 'denied',
    'analytics_storage': 'denied',
    'ad_user_data': 'denied',
    'ad_personalization': 'denied'
  });
}

Step 3: Persist and Restore Consent on Return Visits

Consent must be remembered. Store the consent state and restore it on subsequent page loads:

function restoreConsentFromStorage() {
  const stored = localStorage.getItem('consent_state');
  if (!stored) return;

  const state = JSON.parse(stored);
  gtag('consent', 'update', state);
}

// Call on page load before GTM fires
restoreConsentFromStorage();

GTM Configuration

In your GTM container, you'll need to configure consent settings on each tag:

  1. In GTM, go to Tags → [Your Tag] → Advanced Settings → Consent Settings
  2. Add the required consent types for that tag (e.g., analytics_storage for GA4)
  3. GTM will automatically suppress the tag if consent isn't granted

Built-in Variables

GTM v2 has built-in consent state variables. You can use these in triggers and variables:

  • Consent State - ad_storage
  • Consent State - analytics_storage
  • Consent State - ad_user_data
  • Consent State - ad_personalization

DPOKit + GTM Integration

DPOKit's GTM integration handles all of the above automatically:

  1. Injects the gtag('consent', 'default', {...}) call before GTM loads
  2. Updates consent state when users interact with the consent banner
  3. Persists consent state across sessions
  4. Maps DPOKit's consent categories to GTM consent parameters
  5. Supports both basic and advanced Consent Mode
// WordPress filter to customise GTM consent mapping
add_filter('dpokit_gtm_consent_map', function($map) {
    $map['analytics'] = ['analytics_storage'];
    $map['marketing'] = ['ad_storage', 'ad_user_data', 'ad_personalization'];
    return $map;
});

Testing Your Implementation

Use the Google Tag Assistant Chrome extension to verify:

  1. Consent Mode is initialised before GTM loads
  2. All four parameters are present in the default state
  3. Consent updates fire correctly when user interacts with your banner
  4. Tags are firing/suppressed correctly based on consent

Also check the GTM Preview mode — tags with required consent will show a "Consent check failed" status when consent is denied.

Conclusion

Consent Mode v2 is not optional for EEA advertisers using Google products. Implementing it correctly protects both your legal compliance posture and your measurement quality. The DPOKit integration makes this straightforward for WordPress sites without requiring manual gtag() calls.

JO

James Okafor

Frontend Engineer

Google Tag ManagerConsent ModeAnalyticsGTM