ADR-031: Cookieless Analytics and Privacy Notice
Context
The site is run from Madrid for a mostly EU audience. Spain's LSSI (art. 22.2) requires consent before storing or reading non-essential data on a visitor's device, and the AEPD treats analytics cookies as needing it. The GDPR (art. 13) requires a privacy notice. The site loaded Google Analytics 4 without asking, had no privacy notice, and published the owner's email address in the OpenAPI contract, which the owner does not want public.
Decision
Remove Google Analytics and count page views with the site's own beacon, without cookies or identifiers.
1. No GA4: the loader, its build variable and its CSP hosts are gone.
2. Each page shown sends a `PageView` event to `/api/telemetry`. The server keeps only the canonical page path (or "not found"), the language, a source category for the first page of a visit (direct, search, LinkedIn, GitHub, AI assistant, other; later pages are internal) and a device class from the User-Agent, skips self-declared bots, and logs `page_view`. Amended 2026-10-30: it also keeps a country, worked out from the time zone the browser is set to (Europe/Madrid → Spain) with the tz database's own zone list; the time zone itself is dropped and no IP address is looked up. Nothing ties two page views together.
3. Terraform adds the `page_views_<env>` log-based metric and an Audience dashboard.
4. A bilingual privacy notice at /privacy covers controller, data, purposes, legal bases, retention, processors, browser storage and rights (including the AEPD). It contains no email address.
5. Privacy requests go through the AI concierge: the privacy page opens it with a ready-made request card that is sent without calling the model, so it works even when the AI is unavailable.
6. The OpenAPI contract links to the contact page instead of an email.
Consequences
Benefits:
* No cookie banner and no third-party analytics script.
* Page views sit next to the rest of the telemetry, defined in Terraform.
* Visitors get a complete notice in both languages and a rights channel that works without the model.
Trade-offs:
* Page views only: no unique visitors or sessions, and history starts when the metric is created.
* The country comes from the time zone, not the IP address: it is wrong for someone travelling with their clock at home, and a browser set to UTC counts as unknown.
* Visitors who block the beacon are not counted.
* The concierge is the only published privacy channel, so the `contactChat` flag should stay on. If the site ever sells services, the LSSI would require a published email address.
* The notice is kept by hand and must change with what the site collects.
Alternatives considered
1. GA4 behind a consent banner: Rejected — a banner for every visitor, more third-party script, and incomplete numbers when most decline.
2. A hosted privacy-friendly analytics service: Rejected — another vendor, fee and processor for data the beacon already collects.
3. Counting HTML requests on the server: Rejected — misses client-side navigation and counts bots.
4. A dedicated privacy email alias: Rejected by the owner, who does not want an email published.