PrivacyQuick

Google Consent Mode & analytics

Google Analytics 4 and GDPR: a consent setup that works

You can use Google Analytics 4 for EU visitors if you get consent before it sets cookies, configure the property's privacy settings, accept Google's data processing terms and explain it in your privacy policy. Here is how to set up each part.

  • Plain English
  • Written for website owners
  • Free to read

Google Analytics 4 can be used for visitors in the EU and UK, but it needs four things in place. You need consent before GA4 sets its cookies, which in practice means a cookie banner that blocks GA4 or controls it through Google Consent Mode. You need the property's privacy settings configured, Google's data processing terms accepted, and a privacy policy that explains what you collect. Transfers to Google in the US currently rely on the EU-US Data Privacy Framework, which is still being challenged in court. This guide goes through each part.

GA4 compliance in Europe is easier to reason about when you split it into separate questions:

  1. Device storage (ePrivacy). GA4 sets first-party cookies, mainly _ga and _ga_<container-id>, which hold a client identifier and session state. Under Article 5(3) of the ePrivacy Directive and PECR regulation 6 in the UK, analytics cookies need prior consent. No general exemption covers GA4. France's CNIL has a limited exemption for audience measurement, but GA4 in its standard configuration isn't designed to meet its conditions.
  2. Processing personal data (GDPR). The client ID, device data and browsing behavior GA4 collects are personal data. You need a legal basis under Art. 6, which for analytics is normally the same consent, plus transparency under Art. 13 and a processor contract under Art. 28.
  3. International transfers (GDPR Chapter V). Data goes to Google, a US company. Transfers need a valid mechanism.

A banner only addresses the first layer and part of the second. The rest is configuration and paperwork.

How regulators have treated Google Analytics

In 2022, several European regulators found that specific uses of Universal Analytics, GA4's predecessor, involved unlawful transfers to the US. The Austrian data protection authority decided the first of these complaints, filed by the campaign group noyb, and France's CNIL and Italy's Garante reached similar conclusions in the same year. The core issue was that, after the Court of Justice struck down the Privacy Shield in Schrems II (C-311/18, July 2020), standard contractual clauses alone didn't protect the data from US government access.

The legal position changed in July 2023, when the European Commission adopted an adequacy decision for the EU-US Data Privacy Framework. Google LLC participates in the Framework, so transfers to it can rely on that decision. In September 2025, the EU General Court dismissed a challenge to the Framework brought by French MP Philippe Latombe. As of late 2026, his appeal to the Court of Justice is pending. If the Framework falls, the transfer question reopens, so it's worth keeping your settings minimal and your documentation current.

Standard Universal Analytics properties stopped processing data in July 2023. The 2022 decisions were about the older product, but their reasoning about transfers and identifiers is why GA4 setups still get scrutiny.

GA4 privacy settings to review

GA4 has several settings that reduce what's collected and kept. Google moves menu items occasionally, so look for these names in the Admin area rather than following an exact path.

SettingWhat it doesSuggested choice
Data retentionHow long user- and event-level data is kept for explorations. Standard properties offer 2 or 14 months; aggregated standard reports aren't affected.The shortest period that meets your analysis needs. Many sites choose 14 months for year-on-year comparisons.
Google signalsLinks data with signed-in Google users for cross-device reports and demographics.Off, unless you need it and your consent text covers it. It can be disabled per region.
Granular location and device dataCollection of city-level location, latitude and longitude, browser minor version and similar details.Off for EU and UK regions unless you need it.
Ads personalizationWhether GA4 data can be used for personalized advertising through linked Google products.Off for regions where you don't have marketing consent, or everywhere if you don't advertise.
User-provided data collectionLets GA4 receive hashed first-party data such as email addresses.Off unless you have a specific need and a legal basis for it.
Data redaction (web streams)Removes email addresses and chosen query parameters from collected URLs.On, with any parameters that could carry personal data.
Account data sharing settingsShares data with Google for product improvement, benchmarking and support.Review each option; turn off what you don't need.

On IP addresses, Google states that GA4 doesn't log or store them, and that it uses them only to derive location, so the old Universal Analytics IP anonymization setting no longer exists. Google also says data from EU visitors is first collected on servers in the EU. Treat these as helpful mitigations, not a substitute for consent: GA4 still sets cookies with a persistent identifier.

There are two workable patterns. Both start with GA4 in an analytics category of its own, separate from advertising, so visitors can allow measurement without allowing ads.

Pattern 1: Don't load GA4 until consent

The tag doesn't load until the visitor accepts analytics. Nothing reaches Google from visitors who decline or ignore the banner. This is the simplest pattern to explain and audit. With a script-blocking consent tool, you mark the GA4 snippet so it stays inactive until consent. The script blocking docs show the exact change for gtag.js.

Pattern 2: Load GA4 with Consent Mode

