Skip to main content

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.


Consent Shield dynamically translates visitor banner choices into Google Consent Mode v2 signals:

Google Consent KeyDefault StateConsented StateStatutory Purpose
ad_storagedeniedgrantedEnables storage (cookies) related to advertising.
analytics_storagedeniedgrantedEnables storage related to analytics & performance telemetry.
ad_user_datadeniedgrantedAuthorizes sending user data to Google for marketing attribution.
ad_personalizationdeniedgrantedAuthorizes 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โ€‹

  1. Open Google Tag Assistant (tagassistant.google.com) and connect your target URL.
  2. Observe the initial Consent tab: verify all 4 keys show Denied under the Default column.
  3. Click "Accept All" on the Consent Shield banner.
  4. Verify a consent update event is fired with all keys transitioning to Granted.

Verify Your GCM v2 Configuration

Run our automated multi-page scanner to verify Google Consent Mode v2 signal dispatch and pre-DOM tag suppression.