Skip to content

notes 5 min privacy

note

What a page sets before you answer the cookie banner

The banner is on the screen, nobody has touched it, and the page has already been busy. The question is not what the banner promises. It is what happened in the second before it was drawn.

A load runs in a fixed order. The document arrives with its response headers, the parser reaches the scripts in the head, and somewhere among them is the consent platform, which has to download and run before it can draw anything. Everything that was not told to wait for it has been running in the meantime.

So a visible banner is not evidence that anything is waiting for an answer. It is evidence that one script has finished loading. What the others did is a separate question, and the banner cannot answer it for you.

In the EU the rule is in the ePrivacy Directive rather than the GDPR: storing information on a device, or reading it back, needs consent unless it is strictly necessary for a service the person asked for. It is not specific to cookies. localStorage is storage on the device just as much.

Three ways a page acts before the click #

Set-Cookie on the first response
The server can set cookies on the document itself, before a line of script runs. These are often HttpOnly, which means no script on the page - the consent platform's own included - can see them, let alone hold them back.
Storage written by script
document.cookie, localStorage, sessionStorage and IndexedDB, written by anything that ran before the gate. Analytics and testing libraries tend to assign a visitor identifier the moment they start, because that is the moment they need one.
Requests to other hosts
A pixel, a tag, a font from another company's server. A request needs no cookie to say something: it carries the visitor's IP address, a user agent and as much of the page address as the referrer policy allows, and the server receiving it can answer with cookies on its own domain.

The third is the one a cookie listing misses entirely. A request is the disclosure, whatever it does or does not store afterwards.

Why the gate leaks #

Gating works by making a tag wait: a tag-manager trigger that fires only after consent, a <script type="text/plain"> the consent platform rewrites into a real one after the click, a check in a loader. Each of those holds back exactly the tags routed through it. What gets through is whatever was never routed through it.

  • A script hard-coded in the template, above the consent platform, added before the platform existed and never moved.
  • A tag manager configured tag by tag. The container is one script; each tag inside it has its own trigger and its own consent setting, and one tag left on page view is enough.
  • Embeds. A video, a map or a social post in an iframe loads its own document from its own origin, and nothing in the parent page gates it unless the embed is replaced by a placeholder until the click.
  • Vendor modes that load early by design. Google's Consent Mode in its advanced setup loads the tags straight away and sends cookieless pings while consent is denied; the basic setup holds them back until the visitor chooses. Both are documented behaviour, and they produce very different first seconds.
  • Libraries and fonts from public CDNs. Not tracking by intent, but still a request to another company's server before any choice was made.

Rejecting is the second test, and it fails more quietly than the first. A page that holds the same cookies after Reject as after Accept has a gate that does not close. The reject path is the one nobody clicks in QA.

Reading the first second from outside #

The measurement needs a clean start. An earlier answer is stored on the device, and a page that finds one skips the banner and loads as a returning visitor - which is the one state you are not trying to measure.

  1. Open a private window or a fresh browser profile, so no earlier choice is stored anywhere.
  2. Load the page and leave the banner alone. Do not scroll either: some configurations treat scrolling or a second page view as an answer.
  3. Record what is there - cookies for the page's own domain, the four web stores, and every host the page contacted.
  4. Press Reject, reload, and record again. Then accept in a new private window and record a third time.

The three readings should differ in a particular shape. Before the answer: only what the site cannot work without. After Reject: the same, plus the record of the answer itself. After Accept: everything else. A host in the first column that only belongs in the third is the finding.

what a page script can see before the click - which is not everything
document.cookie.split("; ").map((pair) => pair.split("=")[0]);
Object.keys(localStorage);
[...new Set(performance.getEntriesByType("resource")
  .map((entry) => new URL(entry.name).host))];

Three blind spots come with that console check. document.cookie never shows an HttpOnly cookie, so the cookies a server set on the first response are exactly the ones it hides. Cookies set on another company's domain belong to that domain's jar, not to this page's. And the browser's resource buffer holds 250 entries unless the page raises the limit, so on a heavy page the list of hosts can stop short of the end of the load.

Doing it with the panel #

LoupeKit's Cookies tool reads the browser's own cookie store for the origin, HttpOnly included, which is the one thing a page script cannot do. It asks for that single origin when you press it and hands the access back from the same tool. Developer → Site data lists localStorage, sessionStorage, IndexedDB and Cache Storage beside it, and Storage sizes all of them without reading a value.

Third parties lists every host the page contacted, grouped by origin and then by the company behind it where the tables know it, and Requests draws the same buffer as a waterfall - which is what tells you whether a tracker's request started before or after the consent platform's script finished. Nothing runs until the panel is opened, which is the right property for this job: it reads what the browser recorded rather than changing what the page did.

None of that is a verdict. Which cookies are strictly necessary is a judgement about the service, and a reading can tell you what was set, by whom and when. Whether it was allowed is a lawyer's question.

Written by Ján Turský

Building LoupeKit and other browser tools out of Bratislava, under Apptiary.

tools in this note

SAVE 33% €74.99 €49.99 Lifetime See the offer