The API
Three functions, present in every build including the base one. There is nothing to enable and no extra script to load.
| Call | Returns | Effect |
|---|---|---|
window.aa.optOut() | true when the opt-out is now in force | This browser stops sending anything, immediately and for future visits. |
window.aa.optIn() | true when the opt-out has been cleared | Removes the flag. Counting resumes. |
window.aa.hasOptedOut() | true or false | Nothing. Use it to render the control in the right state. |
All three read and write the browser's own storage and can fail if that storage is
unavailable — a locked-down browser, a sandboxed frame, a private window with storage
blocked. That is why optOut() returns a boolean rather than nothing: it tells
you whether the choice actually took, so your interface can say so instead of showing a
switch that quietly did not move.
Building the control
There is no hosted opt-out page and no embeddable widget. You build the control, which means it looks like your site and sits where your visitors will find it. Here is a complete one.
<p>
<label>
<input type="checkbox" id="aa-optout" />
Do not count my visits to this site
</label>
<span id="aa-optout-status" role="status"></span>
</p> const box = document.getElementById('aa-optout');
const status = document.getElementById('aa-optout-status');
// Reflect the current state on load.
box.checked = window.aa.hasOptedOut();
box.addEventListener('change', () => {
const ok = box.checked ? window.aa.optOut() : window.aa.optIn();
// The call can fail if this browser blocks storage. Say so rather than
// showing a switch that looks like it worked.
box.checked = window.aa.hasOptedOut();
status.textContent = ok
? (box.checked ? 'Your visits are no longer counted.' : 'Your visits are counted again.')
: 'Your browser blocked this setting. Try disabling private browsing.';
}); Put it somewhere a person would look — your privacy page, a footer link, a preferences panel. A control nobody can find is not a control. If you already show a cookie or preferences dialog for other reasons, that is the obvious home for it, even though this script is not why the dialog exists.
What the opt-out does
- Stops the request, not the record. The check runs before the first pageview is sent, so an opted-out browser makes no analytics request at all. You can watch this in a network tab.
- Covers everything. Pageviews, custom events, revenue, engagement, outbound links — all of it goes through the same check.
- Applies immediately. No reload is needed; the flag is re-read before every send.
- Persists for that browser until the visitor opts back in or clears their site data.
What it does not do
Four limits, stated plainly, because a privacy control oversold is worse than none.
- It does not travel. One browser, one device, one profile. Opting out on a phone does nothing for the same person's laptop.
- It does not survive clearing site data, and a private window starts without it.
- It does not apply to other sites. The flag is stored against your origin, so it is your site only. There is deliberately no cross-site opt-out, because a cross-site one would require a cross-site identifier — the exact thing this product refuses to create.
- It does not remove past data. See the question below on that; the short version is that there is nothing individual in the data to remove.
Suggested wording
For your privacy page, adjust to taste. It is written to be accurate about the limits rather than reassuring about them.
We use a privacy-first analytics tool that sets no cookies, stores no IP addresses and cannot identify you or follow you to another website. If you would still rather your visits were not counted, use the switch above. Your choice is stored in this browser only, is never sent to us, and will be forgotten if you clear this site's data.
More on the legal position, and on what you as the site owner still have to do, in privacy and compliance. If what you actually want is to stop counting your own team, that is a different flag — see excluding your own traffic.
Common questions
Do I have to offer an opt-out if there is no consent banner?
The two questions are separate and both answers matter. Consent is not required for this script, because it stores no cookie and collects no personal data — that is the banner question, and it is settled. A right to object is a different thing, and the UK and EU rules on it are written broadly enough that the safe reading is to offer one.
It also costs you about ten lines. We would offer it even where it is not strictly required.
Does the script honour Do Not Track or Global Privacy Control?
No, and it does not check either signal. Some competitors do — Simple Analytics honours Do Not Track by default, which is a genuinely better default than ours and we are not going to describe it as anything else.
The reasoning is that Do Not Track was removed from most browsers after years of being ignored, and a control that silently does nothing in the browsers that dropped it is worse than a control the site owner has visibly built. That is a judgement, not a fact, and you are entitled to disagree with it.
Where is the opt-out stored, and does it reach you?
In the visitor's own browser storage, on your site's origin, and it never leaves the browser. Nothing about it is transmitted — there is no "opted out" record on our side, because a record of who opted out would be exactly the identifier the product refuses to hold.
The consequence follows from that: the choice is per browser and per device, and clearing site data clears it. Say so on your privacy page rather than implying it is permanent.
What happens to data collected before someone opted out?
It stays, and there is no way to remove one person's contribution from it — because there is nothing in it that identifies which contribution was theirs. That is the trade the whole design makes: nothing can be singled out for erasure precisely because nothing was ever singled out for collection. Privacy and compliance covers what an erasure request means here.