Skip to content

feat: add regional Google Analytics for public docs - #254

Merged
hannesrudolph merged 2 commits into
mainfrom
feat/native-ga4
Oct 2, 2026
Merged

hannesrudolph merged 2 commits into
mainfrom
feat/native-ga4

Conversation

@hannesrudolph

@hannesrudolph hannesrudolph commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Adds the approved Google Analytics measurement and regional choices for public documentation on docs.openclaw.ai.

User Impact

Public pageviews, native enhanced events, content/search engagement, copy outcomes and eligible document performance become measurable. A persistent Google Analytics choice controls collection. Private assistant activity remains unmeasured; feedback text never appears in an analytics-observed link. Existing server counts continue separately.

Production defaults off. The first authorized publish verifies the existing Cloudflare router's consent endpoint with the Google gate closed. Activation requires separate approval and an existing R2 shell rebuild.

Why This Change Was Made

The native Google tag owns supported enhanced events; the docs shell owns one pageview per committed initial, PJAX or restored navigation. Campaign/referral attribution and native cross-domain identity are preserved. Pagefind reports filtered public terms and actual rendered result counts, with capped lists marked partial and errors omitting counts.

Regional policy 2026-10-02.v2 uses trusted Cloudflare country metadata, Basic Consent Mode, GPC/DNT overrides, a 180-day live expiry and same-origin denial propagation. Old-policy records require a fresh choice. Withdrawal prevents new denied collection or replay without reloading; already-consented batches may finish delivery. Async outcomes cannot cross private/withdrawn intervals, and document Web Vitals are omitted after eligibility is interrupted.

Workflow changes add only a default-off production variable and an enabled CI artifact. Actions permissions, required checks, deployment queues and upload semantics are preserved. The event matrix and coverage limits are documented in scripts/docs-site/ANALYTICS.md.

Evidence

  • Full Node suite: 274 passed, one optional SDK test skipped. Separate approved-SDK matrix: 57/57 passed with every Google request intercepted.
  • Eight settled public navigations produced eight pageviews; native scroll/outbound/download/form events, attribution and linker/cookie behavior passed.
  • Trusted full-Chromium BFCache proof: retained document and trusted persisted restore; ordinary pageshow adds no view; cached denial and first-ever cached grants remain correctly gated.
  • All-field private chat/feedback/search checks, delayed flush, no-reload withdrawal, async outcome eligibility, active expiry, stale policy, GPC/DNT and storage failures passed.
  • Docs Code CI, CodeQL and workflow shell checks passed on head 3428e455709555df4f94906df205a11e530a5ac5.
  • Bounded 30-page preview and Worker dry-run passed. Light/dark desktop/mobile consent checks passed; enabled shell build, artifact smoke, visual smoke and Chromium/WebKit invitation checks passed in CI.

Structured Codex Autoreview returned no actionable findings for both review groups (implementation and supporting docs/BFCache fixture); the split respects the review bundle size limit. Both patch IDs are unchanged after integration onto current main. CI has passed; coordinated closed-gate publishing approval remains required. Browser transport is not evidence of provider ingestion.

${initSidebarLevels.toString()}
${mountHomeHero.toString()}
${createHomeGlimm.toString()}
const docsAnalytics=(${createDocsAnalytics.toString()})(()=>import(withBase(${JSON.stringify("/assets/" + webVitalsAssetName)})));
@hannesrudolph
hannesrudolph marked this pull request as ready for review October 2, 2026 20:42
@hannesrudolph
hannesrudolph requested a review from a team as a code owner October 2, 2026 20:42
@hannesrudolph
hannesrudolph merged commit 8c82811 into main Oct 2, 2026
6 checks passed
@hannesrudolph
hannesrudolph deleted the feat/native-ga4 branch October 2, 2026 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants