# Cookie consent: shared behaviour spec Version 1, 2026-11-26. Product-neutral: IAPL (`@intecion/ipal-kit`, Payload CMS) implements it in 1.17.0, IAWL (WordPress) follows it in its consent stage. A visitor's choice must read the same in both products, and both pass the same tests (§7). Where the products differ is said in §8. Why each rule exists, and which rules are law, regulator guidance or vendor policy: [dev/consent-compliance-proposal.md](./dev/consent-compliance-proposal.md). "MUST" is a requirement of this spec; "SHOULD" a default a product may let a site change. ## 1. Page delivery 1. The public page HTML MUST be the same for every visitor: nothing in it depends on the consent cookie or on a Global Privacy Control signal. Pages stay cacheable (static, ISR, page cache, CDN). 2. The banner is in that HTML, hidden (`hidden` attribute). A small inline script placed right after it decides **before the first paint**: show it (no current choice) or keep it hidden (a current choice, or GPC honoured). The script reads only the consent cookie and `navigator.globalPrivacyControl`, stores nothing, loads nothing. 3. A click on a banner button before the rest of the page's script is live MUST NOT be lost: the inline script notes it and the full script carries it out. 4. No JavaScript, or a script refused by CSP: the banner stays hidden and nothing tracks (every tag is loaded by script). 5. The server MUST NOT render differently for `Sec-GPC`. An endpoint whose response is per visitor anyway MAY read it. A product that ever varies a cacheable response by it sends `Vary: Sec-GPC` or marks the response private. ## 2. Categories and the record | Category | Meaning | Switchable | |---|---|---| | `necessary` | needed for the site to work (session, security, the consent cookie itself, a theme or language the visitor chose when declared necessary) | no, always on | | `functional` | remembers the visitor's settings (e.g. language cookie) | yes, off by default | | `analytics` | measurement (GA4, Clarity, a statistics visitor id) | yes, off by default | | `marketing` | advertising and remarketing (Google Ads, Meta, LinkedIn, TikTok) | yes, off by default | **Cookie:** name `cookie-consent`; value = the record as JSON, URI-encoded; `Path=/`; `SameSite=Lax`; `Secure` on HTTPS; host-only (no `Domain`); not `HttpOnly` (the browser script reads it); `Max-Age` 15552000 (180 days) for a grant and a refusal alike (SHOULD; a site may change the period). **Record:** ```json { "gpc": false, "id": "a1b2c3d4e5f6a7b8c9d0e1f2", "state": { "necessary": true, "functional": false, "analytics": true, "marketing": false }, "timestamp": "2026-11-26T10:00:00.000Z", "version": 1 } ``` - `id`: 24 lowercase hex characters, random, no personal data; kept across changes of the same visitor's choice. - `version`: the site's policy version (integer ≥ 1). A record with another version counts as **no choice**. - `timestamp`: ISO 8601 UTC of the choice. - `gpc`: was the browser sending Global Privacy Control when the choice was made. Absent in records written before this spec (IAPL before 1.17.0). - A reader takes the **first** cookie of that name, ignores unknown fields, treats a non-boolean category as off and `necessary` as on, and treats an unreadable value as no choice. **Consent log entry** (server side, SHOULD be on): `consentId` (= `id`), `version`, `choices` (the four booleans), creation time. **No IP address, no user agent.** Posted after every choice, fire and forget: a failed post never blocks or breaks the banner. Records are deleted after a retention period (IAPL: 1095 days). ## 3. Consent Mode and other tools | Google signal | From | |---|---| | `ad_storage`, `ad_user_data`, `ad_personalization` | `marketing` | | `analytics_storage` | `analytics` | | `functionality_storage`, `personalization_storage` | `functional` | | `security_storage` | always `granted` | 1. The Consent Mode `default` (the stored choice with GPC applied, else all `denied`; `wait_for_update: 500`) is the first `dataLayer` entry, before any Google tag command; `ads_data_redaction: true` is set with it. 2. Every choice pushes `gtag('consent', 'update', …)` at once. 3. Consent Mode **advanced** (SHOULD be the default): the Google tag loads before a choice with every signal denied. **basic** (option): no request to Google before analytics or marketing is granted. Under GPC (§4) advanced behaves like basic. 4. Other tools load only after their category is granted: Clarity (analytics), Meta Pixel, LinkedIn Insight, TikTok Pixel (marketing). Clarity gets `clarity('consentv2', { ad_Storage, analytics_Storage })` when it loads. 5. Withdrawal (a category on → off): delete that category's cookies on this host and every parent domain, and its listed `localStorage` / `sessionStorage` keys; tell the running tools — `fbq('consent', 'revoke')`, `ttq.revokeConsent()`, `clarity('consent', false)`; a later grant on the same page sends `grant` / `consentv2`. Write the record and post it to the log. ## 4. Global Privacy Control The signal: `Sec-GPC: 1` (only the exact value `1`) and `navigator.globalPrivacyControl === true`. It is read as a refusal of **analytics and marketing** that the visitor did not have to click. `functional` and `necessary` are not its business. Modes (SHOULD default to `honour`): `honour`, `ask`, off. | Stored choice | Signal | `honour` | `ask` | |---|---|---|---| | none | on | no banner (decided before first paint); the reopen button; analytics, marketing off; **no request to any tracker, Google included**; nothing stored | banner shown with the GPC line; nothing sent to any tracker until a choice | | `gpc: true` (made with the signal) | on | stands, also a grant | stands | | `gpc: false` (made without it) granting analytics or marketing | on | both switched off at once without asking: cookies and keys deleted, tools and Google told, record rewritten with `gpc: true`, posted to the log | same | | no `gpc` field (older record) | on | stands until it expires or the visitor changes it | stands | | any | off | stands — the absence of the signal is never consent | stands | - A choice the visitor makes on the site while the signal is on (settings window, or the banner in `ask`) is specific and wins; it is stored with `gpc: true`. - The settings window (and the banner in `ask`) shows one line, e.g. "Your browser sends a Global Privacy Control signal. Analytics and marketing are off. You can turn them on for this site here." - Off: the signal is ignored entirely. - A site MAY publish `/.well-known/gpc.json` = `{ "gpc": true, "lastUpdate": "YYYY-MM-DD" }`. - Do Not Track is not read. ## 5. Equal prominence, in testable terms On the banner's first layer, at 360×640 and at 1280×800: 1. "Accept all" and "Reject" are both `