Firefox 128+ / Firefox for AndroidMIT26 languages

Stops Google Analytics from measuring you

It tells the Google Analytics code on the page that you have opted out, and blocks the measurement hits with five static rules. There is no options page, no filter subscription and no counter.

addons.mozilla.org

WHY THIS EXISTS

The official opt-out fails silently

Google's official opt-out add-on injects a <script> element into the page. Firefox applies the page's own CSP to content scripts, so on a site with a strict CSP the injection is blocked and the opt-out does nothing. Nothing tells you that it failed. Hakarasenai uses the same official hook, but puts it where no CSP can reach it.

The official add-on

document.head.appendChild(script)

Refused by the CSP. No warning, and GA keeps measuring.

Hakarasenai

world: "MAIN" content script @ document_start

Nothing is inserted into the DOM, so no CSP can stop it.

What it does

  1. 01

    LAYER 1

    Tells the Google Analytics code on the page that you have opted out

    _gaUserPrefs.ioo() → true

  2. 02

    LAYER 2

    Blocks the measurement hits that would go out anyway

    block · /collect · /batch

  3. 03

    ESCAPE

    Lets you exclude a single site from the toolbar button, if one misbehaves

    Excluded — doing nothing on this site

Not blocked: googletagmanager.com and the GA scripts themselves. They are allowed to load and simply never report, so anything else a site drives through Tag Manager keeps working.

VERIFY

You can check for yourself that it works

Open the network panel in the developer tools and load a page that uses GA. The rules and the permissions are all in the repository.

# devtools → network
blocked google-analytics.com/g/collect
blocked analytics.google.com/g/collect
blocked stats.g.doubleclick.net/collect
# permissions
declarativeNetRequest / scripting / storage

Install

Now on addons.mozilla.org, reviewed and signed by Mozilla. One click to install — Firefox keeps it up to date.

Add to Firefox →

Firefox 128 or newer, on desktop or on Android.

Available in 26 languages; follows your system language automatically.

Language: English ▾