Google Consent Mode v2
Learn how Cookient integrates with Google Consent Mode v2 for compliant analytics and advertising in the EU/EEA.
Overview
Google Consent Mode v2 is a framework that allows Google tags (Analytics, Ads, etc.) to adjust their behavior based on user consent. Since March 2024, it's required for advertisers targeting users in the EU/EEA.
Why It Matters
- •Legal compliance – Required by GDPR and ePrivacy
- •Preserve analytics – Cookieless pings still provide aggregated data
- •Remarketing – Required for Google Ads audiences in EU
How It Works
Cookient automatically communicates consent status to Google services through the gtag('consent', ...) API.
- 1
Default State
When the page loads, Cookient sets all consent types to
deniedby default. - 2
User Interaction
User sees the consent banner and makes their choices.
- 3
Consent Update
Cookient calls
gtag('consent', 'update', ...)with the user's choices. - 4
Tag Behavior
Google tags adjust automatically – full tracking if granted, cookieless pings if denied.
Example Consent Update
gtag('consent', 'update', {
'ad_storage': 'granted',
'ad_user_data': 'granted',
'ad_personalization': 'granted',
'analytics_storage': 'granted'
});Consent Types
Google Consent Mode v2 introduces four consent types. Cookient maps your cookie categories to these automatically.
| Google Consent Type | Cookient Category | Purpose |
|---|---|---|
| ad_storage | Marketing | Store advertising cookies |
| ad_user_data | Marketing | Send user data to Google for ads |
| ad_personalization | Marketing | Personalized advertising (remarketing) |
| analytics_storage | Analytics | Store analytics cookies (GA4) |
analytics_storage.Setup
Google Consent Mode is enabled by default in Cookient. Here's how to verify it's working correctly with your Google tags.
Step 1: Install Cookient First
The Cookient script must load before any Google tags. This ensures the default consent state is set before Google starts tracking.
Correct Script Order
<head>
<!-- 1. Cookient FIRST -->
<script src="https://cookient.app/c/YOUR_TOKEN.js"></script>
<!-- 2. Google Tag Manager or gtag.js AFTER -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXX');
</script>
</head>Step 2: Verify in Google Tag Assistant
- Install the Google Tag Assistant browser extension
- Visit your website and open Tag Assistant
- Look for "Consent" section in tag details
- Verify consent state changes when you interact with the banner
Step 3: Check GA4 Real-Time Reports
In Google Analytics 4, go to Reports → Real-time. You should see events coming in with consent status indicated.
Testing
Test your Consent Mode implementation to ensure it's working correctly.
Using Browser DevTools
- Open DevTools → Console
- Type
dataLayerand press Enter - Look for
consentevents in the array - Verify
defaultshowsdeniedinitially - Accept cookies and check for
updatewithgranted
Using Network Tab
- Open DevTools → Network
- Filter by "collect" or "google"
- Before consent: Look for
gcs=G100(all denied) - After accepting all: Look for
gcs=G111(all granted)
GCS Parameter Values
gcs=G100 → All denied (default state)
gcs=G110 → Analytics granted, Ads denied
gcs=G101 → Analytics denied, Ads granted
gcs=G111 → All grantedTroubleshooting
Consent state not updating
Cause: Google tags loaded before Cookient.
Solution: Move the Cookient script to load before all Google tags in your <head>.
"Consent not detected" in Tag Assistant
Cause: gtag function not available when Cookient initializes.
Solution: Ensure you have the gtag.js base code installed, even if using GTM.
No data in GA4 after denying consent
This is expected behavior. When analytics consent is denied, Google Analytics respects this and doesn't collect identifiable data.
You may still see aggregated, cookieless pings that provide basic metrics without personal data.
Remarketing audiences not building
Cause: Users are not consenting to Marketing category.
Solution: This is expected – you can only build audiences from users who consent. Consider making your consent request clearer about the benefits of personalized ads.