#108 · Name the platform, mark the editions, and ask before analytics
- timeline-app
- pull request
Closes #100 and #101. ## #101: edition chips and platform names - **Editor:** the offline HTML file shows an **Offline** chip next to the brand, and the desktop app shows a **Desktop** chip. The website shows no chip. - **Platform:** a new `PLATFORM_NAME` setting (e.g. `timescale.info`) replaces "openchronology" in the header. - It's also the site name in page titles (`timescale.info · OpenChronology`), Open Graph and Twitter previews, the generated preview images, and oEmbed's `provider_name`. - When a name is set, the footer adds "Powered by OpenChronology". - Leaving it empty keeps the current appearance, except that the page title becomes plain "OpenChronology" (it was hard-coded to "OpenChronology · timescale.info"). ## #100: Google Analytics, with consent - **Off by default.** With `GOOGLE_ANALYTICS_ID` empty, nothing changes: no script loads and the CSP allows no Google hosts. - **When set to a GA4 measurement ID:** - The pages' CSP allows `www.googletagmanager.com` for scripts and the GA measurement endpoints for connections. - A banner asks each visitor first. Google's script loads only after **Allow analytics**, with the response's nonce. - GA is configured with Google signals and ad personalization turned off. - The visitor's choice is kept in `localStorage`. **Analytics settings** in the footer asks again; declining after accepting reloads the page so analytics stop. - Embeds and the editor frame never load analytics. - **Validation:** both settings are checked at startup (`server/site.mjs`). An ID that isn't a measurement ID, or a name over 60 characters or containing ` `, stops the server from starting. - **Docs:** `.env.example`, compose and the Debian env file include both settings. The new docs/administration.md section "Name and analytics" covers them, and `legal/PRIVACY.md` describes analytics consent. ## Tests - New unit tests in `test/site.test.mjs` for the name and the ID rules. - `test/next-platform.mjs` runs with both settings, checking: - the header, title, footer and CSP; - in the browser: no request to Google before consent or after **Decline**, the banner again from the footer, the tag loading after **Allow analytics** with signals and ads off, and the choice being remembered. - Passes in Chromium, Firefox and WebKit. - `test/next-postgres.mjs` checks the defaults (no name, no analytics) and passes locally. - The edition chips are checked in the offline test and in the account test's web and desktop parts.
Sources
Open #108 · Name the platform, mark the editions, and ask before analytics in the timeline