Sub topic 1
Why Consent Choices Change What GA4 Can Measure
Prerequisites
This chapter assumes you know GA4 properties, events and standard reports. You should also understand cookies, client-side tracking, and basic use of gtag.js or Google Tag Manager. Privacy rules such as GDPR and ePrivacy require consent before some tracking runs, so consent is a legal requirement that shapes your setup.
Why consent changes measurement
When a visitor denies consent, the tag can withhold cookies and identifiers. Without them, GA4 cannot link hits to the same user, so users, sessions and conversions can be undercounted. Consent choices decide which events are collected, stored and attributed.
The Consent Mode v2 signals
Consent Mode v2 uses four signals. Each one is set to either granted or denied:
ad_storage: controls advertising cookies.ad_user_data: controls sending user data to Google for advertising.ad_personalization: controls personalized advertising.analytics_storage: controls cookies used by GA4 measurement.
Basic versus advanced Consent Mode
In basic mode, the Google tag does not load until the visitor grants consent. A denied visitor sends no hits, so that activity leaves no record.
In advanced mode, the tag loads and sends cookieless pings when consent is denied. GA4 uses these pings to model some of the missing activity. Basic mode leaves larger data gaps.
Setting consent defaults and updates
Set the default state before any Google tag loads. Then send an update after the visitor chooses.
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('consent', 'default', {
ad_storage: 'denied',
ad_user_data: 'denied',
ad_personalization: 'denied',
analytics_storage: 'denied',
wait_for_update: 500
});The wait_for_update value gives your banner up to 500 milliseconds to send its update before tags read the default.
Call this function when the visitor accepts:
function onConsentAccepted() {
gtag('consent', 'update', {
ad_storage: 'granted',
ad_user_data: 'granted',
ad_personalization: 'granted',
analytics_storage: 'granted'
});
}Exercise
A visitor denies consent on a site that uses basic Consent Mode. Which GA4 hits are sent for that visitor?
Show answer
None. The Google tag does not load, so the visitor's activity is not recorded. In advanced mode, the tag would send cookieless pings instead.