Hakarasenai: a Firefox extension that only stops Google Analytics from measuring you
The second piece of software I publish is Hakarasenai, a Firefox extension for desktop and Android. The name means "won't let it measure", and that is the entire feature list: it stops Google Analytics from measuring you. Free, MIT licensed, on addons.mozilla.org (v1.2.0).

Why it exists
Google ships an official "Google Analytics Opt-out Add-on", and there is a Firefox build of it. The trouble is how it works: it injects a <script> element into the page, and Firefox, like Safari, applies the page's own Content Security Policy to content scripts. On any site with a strict CSP the injection is blocked and the opt-out quietly does nothing. Nothing tells you it failed, which is the worst failure mode a privacy tool can have.
I ran into this while trying to keep my own visits out of the GA4 properties of my sites, and wrote this instead.
Two layers
- It tells the Google Analytics code on the page that you have opted out, using the same official hook, but from a place no CSP can reach (a
world: "MAIN"content script) - It blocks the measurement hits (
/collectand friends) that would go out anyway, with five static network rules
If the first layer ever fails on a site, the second one still keeps the data from leaving.
One button
The toolbar button shows the current site's state, Blocking or Excluded, and offers one action: Exclude this site. Exclusions are per registrable domain and cover subdomains, and they are meant for when you want to be measured on purpose, for example to verify GA on your own site. No options page, no filter subscriptions, no counters.
Requires Firefox 128 or newer on desktop and on Android. The UI and the README come in 26 languages.
👉 Hakarasenai 👉 Add to Firefox (addons.mozilla.org) 👉 GitHub: omikuji/hakarasenai
Comments
Post a Comment