artifact #A-002 · snippet · current
Consent Mode v2 default snippet
The default-denied block with all four signals (ad_storage, ad_user_data, ad_personalization, analytics_storage), placed before the Google tag, plus the update call your CMP should make.
- verified_on
- 2026-09-09
- checked against
- Google — Manage consent settings (consent mode)Google Ads announcements — Jan 18, 2024GA4 What's new archive — Jan 13, 2025 (consent settings hub)
- next re-check
- 2026-12-01
- status
- current
- time
- 15 minutes
- skill
- you can edit your site's head or a GTM tag
What's inside
- gtag('consent','default', …) with the two v2 signals the EEA/UK ads features have required since March 2024
- wait_for_update so the CMP's answer is honoured
- A region-scoped variant for default-deny only where the law requires
- onConsentChoice(): the update call mapping CMP categories to the four signals
Install
- Paste the first script block above the Google tag or GTM snippet on every page (in GTM: a Custom HTML tag on the Consent Initialization – All Pages trigger).
- Wire your CMP's callback to onConsentChoice, or use the CMP's own consent-mode template.
- Verify in Google Analytics Admin › Consent settings (the hub) that every stream shows all four signals.
The file · consent-default.html
<!-- Consent Mode v2 default — must run BEFORE the Google tag / GTM snippet. -->
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){ dataLayer.push(arguments); }
// Default: nothing granted until the CMP says so. The two v2 signals (ad_user_data, ad_personalization) are required for EEA/UK ads features since March 2024.
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
});
// Optional: only default-deny where the law requires it, grant elsewhere. Remove the block above and use this one instead if that is your policy.
// gtag('consent', 'default', { ad_storage: 'denied', ad_user_data: 'denied', ad_personalization: 'denied', analytics_storage: 'denied', region: ['EEA', 'UK', 'CH'], wait_for_update: 500 });
// gtag('consent', 'default', { ad_storage: 'granted', ad_user_data: 'granted', ad_personalization: 'granted', analytics_storage: 'granted' });
</script>
<!-- Your Google tag or GTM snippet goes here, after the default. -->
<script>
// Called by your CMP when the user chooses. Map its categories to the four signals; every signal must be present.
function onConsentChoice(c) {
gtag('consent', 'update', {
ad_storage: c.marketing ? 'granted' : 'denied',
ad_user_data: c.marketing ? 'granted' : 'denied',
ad_personalization: c.marketing ? 'granted' : 'denied',
analytics_storage: c.analytics ? 'granted' : 'denied'
});
}
</script> Breaks on
The logged changes that can invalidate this artifact. A new one triggers a re-check.
- 18 Jan 2024 · Consent mode required for EEA audience and measurement features (the v2 signals)
- 4 Feb 2026 · Google Ads automatically collects a broader range of website event data
- 28 Aug 2024 · 'Set consent mode override' setting in Google tag settings
- 6 Jun 2025 · Consent settings hub enhanced with Tag Diagnostics
Stamped 9 Sept 2026 · re-checked quarterly or on change · corrections to team@datameasured.com · ← the library