diff --git a/docs/dev/consent-compliance-proposal.md b/docs/dev/consent-compliance-proposal.md new file mode 100644 index 0000000..23a236c --- /dev/null +++ b/docs/dev/consent-compliance-proposal.md @@ -0,0 +1,549 @@ +# Consent compliance: where the banner stands, Global Privacy Control, and what the plugin enforces + +Design proposal, 2026-11-26. No code is changed by this document. Line numbers refer to local `main` at `2f6a81a` +(1.17.0, unreleased); the branch `claude/consent-banner-first-paint-154f9f` (`177620d`) moves some of them and is +taken as merged for the build plan (§8). + +Owner's direction (2026-11-26): Global Privacy Control should be honoured, and the banner's correct working must be +ensured by the plugin itself, not left to each site's settings. The work is part of 1.17.0. + +**This is an engineering reading of the rules, not legal advice.** Sources were looked up on 2026-11-26 and are cited +in §9 with what could not be verified in §10. Three kinds of rule are kept apart throughout: + +- **LAW**: a statute or a court ruling that binds. +- **GUIDANCE**: what a regulator or the EDPB says it expects. Not binding, but it is how a complaint is judged. +- **VENDOR**: a contract term of Google, Microsoft or Meta. The sanction is losing the product, not a fine. + +## 0. Summary + +1. The banner is sound on the points that are plain law: nothing is pre-ticked, choice is per category, a refusal is + one click on the first layer, the choice is re-asked after 180 days and after a policy change, non-Google tags + load only after consent. +2. Five gaps matter. (a) With the default `consentMode: 'advanced'` the Google tag loads and sends pings before + consent; under the EDPB's reading of the ePrivacy rule that needs consent. (b) "Reject" looks weaker than + "Accept all" unless a site sets `equalChoice`. (c) Withdrawing consent does not stop tags that already run on the + page and does not clear browser storage keys. (d) The default text lacks a sentence Polish law asks for + (settings in the browser). (e) Microsoft Clarity never receives a consent signal on a site without GA4 / GTM. +3. Global Privacy Control has no binding force in the EU today. It is still the only browser signal with a + specification and growing browser support, and both EU drafts under negotiation point to "do not ask again after + a refusal". The design treats it as a refusal of analytics and marketing that the visitor did not have to click: + no banner, no tracker request (also not Google's), and an explicit choice in the settings window still wins. + Everything is decided in the browser before the first paint, so pages stay static and no `Vary` is needed. +4. "Enforced by the plugin" becomes: four defaults that need no project setting (GPC honoured, equal choice, nothing + to Google before consent, withdrawal that really stops), each with an opt-out; doctor rules and a browser check + that fail loudly; and the consent log, which stays an option in 1.17.0 because turning it on adds a table. +5. The first cut needs **no schema change and no migration** on any site (§6). +6. IAB TCF and a Google-certified CMP are not needed by any site that only measures and advertises. They are needed + only by a site that *shows* ads through AdSense, Ad Manager or AdMob (§5). + +## 1. Where the banner stands against the rules + +### 1.1 The rules in one paragraph each + +- **Poland, LAW.** Prawo komunikacji elektronicznej (PKE), art. 399: storing information on a visitor's device, or + reading it, needs (1) clear prior information about the purpose *and about the possibility of setting the conditions + in software settings*, (2) consent, (3) no change to the device's configuration. Art. 399 ust. 3 exempts what is + necessary for transmission or for a service the visitor asked for. Art. 400: GDPR's consent rules apply. Art. 399 + ust. 2 still says consent can be given through software settings; because art. 400 imports GDPR consent (an active, + informed act), a browser's default settings are not safe to rely on. Supervision of art. 399: Prezes UKE, fines up + to 3% of revenue (art. 444, 446). The personal data processed afterwards: Prezes UODO under GDPR. +- **EU, LAW.** GDPR art. 4(11), 7 (consent: freely given, specific, informed, unambiguous; demonstrable; withdrawal + as easy as giving), art. 13 (information), art. 21 (objection). CJEU C-673/17 *Planet49*: a pre-ticked box is not + consent; the visitor must be told how long cookies last and whether third parties get access. +- **EU, GUIDANCE.** EDPB Guidelines 05/2020 on consent; the EDPB Cookie Banner Taskforce report (2023), a minimum + common position of the authorities; EDPB Guidelines 2/2023 on the technical scope of ePrivacy art. 5(3) (2024), + which put script-instructed requests, pixels and tracked URLs in scope whether or not a cookie is involved. UODO + has published an article (Biuletyn, 2025-03-31) that repeats the EDPB positions; no formal UODO banner guidelines + and no UODO or UKE fine for a banner were found. +- **VENDOR.** Google's EU user consent policy (consent before Google tags use storage or personal data for ads, + records of consent, clear way to revoke, each party named) and Consent Mode v2 (signals required for EEA traffic); + Microsoft Clarity and UET (a consent signal is enforced for EEA / UK / Swiss visits); Meta Business Tools Terms + s.3.d (consent, verifiably, before the Pixel is used). + +### 1.2 Requirement → today → gap + +| # | Requirement | Kind | What the plugin does today | Gap | +|---|---|---|---|---| +| 1 | No non-essential **storage** before consent | LAW (PKE 399; Taskforce ¶7) | Non-Google pixels load only when their category is granted (`src/modules/analytics/Analytics.tsx:181-188`). Google starts with every signal `denied` (`src/modules/consent/googleConsent.ts:45-50`, called before the tag at `Analytics.tsx:154-159`). `ConsentScript` gates other scripts (`src/modules/consent/ConsentScript.tsx:72-76`). Language cookie only with functional consent (`src/modules/i18n/localeMiddleware.ts:104-109`). Visitor id only with analytics consent (`src/modules/stats/PageStats.tsx:71`). | None in the plugin's own code. A project can still add a tag by hand; the browser check and the crawl catch it (`scanner/crawl/violations.ts:61-65`). | +| 2 | No non-essential **requests** before consent | GUIDANCE (EDPB 2/2023 ¶33, 51, 53: a script that makes the browser send information is "gaining access"). No authority has ruled on Consent Mode by name. | Default `consentMode = 'advanced'` (`Analytics.tsx:135`, `shouldLoadGoogle.ts:22`): `googletagmanager.com` loads at once and sends cookieless pings (timestamp, user agent, referrer, consent state, a random number per page load; the IP address travels with every request). `'basic'` sends nothing to Google before consent. The crawl treats Google's hosts as allowed in `advanced` (`violations.ts:66`). | **Yes.** The default is the risky one. → §3.2 item B. | +| 3 | Refusing as easy as accepting, on the first layer | GUIDANCE (Taskforce ¶8: an infringement for "a vast majority" of authorities; CNIL: accept and refuse at the same level). Colour and contrast: case by case (Taskforce ¶15-19). | "Reject" is on the first layer by default and is one click (`CookieBanner.tsx:197`, `:251`). It is styled as the secondary (text-only) button unless `equalChoice` is set (`CookieBanner.tsx:203`, `:244`). A project can drop it with `order`. | **Yes**, in the default look and in the unguarded `order`. → §3.2 item C. | +| 4 | No pre-ticked choices | LAW (*Planet49*) | All optional categories start `false` (`categories.ts:11-16`); the settings controls show that state (`CookieBanner.tsx:212`, `:274`). No consent by scrolling, closing or continuing. | None. | +| 5 | Granular choice per purpose | LAW (GDPR 4(11) "specific"; EDPB 05/2020 ¶42-44) | Four categories, each switchable, "Save" in the settings view (`CookieBanner.tsx:387-401`). | None. Purposes are per category, not per vendor; no rule found that requires per-vendor switches outside TCF. | +| 6 | Withdrawal as easy as giving, and it stops the processing | LAW (GDPR 7(3)) | `CookieButton` reopens the banner at any time (`CookieButton.tsx:36-66`). On a category going from on to off the listed cookies are deleted, also on parent domains (`useConsent.ts:46-51`, `:96-103`), and Google gets the update (`:115`). | **Yes, three parts.** (1) Pixels already running keep running until the next page load (`ConsentScript.tsx:56-59`, `docs/analytics.md:158-160`); Meta, Clarity and TikTok have revoke calls that are not used. (2) Only cookies are deleted, not `localStorage` / `sessionStorage` keys, although the cookie list knows their type (`texts.ts:4`). (3) A site can pass `cookieButton={false}` and leave no way back. → item D, checks. | +| 7 | Consent is re-asked after a period | GUIDANCE (CNIL, DPC, Garante: about 6 months; AEPD: at most 24; EDPB: "appropriate intervals"). No Polish figure. | Consent cookie lives 180 days (`storage.ts:15`), a refusal equally; a new *Consent version* asks again (`storage.ts:47`). | None on the period (it is a constant, not an option). Not verified: browsers that cap script-written cookies (Safari, 7 days) would ask weekly (§10). | +| 8 | Proof of consent | LAW that it must be demonstrable (GDPR 7(1)); **how** is free (EDPB 05/2020 ¶104-108). VENDOR: Google asks for records (text shown, choices, time). | Cookie holds id, choices, policy version, time (`storage.ts:17-23`). Optional log `consent-records` with id, version, choices, time, no IP and no user agent (`consentLog.ts:56-65`, `:101-109`); off unless `consentLog` is set (`plugin.ts:782`). | **Partly.** No source requires a per-visitor server log; CNIL and the German DSK accept documented versions of the banner and its texts. What is missing either way: a kept copy of the *text shown* per policy version. The log is off on sites that never turned it on. → item E. | +| 9 | Information before the choice: purposes, who receives data, how long, how to change one's mind | LAW (PKE 399 ust. 1 pkt 1; GDPR 13; *Planet49*) | First layer: one general sentence and a privacy-policy link when the system page is set (`getConsentTexts.ts:39-40`, `:72-73`, `:175-191`). Second layer in `settings="detailed"`: cookies per category with provider, purpose, duration (`CookieBanner.tsx:308-355`). | **Yes.** (1) The default text does not say that conditions can also be set in the browser (PKE 399 ust. 1 pkt 1 lit. b) nor how to withdraw. (2) Providers and durations are visible in the banner only in `detailed`; the default is `inline` (`CookieBanner.tsx:206`). (3) `privacyLink` is `null` when the page is not set. → item F, checks. | +| 10 | The cookie list is kept true; "necessary" is justified | GUIDANCE (Taskforce ¶26-30: the site must be able to show why a cookie is essential) | Cookie scanner, one approval, scheduled crawl with violations and e-mail (`docs/cookie-scanner.md`); doctor fails when the scanner is off (`doctor/rules/security.ts:260-268`). | Small: a raised cookie list does not raise the *Consent version* by itself; the editor must (`docs/consent.md:385-387`). → check. | +| 11 | Embedded third-party content (video, maps) | GUIDANCE (CNIL FAQ: consent when the visitor activates it; DSK: no legitimate interest where the provider uses data itself). EDPB 2/2023 treats local storage like cookies. | `YouTubeEmbed`: poster and play button, the player (`youtube-nocookie.com`) loads on click (`src/modules/storage/YouTubeEmbed.tsx:33-45`). No map component. | **Small.** (1) Without an uploaded poster the thumbnail comes from `i.ytimg.com` at page load (`YouTubeEmbed.tsx:48`): a request to Google before any choice. (2) The text that playing contacts YouTube is optional (`note`). (3) The click is not recorded as a consent and is not tied to a category. → item G. | +| 12 | Fonts | COURT, Germany, first instance (LG München I, 3 O 17493/20): loading Google Fonts from Google sent the IP without a basis | The starter uses `next/font/google`, which downloads at build and serves from the site (`starter/generate.ts:214`). The plugin loads no font. | None. A check for a `fonts.googleapis.com` / `fonts.gstatic.com` request is worth adding to the crawl's host list. | +| 13 | Consent signals to vendors | VENDOR | Google: seven signals mapped from the categories (`googleConsent.ts:6-17`), default then update. Clarity, Meta, LinkedIn, TikTok: loaded after consent, **no signal sent** (`analytics/pixels.ts:19-55`). | **Yes for Clarity.** Clarity needs a signal for EEA visits; it reads Google's automatically, but the Google default is pushed only when GA4 or GTM is configured (`Analytics.tsx:156`). A site with Clarity and no Google tag runs Clarity cookieless forever. `ads_data_redaction` is not set. UET is not a plugin integration (through GTM only). → item D. | +| 14 | Global Privacy Control | No EU duty today (§2.2) | Not read. `docs/consent.md:407` says it is not needed. | → §2. | +| 15 | No tracking the visitor cannot see | LAW (GDPR 5, 13) | Built-in statistics count a visit without storage and without consent through a daily-salted hash, no IP or user agent kept (`stats/collection.ts:10-14`). | None found. Whether this counts as "access" under EDPB 2/2023 is arguable; both EU drafts exempt first-party aggregate audience measurement. Named here so it is a known position. | + +## 2. Global Privacy Control + +### 2.1 What the signal is + +- A browser setting that says: do not sell or share my personal data with third parties. W3C Working Draft (Privacy + Working Group, latest 2026-09-24), not yet a standard. +- **Request header** `Sec-GPC: 1` on HTTP requests. The only valid value is `1`; absence means "no preference", there + is no "off" value. It is a `Sec-` header, so page script cannot forge it. +- **Script property** `navigator.globalPrivacyControl`: `true` when the header would be sent, `false` otherwise, + `undefined` in browsers without support. Only `=== true` counts. +- **Site statement** `/.well-known/gpc.json`: `{ "gpc": true, "lastUpdate": "" }` says the site intends to + honour the signal. +- **Who sends it:** Brave and DuckDuckGo by default; Firefox as a setting and by default in private windows; + extensions for Chrome and Edge. Chrome and Safari are adding a setting (California requires browsers to offer one + from January 2027). No reliable share of traffic is published. +- Do Not Track is not read: the W3C work was closed in 2019 and Firefox removed the setting in 2025. One caution: a + Berlin court (LG Berlin, 16 O 420/19, 2023, not final) held that a DNT signal is a valid objection, so a site + should never *state* that it ignores browser signals. + +### 2.2 Legal weight + +- **Outside the EU: binding.** California (11 CCR §7025) and eleven more US states require honouring it as an opt-out + of sale, sharing and targeted advertising; fines have been imposed (Sephora 2022 and later cases). A specific + consent given to the site after the signal may prevail. +- **In the EU: not binding as such.** No regulator has said GPC must be honoured. The hooks are GDPR art. 21(5) + (objection "by automated means using technical specifications") and art. 7(3) (withdrawal). The specification's + own explainer says no European regulator has made that case yet. +- **Coming, not settled.** The Commission's Digital Omnibus (COM(2025) 837) proposed a duty to respect + machine-readable signals (new GDPR art. 88b) and no new request for six months after a refusal. The Council's + mandate of 2026-10-21 drops the signal duty and keeps "no new request for at least four months" and one-click + refusal. Parliament has no position; nothing is adopted. Earliest effect: 2028 or later. +- **Practical meaning for an EU site today:** optional categories are already off until opt-in, so GPC changes + nothing about storage. What it can change is (a) whether the visitor is asked at all, (b) whether anything is sent + to a third party before a choice, (c) what happens to an earlier consent when the signal appears. + +### 2.3 Design + +One rule: **GPC is a refusal of analytics and marketing that the visitor did not have to click. A choice the +visitor makes on this site while the signal is on is specific and wins.** + +**Modes** (one setting, default `'honour'`): + +| Mode | With GPC and no stored choice | Use | +|---|---|---| +| `'honour'` (default) | No banner. Analytics and marketing off. No tracker request, also not to Google in `advanced`. The cookie button is shown; the settings window explains the signal. | The default for every site. | +| `'ask'` | The banner is shown as usual. Until a choice is made nothing is sent to any tracker, also not to Google in `advanced`. | A site that wants to keep asking. | +| `false` | The signal is ignored (today's behaviour). | Opt-out. Doctor reports it. | + +**What it sets.** + +- Categories: `analytics` = off, `marketing` = off. `functional` is not touched by the signal (it is not sharing); + with no stored choice it is off anyway, as for everyone. `necessary` stays on. +- Consent Mode: `ad_storage`, `ad_user_data`, `ad_personalization`, `analytics_storage` = `denied` (the default + already). In addition the Google tag is **not loaded** while the signal applies, whatever `consentMode` says: + `shouldLoadGoogle` gets the signal as an input. `ads_data_redaction` is set to `true`. +- Clarity, Meta, LinkedIn, TikTok, `ConsentScript`: not loaded (they follow the categories). +- Built-in statistics: the cookieless count continues (first party, nothing shared, nothing stored). The visitor id + cookie is not set. +- Nothing is written for a visitor who only sends the signal: no consent cookie, no log record. The state is + derived from the signal on every page. + +**Interaction with an explicit choice.** The stored record gets one new field, `gpc`: was the signal on when the +choice was made. + +| Stored choice | Signal now | Result | +|---|---|---| +| none | on | Mode `'honour'`: as above. | +| made with the signal on (`gpc: true`) | on | The stored choice stands, also when it grants analytics or marketing: the visitor chose this for this site while the signal was on. | +| made with the signal off (`gpc: false`) | on | The signal is newer than the choice: analytics and marketing are switched off, their cookies and storage keys deleted as on a withdrawal, the record rewritten with those two off and `gpc: true`. The visitor can grant again in the settings window. | +| made before this version (no `gpc` field) | on | The stored choice stands until it expires or the visitor changes it. We cannot know which came first, and a silent withdrawal on upgrade day would be the larger surprise. | +| any | off | The stored choice stands. The absence of the signal is never consent. | + +"Accept all" on the first layer is not offered to a `'honour'` visitor, because the first layer is not shown. In the +settings window, opened from the cookie button, the visitor switches categories and saves; that is the explicit, +informed choice. In `'ask'` mode "Accept all" works as usual and the record carries `gpc: true`. + +**What the visitor sees.** Mode `'honour'`: no banner; the cookie button; in the settings window, above the +categories, one line (PL / EN defaults in code, overridable through `texts`): *"Twoja przeglądarka wysyła sygnał +Global Privacy Control. Analityka i marketing są wyłączone. Możesz je włączyć dla tej witryny poniżej."* / *"Your +browser sends a Global Privacy Control signal. Analytics and marketing are off. You can turn them on for this site +below."* The same line appears in the banner in `'ask'` mode. + +**What the consent log records.** In 1.17.0 nothing changes in the log's shape (a new field is a column, §6). The +cookie record carries `gpc`; the request to the log may carry it and the endpoint ignores it. A later release that +carries a migration adds `gpc` and `source` (`banner` / `settings` / `gpc`) to the log. + +**Server and browser.** + +- **Browser, the default path.** The pre-paint script of the first-paint branch (`consentBannerScript`) also reads + `navigator.globalPrivacyControl`: signal on and no stored choice → the banner stays hidden. The consent store adds + the signal to its snapshot, so `useConsent` returns the effective state and `gpc: boolean`. The page HTML is the + same for every visitor. +- **Server, only where a response is already per visitor.** A helper `gpcFromHeaders(headers)` is exported. The + statistics endpoint uses it: a visitor id is not accepted when `Sec-GPC: 1` arrives with a stored choice that has + `gpc: false`. The consent log endpoint may use it later to record the signal as the server saw it. The optional + server-read mode of the first-paint branch (`consentCookie`) passes the header along, at the price that mode + already has. +- **Not in the proxy, not in a layout.** Reading the header while rendering a page makes the page dynamic and ends + ISR. Varying a cached page on it needs `Vary: Sec-GPC`, which doubles the variants where the CDN supports `Vary` + and is ignored or refused where it does not (Cloudflare needs a cache rule per header; Google's CDN refuses to + cache such a response). So the rule is: **the server never renders differently for GPC.** A project that does so + in its own code must send `Vary: Sec-GPC` or mark the response private; the docs say so. +- **`/.well-known/gpc.json`.** An exported route handler (`gpcWellKnown()`), added to new sites by the starter. Not + forced into the proxy: a project's matcher usually skips paths with a dot, and a public statement is the site + owner's call. + +**Tests** (also §4.6): the store with the signal in every row of the table above; the pre-paint script with and +without the property; `shouldLoadGoogle` with the signal in both modes; no network request to any tracker host with +the signal on; the stale-consent row deletes cookies and sends a Consent Mode update; a browser run with +`Sec-GPC: 1` and the property defined (Chromium through an init script, Firefox through its preference); the built +site keeps `s-maxage` and sends no `Vary` on `Sec-GPC`. + +## 3. "Enforced by the plugin" + +### 3.1 Three levels + +- **Default**: works with no project setting; a project that wants otherwise sets an option (main rule: the opt-out + always exists). +- **Check**: something the plugin cannot decide for a project, reported loudly by `iapl-doctor`, by the browser + check (`iapl-consent-check`), by the crawl, or in the development console. +- **Option**: stays the project's choice. + +### 3.2 Defaults + +Each item: opt-out, then what changes on the eight live sites after upgrade. "Sites that already set it" see nothing. + +**A. GPC honoured** (new). Opt-out: `gpc: false` or `gpc: 'ask'` on `ConsentProvider` / `SiteProviders`. +- Visitor: before → a visitor whose browser sends GPC saw the banner like everyone. After → no banner, cookie + button only; settings window explains. +- Analytics: those visitors can no longer click "Accept all" on a first layer, so fewer of them are measured; in + `advanced` the site also stops sending their cookieless pings. Share of visitors: unknown, today mostly Brave, + DuckDuckGo and Firefox private windows. +- Schema: none. + +**B. Nothing to Google before consent** (`consentMode` default `'advanced'` → `'basic'`). Opt-out: +`consentMode: 'advanced'` (and the same value in `cookieScanner.crawl.consentMode`, or the crawl reports Google's +hosts as violations). +- Visitor: no change. +- Analytics: before → Google received cookieless pings from visitors who had not decided or had refused, and could + model them. After → nothing reaches Google until analytics or marketing is granted. GA4's modelling needs about + 1,000 denied events a day for a week, Google Ads' own model 700 ad clicks a week per country, so a small site + loses little or nothing; Google Ads then uses its general model. +- Schema: none. + +**C. Equal choice** (`equalChoice` default `false` → `true`). Opt-out: `equalChoice={false}` or a `rejectButton` +class. +- Visitor: before → "Reject" was plain text next to a filled "Accept all". After → both are filled buttons of the + same look. +- Analytics: fewer visitors accept. The size cannot be given honestly; published comparisons vary widely. +- Schema: none. + +**D. Withdrawal and signals that really work** (fixes, no setting). +- On a category going off: `fbq('consent','revoke')`, `clarity('consent', false)`, `ttq.revokeConsent()` where the + tool is loaded; storage keys of that category from the cookie list are removed like cookies. +- After a tool loads with consent: `clarity('consentv2', …)`; the Consent Mode default is pushed on every site, not + only with GA4 / GTM; `ads_data_redaction` when marketing is denied. +- Visitor: no change. Analytics: Clarity sessions hold together after consent on sites without a Google tag (they + did not before); a visitor who withdraws stops being measured at once, not at the next page. +- Opt-out: `revoke={false}` on `Analytics` for a project that handles it itself. Schema: none. + +**E. Consent log** stays an **option** in 1.17.0. +- Turning it on by default adds the `consent-records` collection: a new table on Postgres, so a migration on every + site that never had it. That breaks "no migration in 1.17.0". +- No source requires a per-visitor log (§1.2 row 8). New sites get it from the starter already. +- Instead: doctor warns when the log is off while a tool is configured; the default flips in the first release that + carries a migration anyway (or 2.0). + +**F. Default text** (the fallback used when the panel field is empty). Opt-out: the editor's own text in the panel +always wins. +- Visitor: before → "…You can accept all, reject non-essential, or choose which to allow." After → the same plus: + "You can change your choice at any time with the cookie button, and set cookie rules in your browser too." (PL: + "Wybór można zmienić w każdej chwili przyciskiem cookies, a zasady dla plików cookies ustawić także w + przeglądarce.") +- A site with its own text in the panel keeps it; doctor (deep mode) notes when that text has no such sentence. +- Analytics: none. Schema: none (constants in code, no new panel field). + +**G. YouTube thumbnail** stays an **option** for existing sites. +- Changing the default (no thumbnail from `i.ytimg.com`) would replace video previews with an empty frame on live + pages. New sites: the block asks for an uploaded poster; `note` gets a default text. Existing sites: the browser + check and the crawl report the request as a warning. + +**H. Re-ask period** stays 180 days for consent and refusal; becomes an option (`maxAgeDays`) so a project can +shorten or, with a reason, lengthen it. No change on any site. + +### 3.3 Checks that fail loudly + +| Check | Where | Severity in 1.17.0 | +|---|---|---| +| `equalChoice={false}`, or `order` without `'reject'` | doctor (layout rule); development console warning from `CookieBanner` | warning | +| `consentMode: 'advanced'` | doctor: info, asks for the decision in `AGENTS.md` → Project decisions | info | +| `gpc: false` | doctor | warning | +| `cookieButton={false}` with no other call to `reopen` | doctor | warning | +| A hand-made banner (no `data-ipal="banner"`) | browser check (exists) | error | +| Consent log off while a tool ID is set | doctor (deep mode reads Site integrations) | warning | +| Privacy policy page not set (banner has no link) | doctor (deep mode) | warning | +| Cookie list empty while a tool ID is set; cookies waiting for approval | doctor (exists for waiting cookies) | warning | +| Crawl `consentMode` differs from the layout's | doctor | warning | +| Tracker request or non-necessary storage before consent, after "Reject", or with GPC | browser check, crawl (`violations.ts`) | error | +| Request to `i.ytimg.com`, `fonts.googleapis.com`, `fonts.gstatic.com`, `maps.googleapis.com` before a choice | browser check, crawl host list | warning | +| "Reject" not equally prominent (§4.4) | browser check | error | +| Withdrawal leaves a listed cookie or key | browser check | error | + +Start-up warnings (`onInit`) can only see plugin options, not the layout's props, so the layout checks live in +doctor and in the browser check. Warnings, not errors, in 1.17.0: an upgrade must not turn a green doctor red on a +site whose owner made a choice. Raising some to errors is a 2.0 question. + +### 3.4 What stays an option + +Banner layout and classes, button order (with the check), `settings` mode, category texts, policy version, +`cookieMap`, `ConsentScript`, `defer`, the consent log and its retention, the scanner and crawl, `consentMode`, the +GPC mode, the `gpc.json` route. + +### 3.5 Release shape + +- The owner has placed this work in **1.17.0** (a minor, not yet released). Items A, B, C and F change what a site + does after upgrade, which a patch must never do; a minor may, with "what changes on upgrade" at the top of the + changelog and one line of opt-out each. +- Nothing here needs 2.0. Kept for the first release with a migration, or 2.0: the consent log on by default and + its `gpc` / `source` fields, a kept copy of the text shown per policy version, panel fields for the GPC line and + the re-ask period, doctor warnings raised to errors. + +## 4. What IAPL and IAWL share: the behaviour spec + +Product-neutral. IAWL's five asks (`docs/notes/consent-for-iapl.md` there) are answered in 4.1 to 4.6. The spec +needs no server round trip per page and no per-visitor HTML: a static page plus a decision made in the browser +before the first paint. + +### 4.1 Categories and the record (ask 1) + +- Categories, fixed names: `necessary` (always on), `functional`, `analytics`, `marketing`. +- Record, JSON: `{ "id": string, "state": { "necessary": true, "functional": bool, "analytics": bool, "marketing": + bool }, "timestamp": ISO 8601 UTC, "version": integer ≥ 1, "gpc": bool }`. + - `id`: 24 hex characters, random, no personal data; the same id in the consent log. + - `version`: the site's policy version; a record with another version counts as no choice. + - `gpc`: the signal's state when the choice was made; absent in records written before this spec. + - A reader ignores unknown fields and treats a non-boolean category as off. +- Consent log entry (optional): `consentId`, `version`, `choices` (the four booleans), creation time. No IP, no user + agent. Later: `gpc`, `source`. + +### 4.2 Consent Mode mapping + +| Signal | From | +|---|---| +| `ad_storage`, `ad_user_data`, `ad_personalization` | `marketing` | +| `analytics_storage` | `analytics` | +| `functionality_storage`, `personalization_storage` | `functional` | +| `security_storage` | always `granted` | + +Default (all optional `denied`, `wait_for_update: 500`) is the first entry, before any tag; an update follows every +choice. Default mode: no Google request before analytics or marketing is granted. Other tools: loaded only with +their category (Clarity: analytics; Meta, LinkedIn, TikTok: marketing), told on grant and on withdrawal where they +have a call for it. + +### 4.3 GPC (ask 2) + +As §2.3: browser property read before the first paint; header read only by endpoints that are per visitor already; +categories `analytics` and `marketing`; the table of stored choice × signal; modes `honour` / `ask` / off with +`honour` the default; one line of text that says the signal was honoured; nothing stored for a visitor who only +sends the signal; the server never renders a page differently for the signal. In IAWL the opt-out is a code +constant, in IAPL a prop. + +### 4.4 Cookie and re-ask period (ask 3) + +- Name `cookie-consent`; value: the record, 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. +- Re-ask: when the cookie is gone, when `version` differs, never otherwise. Reopening is always possible. +- On a category going off: delete that category's cookies (host and parent domains) and storage keys, tell the + tools, write the record. + +### 4.5 Equal prominence, in testable terms (ask 4) + +On the first layer, at 360×640 and 1280×800: + +1. "Accept all" and "Reject" are both `