Google Consent Mode v2 Integration
Deploy native, zero-latency automation for Google Consent Mode v2 to satisfy EU Digital Markets Act (DMA) mandates while recovering up to 70% of lost conversion data via Google AI modeling.
DMA 2024
Mandatory Signals
Enforces ad_user_data and ad_personalization parameter injection across all Google Ads and GA4 properties.
+70% RECOVERY
AI Conversion Modeling
Maintains cookieless pings when consent is denied, unlocking machine learning attribution in Google Analytics 4.
Step 01: Consent Signal Matrixโ
Consent Shield dynamically translates visitor banner choices into Google Consent Mode v2 signals:
| Google Consent Key | Default State | Consented State | Statutory Purpose |
|---|---|---|---|
ad_storage | denied | granted | Enables storage (cookies) related to advertising. |
analytics_storage | denied | granted | Enables storage related to analytics & performance telemetry. |
ad_user_data | denied | granted | Authorizes sending user data to Google for marketing attribution. |
ad_personalization | denied | granted | Authorizes personalized advertising and remarketing audiences. |
Step 02: Script Tag & Google Tag Manager Placementโ
Add the following initialization code directly in the <head> of your website, preceding Google Tag Manager and GA4:
<!-- 1. Google Consent Mode v2 Default Denied State -->
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('consent', 'default', {
'ad_storage': 'denied',
'analytics_storage': 'denied',
'ad_user_data': 'denied',
'ad_personalization': 'denied',
'wait_for_update': 500
});
</script>
<!-- 2. Google Tag Manager Container -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXX');</script>
<!-- 3. Consent Shield AI Kernel -->
<script
src="https://consentshieldai.com/shield.js"
data-site-id="CS-LIVE-PROD"
data-gcm-v2="true"
async>
</script>
Step 03: Verification in Google Tag Assistantโ
- Open Google Tag Assistant (
tagassistant.google.com) and connect your target URL. - Observe the initial
Consenttab: verify all 4 keys showDeniedunder the Default column. - Click "Accept All" on the Consent Shield banner.
- Verify a
consentupdate event is fired with all keys transitioning toGranted.
Verify Your GCM v2 Configuration
Run our automated multi-page scanner to verify Google Consent Mode v2 signal dispatch and pre-DOM tag suppression.