Glossary

How a Google Analytics Opt Out Works, and What Each Method Blocks

Taras Shynkarenko
Taras Shynkarenko
•Updated: •8 min read
How a Google Analytics Opt Out Works, and What Each Method BlocksHow a Google Analytics Opt Out Works, and What Each Method Blocks

TL;DR, Quick Answer

8 min read

There are three ways to opt out of Google Analytics. The visitor can install Google's Opt-out Browser Add-on, which stops analytics.js and gtag.js from sharing visit data with Google Analytics. The site can set window['ga-disable-MEASUREMENT_ID'] = true before any gtag() call, which stops the tag from setting cookies or sending data. Or consent mode can set analytics_storage to denied, which stops analytics cookies but, in an advanced setup, still sends cookieless pings. None of them stops other analytics tools.

What does a Google Analytics opt out mean?

A Google Analytics opt out is any setting that stops Google Analytics from collecting a visitor's data, and it comes in three forms: the visitor installs Google's Opt-out Browser Add-on, the site sets the window['ga-disable-MEASUREMENT_ID'] property to true before any gtag() call, or consent mode sets analytics_storage to denied. Each one is controlled by a different party and blocks something different, so "opted out" can mean no data at all, or no cookies with some data still flowing.

The question to ask is who flips the switch. The add-on lives in the visitor's browser and works across every site. The window property and consent mode live in your site's code and apply only to your property.

How does the Google Analytics Opt-out Browser Add-on work?

The Google Analytics Opt-out Browser Add-on is a browser extension from Google that stops the Google Analytics JavaScript on any website from sending the visitor's activity to Google Analytics. Google's download page says it was built "To provide website visitors the ability to prevent their data from being used by Google Analytics," for "websites using the supported version of Google Analytics JavaScript (analytics.js, gtag.js)."

Key facts from Google's pages:

  • Browsers. It "is designed to be compatible with Chrome, Safari, Firefox and Microsoft Edge."
  • What it blocks. Google's help center: "The add-on prevents the Google Analytics JavaScript (gtag.js, analytics.js) that run on websites from sharing information about your visit activity with Google Analytics."
  • What it does not block. The same page: "Using the Google Analytics opt-out browser add-on doesn't prevent site owners from using other tools to measure site analytics. It also doesn't prevent data from being sent to the website itself or in other ways to web analytics services."
  • When it fails. "In order to function, the opt-out add-on must be able to load and execute properly on your browser."

That last limit is the practical one. The add-on works in the browser where it is installed, so a visitor who switches to another browser or device is measured there unless they install it again. Data a site sends to Google Analytics from its own server does not pass through the visitor's browser JavaScript at all.

A developer typing code on a laptop, the kind of script edit needed to switch off tracking before the Google tag loads.

How does the ga-disable window property work?

The ga-disable window property is a flag in the gtag.js library that, when set to true for a measurement ID, stops the Google tag from setting cookies or sending data for that ID. Google's privacy guide describes the check: "When a product attempts to set a cookie or send data back to the Google Analytics servers, it will first check if this property is set, and will take no action if the value is set to true."

<script>
  window['ga-disable-G-XXXXXXXXXX'] = true;
</script>
<!-- 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);}
  gtag('js', new Date());
  gtag('config', 'G-XXXXXXXXXX');
</script>

Three rules decide whether it works. Google states that "The window property must be set before any calls to gtag() are made, and it must be set on each page for which you want to turn off Analytics. If the property is not set or set to false, then Analytics will work as usual." Google names the use case itself: a site whose privacy policy "provides an option for the user to opt-out of Google Analytics."

For sites on Google Tag Manager, Google documents a different route that does not use the window property. Set a first-party cookie named google-analytics-opt-out with the value true, create a 1st-Party Cookie variable that reads it, and change the Google Analytics tag's trigger to fire only on page views where that variable "does not equal true." The tag never fires, so nothing is sent.

Consent mode denial blocks Google Analytics cookies, not necessarily all Google Analytics requests. When analytics_storage is denied, Google's help center says the tag "Will not read or write first-party analytics cookies. For advanced consent mode implementation, cookieless pings will be sent to Google Analytics for future measurement."

The difference between the two consent mode setups decides what a denial means:

  • Basic consent mode blocks Google tags until the visitor grants consent. A visitor who declines sends nothing.
  • Advanced consent mode loads the tags with consent denied by default. A visitor who declines still sends cookieless pings, which Google uses for behavioral and conversion modeling.

So a visitor who clicks "Reject" on an advanced setup is opted out of analytics cookies but still produces requests to Google Analytics. Consent is set with gtag('consent', 'default', {...}) before any config or event call and changed with gtag('consent', 'update', {...}) after the visitor chooses. The Google consent mode v2 guide covers the ad_user_data and ad_personalization signals that sit next to analytics_storage.

What a Reject click does in each consent mode
Basic consent mode
  • Google tags stay blocked until the visitor grants consent
  • A visitor who declines sends nothing
Advanced consent mode
  • Tags load with consent denied by default
  • First-party analytics cookies are not read or written
  • Cookieless pings still reach Google Analytics
  • Google uses the pings for behavioral and conversion modeling
Only the basic setup means a declined visitor sends no requests to Google Analytics.

Which Google Analytics opt out blocks what?

The three Google Analytics opt-out methods differ in who controls them, where they apply and what still leaves the browser.

Opt-out Browser Add-onga-disable propertyanalytics_storage denied
Who sets itThe visitorThe siteThe site, from the visitor's consent choice
Where it appliesEvery site in that browserOne measurement ID, on each page it is setYour site's Google tags
Analytics cookiesNot described on Google's pagesNot setNot read or written
Requests to Google AnalyticsStopped for analytics.js and gtag.jsStopped for that IDNone in basic mode; cookieless pings in advanced mode
Other analytics toolsNot affectedNot affectedNot affected
Timing ruleMust load and execute in the browserBefore any gtag() callDefault before any config or event

Two settings get mistaken for opt-outs and are not. allow_google_signals: false stops events from being used "for ads personalization and demographics and interests reports," and allow_ad_personalization_signals: false stops ads personalization while events "can still be used for demographics and interests reporting." Both still send analytics data.

A person checking a website on a laptop at a desk, similar to testing an opt-out link on your own pages.

Flowsery
Flowsery

Start Your 14-Day Free Trial

Real-time dashboard

Goal tracking

Cookie-free tracking

You add a Google Analytics opt-out link by storing the visitor's choice and reading it on every page before the Google tag runs.

  1. Store the choice. When the visitor clicks "Opt out of analytics," save a flag in a first-party cookie or localStorage.
  2. Read it first. At the top of the <head>, before the gtag snippet, check the flag and set window['ga-disable-G-XXXXXXXXXX'] = true when it is present.
  3. Repeat on every page. The property only applies to the page where it is set, so put the check in your shared layout.
  4. Cover every ID. Set one property per measurement ID if the site sends to more than one property.
  5. Update consent too. If you run consent mode, send gtag('consent', 'update', { analytics_storage: 'denied' }) so your consent records match.
  6. Test it. Reload with the flag set and confirm in the Network panel that no requests go to Google Analytics.

Your privacy policy should describe whichever method you offer. The privacy policy requirements for Google Analytics guide covers what that text needs, and the tracking consent guide explains when an opt-out is enough and when you need opt-in consent instead.

How do you stop Flowsery from tracking a browser?

Flowsery stops tracking a browser through a localStorage flag that its tracker reads on every page load. Flowsery's docs describe it as the way to stop your own browser from being tracked: run localStorage.setItem('flowsery_ignore', 'true') in the developer console on your site, and that browser sends no pageviews, custom events or session recordings while the flag is set. The flag lives in that browser's storage for that site, so set it on each browser, device and hostname you use, and remove it with localStorage.removeItem('flowsery_ignore'). For traffic you never want in reports, Website Settings, Security has exclusion rules for paths, IPs, countries and hostnames. Flowsery's docs do not describe a visitor-facing opt-out control beyond this flag. The script also has a cookieless option that uses a daily-rotating visitor hash and stores no personal data, so visitors are not linked across days or devices. The privacy-first analytics page covers how Flowsery measures traffic and conversions without collecting personal data.

Frequently asked questions

Does the Google Analytics Opt-out Browser Add-on work on GA4?

The add-on works with sites that use gtag.js and analytics.js, and gtag.js is the library that sends data to GA4 properties. Google lists it for Chrome, Safari, Firefox and Microsoft Edge. It only works when it can load and execute properly in the browser.

Where do I put window['ga-disable-MEASUREMENT_ID']?

Put it in a script that runs before the gtag snippet, on every page where Analytics should be off. Google states it must be set before any calls to gtag() are made. If it is not set, or set to false, Analytics works as usual.

Does denying analytics_storage stop all Google Analytics data?

Not in an advanced consent mode setup. Denial stops Google Analytics from reading or writing first-party analytics cookies, but advanced setups still send cookieless pings. Only a basic setup, which blocks the tags until consent, sends nothing.

Does the opt-out add-on block other analytics tools?

No. Google states that the add-on doesn't prevent site owners from using other tools to measure site analytics. It also doesn't stop data being sent to the website itself or in other ways to web analytics services.

How do I opt out of Google Analytics in Google Tag Manager?

Google documents a cookie-based trigger. Set a first-party cookie named google-analytics-opt-out to true, read it with a 1st-Party Cookie variable, and fire the Google Analytics tag only when that variable does not equal true.

Is turning off Google signals the same as opting out?

No. Setting allow_google_signals to false stops events from being used for ads personalization and demographics and interests reports. The tag still sends analytics data, so the visitor is still measured.

Can a visitor opt out of Google Analytics on every browser at once?

Not with the add-on. It works in the browser where it is installed, so a visitor who switches to another browser or device is measured there until they install it again. Google lists Chrome, Safari, Firefox and Microsoft Edge as compatible.

Why is my ga-disable flag not stopping Google Analytics?

The usual cause is timing. Google states the window property must be set before any calls to gtag() are made, and on each page where you want Analytics off. If it is not set, or set to false, Analytics works as usual, and each measurement ID needs its own property.

Basic consent mode blocks Google tags until the visitor grants consent, so a decline sends nothing. Advanced consent mode loads the tags with consent denied by default, so a decline still sends cookieless pings that Google uses for behavioral and conversion modeling.

How do I stop Flowsery from tracking my own browser?

Run localStorage.setItem('flowsery_ignore', 'true') in the developer console on your site. That browser then sends no pageviews, custom events or session recordings. Set it on each browser, device and hostname you use, and remove it with localStorage.removeItem('flowsery_ignore').

Was This Article Helpful?

Let us know what you think!

See us more often in Google

One click marks Flowsery as a preferred source, so our articles sit higher in your Top Stories, AI Mode, and AI Overviews.

Before you go...

Flowsery

Flowsery

Revenue-first analytics for your website

Track every visitor, source, and conversion in real time. Simple, powerful, and cookie-free.

Real-time dashboard

Goal tracking

Cookie-free tracking

Related Glossary Terms

Related Articles