Template · CONSENT MODE INIT
Consent Mode v2 init snippet · EU/EEA default-deny
Law: GDPR — General Data Protection Regulation
Free for any use
Template body
<!-- Consent Mode v2 default-deny — paste as the FIRST script in <head>, before GTM/gtag -->
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
// Default-deny for all consent signals (EU/EEA/UK/CH baseline)
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', // always granted — strictly necessary
'wait_for_update': 500 // 500ms grace period for CMP to load and call update
});
// Set developer ID for Consent Mode v2 (replace XXXX with your value, optional)
// gtag('set', 'developer_id.dXXXXXX', true);
</script>
<!-- After your CMP renders the banner and the user clicks Accept/Reject, your CMP must call: -->
<!-- (this is what your CMP does internally — for reference only)
<script>
gtag('consent', 'update', {
'ad_storage': 'granted', // or 'denied' based on user choice
'ad_user_data': 'granted',
'ad_personalization': 'granted',
'analytics_storage': 'granted'
});
</script>
-->