Skip to content

Template · CONSENT MODE V2 SNIPPET

Consent Mode v2 init snippet · multi-region (EU + US)

Default-deny init. Paste as the FIRST script in <head>, before any Google tag (GTM, gtag.js, AdSense) loads. Your CMP must call gtag('consent', 'update', …) on user choice.

Scope law GDPR Last reviewed
Editorial research — not legal advice
Page lifecycle — universal across regions 1 Page load <head> begins parsing BEFORE GTM/gtag.js 2 Defaults set gtag('consent','default') denied for EU · granted for US 3 CMP banner shown consent banner renders user sees Accept / Reject 4 User decision Accept · Reject · Customise 5 CMP update fires gtag('consent','update') within wait_for_update ms 6 Tags fire GA4 / Ads / floodlights read final consent state Default-deny block must run BEFORE the Google tag If a tag fires before defaults are set, it inherits "granted" implicit consent. wait_for_update typically 500 ms Tags hold for the CMP to call update; longer windows = lost data, shorter = race risk.
Signal Default · EU/EEA/UK/CH Default · US After Accept After Reject What it controls
ad_storage denied granted granted denied Cookies for advertising (DoubleClick, etc.)
ad_user_data denied granted granted denied Send user data to Google for ad measurement
ad_personalization denied granted granted denied Personalised advertising (remarketing audiences)
analytics_storage denied granted granted denied Analytics cookies (GA4 _ga, _ga_<container>)
functionality_storage denied granted granted denied Functional cookies (UI state, language)
personalization_storage denied granted granted denied UI personalisation (recommendations, themes)
security_storage always always always always Strictly necessary (CSRF, auth, fraud detection)

granted denied Hover any cell or signal name for details. Editorial reading; not legal advice.

Consent Mode v2 — 7 consent signals across page lifecycle. EU/EEA/UK/CH visitors get default-deny; US visitors get default-granted (no state-level opt-in baseline). Editorial reading; not legal advice.

Template body

<!-- Multi-region Consent Mode v2 — different defaults per region -->
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag() { dataLayer.push(arguments); }

  // Strict default-deny for EU/EEA/UK/CH
  gtag('consent', 'default', {
    'ad_storage':           'denied',
    'ad_user_data':         'denied',
    'ad_personalization':   'denied',
    'analytics_storage':    'denied',
    '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','GB','NO','IS','LI','CH']
  });

  // California / Virginia / Texas / Colorado / Connecticut — granted with opt-out
  gtag('consent', 'default', {
    'ad_storage':           'granted',
    'ad_user_data':         'granted',
    'ad_personalization':   'granted',
    'analytics_storage':    'granted',
    'region': ['US-CA','US-VA','US-TX','US-CO','US-CT']
  });

  // Rest of US — granted (no state-level consent baseline yet)
  gtag('consent', 'default', {
    'ad_storage':         'granted',
    'ad_user_data':       'granted',
    'ad_personalization': 'granted',
    'analytics_storage':  'granted'
  });
</script>

<!-- Then your CMP/preference center handles the GPC + IAB GPP signals on the US side and updates per-user -->
How to use this template · Methodology

Adapt, then deploy. Editorial reading as of 2026-05-05; not legal advice. This template is a starting point — drafted against the named statute and the relevant regulator's published guidance, not your specific facts.

Substitute every placeholder. Tokens like {{controller_name}} must be replaced with your concrete values. Leaving placeholders unsubstituted is a recurring failure mode in published compliance documents; reviewers and regulators tend to read partially-completed disclosures as a documentation problem in itself.

Verify the assumptions. The "Assumes" block above lists the prerequisites we drafted against. If your facts differ — different processor list, different audience, different sub-processors — adapt the template, don't deploy it as-is.

Counsel review before going live. Templates are scaffolding, not finished artefacts. Route the final pass through counsel admitted in the jurisdiction where you operate.

Editorial research, not legal advice. SetupAnalytics is a free, ad-free public utility maintained by independent editors. This template does not establish a lawyer-client relationship and is not warranted for accuracy or currency. Consult qualified counsel admitted in the relevant jurisdiction for any specific deployment. Report an inaccuracy →