Skip to content

Sites: GA4 and PostHog on lazarus-xbt.xyz and pool.lazarus-xbt.xyz - #82

Merged
brettridenour merged 2 commits into
mainfrom
site/analytics-ga4-posthog
Oct 19, 2026
Merged

brettridenour merged 2 commits into
mainfrom
site/analytics-ga4-posthog

Conversation

@brettridenour

Copy link
Copy Markdown
Collaborator

Adds Google Analytics 4 and PostHog to the hub and the pool site.

Accounts (Brett owns both)

  • GA4: account "Lazarus Pool" (412466820), property "Lazarus Pool websites" (559554946), one web stream for both hosts, measurement ID G-CFKT50ZPQE. Enhanced measurement on, event retention 14 months, lazarus-xbt.xyz listed under the tag's domains, and Search Console (sc-domain:lazarus-xbt.xyz) linked to the stream.
  • PostHog (US cloud): org "Lazarus", project "Lazarus sites" (625142). Autocapture, web vitals, heatmaps, dead clicks, session replay with every input masked, and replay limited to the two hosts.

One property and one project for both sites: GA4 and PostHog set their cookies on .lazarus-xbt.xyz, so a visit that goes from the hub to the pool counts as one visitor and one session. Reports split by hostname.

Code

  • cloudflare/map-site/public/assets/analytics.js and pool/static/analytics.js, two identical copies. The file does nothing on any host other than lazarus-xbt.xyz and pool.lazarus-xbt.xyz, so the pages.dev previews, the node and local servers don't report.
  • A <script src=".../analytics.js?v=1" defer> tag on every hub page (8 static pages, /map/, and the Worker-rendered pages through shell.js HEAD) and every pool page (the index.html template, miner.html, 404.html). No inline script, so the hub's no-inline rule and the naughtylist test still hold.
  • The hub's CSP (_headers and PAGE_CSP) adds the hosts Google and PostHog document, plus worker-src 'self' blob: data: for replay. The pool site sends no CSP.

Sitemaps

  • Pool: lastmod.py hashes page text with <script> stripped, so no date moves (checked: PASS: 30 sitemap dates match).
  • Hub: dates come from the last git commit that touched a page, so this change would have moved all 10 URLs to today. sitemap-lastmod.mjs now skips commits listed in scripts/lastmod-ignore-revs (the same idea as .git-blame-ignore-revs), and 7ab669d is listed there. Merge with a merge commit, not squash or rebase, or that hash won't be on main and --check will fail.

Tests

Run locally: pool build + indexing.py + lastmod.py + language.mjs, hub test-indexing + sitemap-lastmod --check + test-naughtylist, and MCP tests all pass. New assertions: every sitemap page on both sites carries the tag, and the two analytics.js copies are byte-identical.

🤖 Generated with Claude Code

brettridenour and others added 2 commits October 19, 2026 03:13
Both hosts load one self-hosted file (hub /assets/analytics.js, pool /static/analytics.js,
identical) that starts GA4 (property "Lazarus Pool websites", G-CFKT50ZPQE) and PostHog
(project "Lazarus sites", 625142). One property and one project cover both hosts: their
cookies sit on .lazarus-xbt.xyz, so a hub-to-pool visit is one visitor and one session.
The file does nothing off lazarus-xbt.xyz and pool.lazarus-xbt.xyz (pages.dev previews,
the node, local servers).

The hub's CSP gains the hosts Google and PostHog document (googletagmanager,
google-analytics, analytics.google, *.posthog.com) and worker-src blob: data: for replay.
The pool sends no CSP.

Sitemaps: the pool's lastmod hash already ignores <script>, so its dates hold. The hub dates
pages by git commit, so sitemap-lastmod.mjs now skips commits listed in
scripts/lastmod-ignore-revs; this commit goes there in the next one. Tests check every
sitemap page carries the tag and that the two copies match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7ab669d added a script tag and CSP hosts to every hub page and changed no words, so it is
listed in lastmod-ignore-revs and each page keeps its date.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@brettridenour
brettridenour merged commit 0f6dc9f into main Oct 19, 2026
8 checks passed
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.

1 participant