The tag loads on every page with analytics_storage denied by default, and switches to normal cookies once the visitor consents. Before consent, it sends cookieless pings, which Google can use for behavioral modeling if your property is large enough. The Consent Mode v2 guide explains the signals, and the basic vs advanced comparison covers the legal debate about pre-consent pings.

GA4 settings in the tag

Whichever pattern you use, you can tighten GA4's behavior in the tag itself:

<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('set', 'allow_google_signals', false);
  gtag('set', 'allow_ad_personalization_signals', false);

  gtag('config', 'G-XXXXXXXXXX', {
    cookie_expires: 34128000,  // about 13 months, in seconds
    cookie_update: false       // don't extend the expiry on every visit
  });
</script>

The default _ga lifetime is two years, refreshed on each visit. Shortening it fits regulators' expectations better. The guide to cookie lifespans explains why 13 months is a common target.

Test the result rather than trusting the settings. In a private window, before you touch the banner, you should see no _ga cookies, and either no requests to Google Analytics at all (pattern 1) or only requests with gcs=G100 (pattern 2).

Keep personal data out of your events

Google's Analytics terms prohibit sending data that Google could use to identify individuals, such as names, email addresses and phone numbers. It slips in more often than people expect:

  • URLs. Password resets, newsletter links and search pages often put emails or names in query strings, which GA4 records as part of the page location.
  • Page titles. Account pages sometimes include the user's name in the title.
  • Custom events and parameters. Form-tracking code can capture field values instead of field names.
  • User IDs. GA4's User-ID feature should use an internal, non-identifying ID, never an email address.

Turn on data redaction for your web stream, strip sensitive parameters before they reach GA4, and review a sample of collected page paths in an exploration from time to time.

Contracts and documentation

For GA4, Google acts as your processor for most of the data, so you need processor terms under GDPR Art. 28. Google provides data processing terms that you accept in your Analytics account settings. Check that they're accepted and that the account's business contact details are filled in. The guide to data processing agreements explains what these terms must cover.

Your documentation should also include:

  • an entry for analytics in your records of processing activities (Art. 30), naming Google and the transfer mechanism,
  • your privacy policy section on analytics: purposes, data collected, Google as recipient, US transfers, retention and how to withdraw consent,
  • your cookie policy table listing _ga and _ga_<container-id> with their durations, and
  • a record of each visitor's consent, so you can show that analytics ran only with permission.

If you're writing the privacy policy section from scratch, the guide on how to write a privacy policy covers the Art. 13 items.

What your numbers will look like

Once GA4 waits for consent, reports cover only visitors who said yes, which is often a substantial drop. How large depends on your audience, your banner design and the countries you serve. A few habits make the data more useful:

  • Annotate the change date so later comparisons don't treat the drop as a traffic loss.
  • Compare against an independent source, such as server logs or order counts, to estimate your consent rate.
  • Use ratios rather than totals for decisions. Conversion rates and page comparisons are less affected than raw visitor counts.
  • Check the reporting identity. If you use Consent Mode and qualify for modeling, modeled data only appears when the reporting identity is Blended.

If you need complete counts without consent, look at whether a tool built for the CNIL-style exemption or a cookieless analytics setup fits your needs alongside, or instead of, GA4.

Related GA4 and Google Ads settings: how GA4 handles IP addresses, data retention settings, Google Signals and enhanced conversions.

Next steps

  • Put GA4 in its own analytics category and block it, or set a denied Consent Mode default, until consent.
  • Review data retention, Google signals, granular location and device data, ads personalization and data sharing.
  • Turn on data redaction and remove personal data from URLs, titles and events.
  • Shorten the _ga cookie lifetime and stop automatic renewal.
  • Accept Google's data processing terms and update your privacy policy, cookie policy and processing records.
  • Keep an eye on the Data Privacy Framework appeal and have a plan if its status changes.

PrivacyQuick can do the consent part for you: it blocks GA4 or sends the Consent Mode signals, depending on which pattern you choose, and logs each choice without storing IP addresses.

Frequently asked questions

Is Google Analytics 4 legal in the EU?

It can be used lawfully, but nothing about GA4 makes a site compliant on its own. You need consent for its cookies, a correctly configured property, processor terms with Google and a valid basis for transfers to the US.

Can I use GA4 without a cookie banner?

Not for EU or UK visitors if GA4 sets its normal cookies, because analytics cookies need consent. Consent Mode's cookieless pings reduce what is stored, but whether they can be sent without consent is disputed.

Does server-side tagging remove the need for consent?

No. Server-side tagging changes where data is processed, not whether you need permission. The browser still stores an identifier and sends data for analytics, so the same consent rules apply.

Should analytics go in a separate banner category from advertising?

Yes. Visitors should be able to accept analytics without accepting advertising, so keep GA4 in an analytics category and Google Ads or remarketing in a marketing category.

Check your own website in 30 seconds

Our free scanner lists every cookie and tracker your site sets, sorted into categories, before you add a banner.

Run a free cookie scan Start free

This guide is general information, not legal advice. Laws and regulator guidance change; check the current rules for your situation or ask a lawyer.