Sub topic 12
Consent and privacy considerations
This chapter covers the privacy controls that belong in a new GA4 setup. It assumes you have already created a property and a web data stream and installed the tag with gtag.js, as in the earlier chapters. It is not legal advice. Which rules apply to you depends on where your visitors are and what you collect, so confirm requirements with whoever handles compliance for your organization.
What GA4 collects by default
A standard GA4 web tag stores identifiers in first-party cookies. The _ga cookie holds a client ID that recognizes a browser across visits. A second cookie named _ga_<container-id> holds session state. Both are analytics storage, which matters later for consent.
GA4 does not log or store IP addresses. It uses the IP address at collection time to derive approximate location, then discards it. The old Universal Analytics "anonymize IP" setting therefore does not exist in GA4.
Several features go beyond basic measurement, and each has its own switch:
- Google signals links activity to signed-in Google users who have turned on ad personalization. It enables cross-device reporting and audiences, and it can cause data thresholding in reports.
- Granular location and device data collects city, region, and device details. You can turn it off per region.
- Advertising features share data with Google Ads and related products.
- User-ID ties activity to your own login identifier, so you are responsible for how that ID is made.
Consent Mode: the four signals
Consent Mode lets your site tell Google tags what the visitor has agreed to. The tags then adjust their behavior. GA4 reads these signals:
| Signal | Controls |
|---|---|
| `analytics_storage` | Reading and writing analytics cookies such as `_ga` |
| `ad_storage` | Advertising cookies |
| `ad_user_data` | Whether user data may be sent to Google for advertising |
| `ad_personalization` | Whether data may be used for personalized advertising |
Each signal is either granted or denied. For a GA4-only setup, analytics_storage is the most important one. The other three matter when the property is linked to Google Ads or when Google signals is on.
Set the default before the config call
The order of calls matters. The default consent state must be set before gtag('config', ...) runs. Otherwise the tag starts with its own defaults and may set cookies before the visitor has answered.
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
// 1. Default state: everything denied until the visitor chooses.
gtag('consent', 'default', {
'ad_storage': 'denied',
'ad_user_data': 'denied',
'ad_personalization': 'denied',
'analytics_storage': 'denied',
'wait_for_update': 500
});
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
</script>The wait_for_update value is in milliseconds. It tells tags to wait that long for your consent banner to send a stored choice before they send their first hit. Without it, a returning visitor who already accepted can be counted as denied on the first page.
Update when the visitor chooses
Your consent banner, whether a custom one or a consent management platform (CMP), calls gtag('consent', 'update', ...) when the visitor chooses. Only the keys you pass change.
function onAnalyticsAccepted() {
gtag('consent', 'update', {
'analytics_storage': 'granted'
});
}
function onAllRejected() {
gtag('consent', 'update', {
'analytics_storage': 'denied',
'ad_storage': 'denied',
'ad_user_data': 'denied',
'ad_personalization': 'denied'
});
}On later page loads, read the stored choice and send an update right after the default. Many CMPs do this for you.
Basic and advanced implementation
There are two ways to run Consent Mode, and they behave very differently when consent is denied.
- Basic mode blocks the Google tag from loading until the visitor consents. Nothing is sent before consent, so there is no data from visitors who decline.
- Advanced mode loads the tag on every page with the default state set. While
analytics_storageis denied, the tag sends cookieless pings. These carry no cookie identifiers and are used for modeling. Once the visitor consents, the tag sends full hits.
Google can use the cookieless signals to model some of the missing behavior in reports, but modeling needs enough data and eligible traffic. Treat modeled numbers as estimates. Whether advanced mode is acceptable for your audience is a decision for your compliance owner, not a technical default.
Consent Mode in Tag Manager
If you install GA4 through Google Tag Manager, set the default state with a tag that fires on the Consent Initialization trigger, so it runs before all other tags. Most CMP templates do this. In the container settings you can turn on consent overview to see which tags need which consent types. Built-in Google tags check consent themselves. Third-party tags may need additional consent checks configured by hand.
Admin settings that affect privacy
These settings live under Admin, and most of them are per property.
- Data collection: Turn Google signals on or off, and control granular location and device data. When you create the property, you also acknowledge the data collection terms here.
- Data retention: Event-level data kept for explorations is retained for 2 months or 14 months. The default for new properties is 2 months, so set 14 months now if you want longer lookback. Standard aggregated reports are not affected by this setting.
- Data sharing settings: Control whether Google support, benchmarking, and account specialists can access your data.
- Data deletion requests: Remove specific user or event data when you have to honor a deletion request.
- Reporting identity: Choose which identity spaces GA4 uses to count users: blended, observed, or device-based. Device-based uses only device IDs and avoids Google signals and modeling.
Keep personal data out of your data
Google's terms prohibit sending personally identifiable information (PII) to Analytics. That includes email addresses, full names, phone numbers, and precise addresses. GA4 does not stop you from sending them, so the check has to happen at your end.
Common leaks:
- Form pages that put an email address in the URL query string, such as
/[email protected]. Thepage_locationparameter then carries it. - Custom event parameters that hold usernames or order contact details.
- A User-ID that is an email address instead of an opaque internal ID.
- Page titles that include a customer's name, for example "Account for Jo Smith".
Fix these at the source: use POST instead of GET for forms, use opaque IDs, and keep names out of titles. Check your reports for odd values in page path and custom dimensions after launch.
// Wrong: the email address becomes an event parameter.
gtag('event', 'sign_up', { method: 'email', user_email: '[email protected]' });
// Right: send only the non-identifying detail.
gtag('event', 'sign_up', { method: 'email' });Verify that consent is working
Test the default and the update separately, using a clean browser profile or a private window.
- Load the page without answering the banner. In the browser's storage panel, confirm there is no
_gacookie whileanalytics_storageis denied. - In the Network panel, filter for
collect. Check thegcsparameter on the request.G100indicates ad and analytics storage both denied.G111indicates both granted. - Accept analytics in the banner and confirm that the
_gacookie appears and the next request shows granted. - Reload the page and confirm that the stored choice is applied without the banner reappearing.
- Open DebugView, with debug mode on as described in the verification chapter, and confirm that events appear for the state you are testing.
Common mistakes
- Setting the consent default after
config, or in a script that loads later. - Omitting
wait_for_update, so returning visitors are first counted as denied. - Updating only
analytics_storagewhen the property is linked to Google Ads and the ad signals still showdenied. - Assuming that denied consent removes all data in advanced mode. Cookieless pings are still sent.
- Leaving Google signals on without reviewing the privacy policy text that describes it.
- Treating the data retention default as permanent. It is a setting you must choose.
Exercise
A visitor opens your page for the first time and the browser shows a _ga cookie before they click anything on the consent banner. Name two likely causes and how to check each.
Show answer
First, the consent default may be set after gtag('config', ...), or not set at all, so the tag started with granted storage. Check the order of calls in the page source, and check that the Network collect request shows gcs=G111 instead of G100. Second, another script or a Tag Manager tag may be setting the cookie independently of Consent Mode, or the Tag Manager default may not fire on the Consent Initialization trigger. Check the container's consent overview and the trigger of the tag that sets the default.
Exercise
Your property is set to 2 months of event data retention, and an analyst needs 12 months of lookback in Explorations. What do you change, and what does the change not affect?
Show answer
In Admin, under Data collection and modification, open Data retention and set event data retention to 14 months. It applies to event-level data used in explorations, and it only affects data going forward from when it is saved. It does not change standard aggregated reports, which are not subject to this limit.