Analytics & Consent Mode
Definition
Shrubbery measures aggregate traffic on its public marketing and documentation surfaces using Google Analytics 4 (GA4). Measurement is consent-gated end-to-end via the Sprint 31c cookie banner: analytics_storage is denied by default and flips to granted only when the visitor explicitly ticks the Analytics box.
Avoid: "tracking" (overloaded with advertising); "telemetry" (reserved for product instrumentation if/when it ships).
Role
GA4 answers questions the docs investment otherwise leaves unobservable:
- Which entry routes drive the most traffic?
- What is the search-engine-vs-direct mix on
/docs/*and/api-reference? - Which doc pages have the highest bounce rate (signal: prose is unclear)?
- Geo distribution for prioritising future i18n (NL-BE / FR-BE backlog).
Scope: public surfaces only. GA does not load on authenticated app routes (/dashboard, /accord, /capture, /team, /settings, /onboarding, /org, /api/*). The exclusion is enforced inside the loader via a route-prefix check — the script never reaches those pages, regardless of consent state.
Privacy-honouring defaults:
- IP anonymisation enabled (
anonymize_ip: true). - Google Signals disabled.
- Ad personalisation disabled.
- Data retention set to 14 months (admin-side, applied in GA4 console).
_ga*cookies cleared on revoke.
Lifecycle
Per-page GA execution flow:
consent === null(first visit, no decision) — Consent Mode v2 default-denied. No GA script load. Banner visible.consent.analytics === false(declined) — no GA script load. No measurement.consent.analytics === true(granted) —gtag.jsloads,_ga+_ga_<container>cookies are set, page-view events fire on route change.- Revoke (true → false) —
gtag('consent', 'update', { analytics_storage: 'denied' })flips state,_ga*cookies cleared. No further measurement until re-granted.
Cross-tab consent changes propagate via the storage event + custom shrubbery-consent-change event — flipping consent in one tab updates GA state in every other tab on the same origin.
Related guides
(none yet — see /legal/cookies for the cookie inventory and /legal/privacy for the lawful-basis disclosure)
Last updated: 18 May 2026