Skip to content

site: add self-hosted cookieless analytics (Umami), amend privacy promise - #43

Open
idoco2003 wants to merge 1 commit into
mainfrom
site/self-hosted-analytics
Open

site: add self-hosted cookieless analytics (Umami), amend privacy promise#43
idoco2003 wants to merge 1 commit into
mainfrom
site/self-hosted-analytics

Conversation

@idoco2003

Copy link
Copy Markdown
Contributor

What changed

Adds a self-hosted, cookieless Umami analytics counter to urml.dev, env-gated so it ships dark, and amends every "no analytics" claim in the repo honestly in the same change.

  • src/layouts/Base.astro: Umami tag rendered only when PUBLIC_UMAMI_HOST + PUBLIC_UMAMI_WEBSITE_ID are set at build time. data-domains="urml.dev" keeps deploy previews and localhost out of the data. /admin uses AdminBase and stays untracked.
  • netlify.toml: CSP allowlists https://analytics.urml.dev in script-src and connect-src, explicitly rather than proxied, so the request stays visible in the Network tab. Comment block rewritten to state the amended network property.
  • src/pages/privacy.astro: the load-bearing change. New Analytics section modeled on the digest section (full data flow: what is recorded, IP used for geolocation + daily visit dedup then discarded, no cookies, no cross-site identifier, off state verifiable). Intro, meta description, bullets, and Verify-it-yourself updated to match.
  • Claim sweep: README.md, mkdocs.yml (legacy), src/styles/global.css comment; deleted the stale legacy docs/privacy.md (MkDocs copy of a live page, drift waiting to happen).

Why

Netlify Web Analytics is country-only with flat top-pages counts. Founder wants city-level location and per-page interest data, and picked self-hosted over any third-party analytics company. Umami is the only self-hostable option with city-level geolocation that stays cookieless (GoatCounter tops out at region; Plausible CE needs Postgres + ClickHouse).

Rollout order (honors the privacy page's own Changes clause)

The privacy page promises: changes land in the public repository first, with the reason, before going live. So:

  1. Merge this PR. Site deploys with the amended privacy page live and zero tracking (env vars unset, tag not rendered, allowlist entry unused).
  2. Founder provisions Umami (Railway ~$5/mo one-click template recommended; any Node+Postgres host works) and points analytics.urml.dev (CNAME) at it. Create the urml.dev website in Umami, copy the website ID.
  3. Founder sets PUBLIC_UMAMI_HOST=https://analytics.urml.dev and PUBLIC_UMAMI_WEBSITE_ID=<id> in Netlify and redeploys. Tracking starts only after the amended promise is already public. Optional: name the hosting provider in the privacy page's Analytics section at that point (it currently says "a server we rent and control").

How it was tested

  • npm run build without env vars: no script tag anywhere in dist/; only the privacy page prose mentions the subdomain.
  • npm run build with both env vars: tag present with correct src/id/domains on all public pages; absent from all dist/admin/ pages.
  • After enabling: check devtools on urml.dev (script loads, zero CSP console violations), curl -sI https://urml.dev for the amended CSP header, first visit appears in Umami with city-level location.

Rollback

Revert the merge commit. With env vars unset the site is already analytics-free even without a revert; unsetting them is the instant kill switch.

🤖 Generated with Claude Code

…mise

Netlify Web Analytics tops out at country-level location and flat
top-pages counts. The founder wants city-level detail and per-page
interest data, and chose a self-hosted cookieless counter over any
third-party analytics service.

The tracking tag is env-gated (PUBLIC_UMAMI_HOST and
PUBLIC_UMAMI_WEBSITE_ID): this change ships the amended privacy page
with analytics still dark, honoring the page's own promise that
changes land in the public repo, with the reason, before going live.
Tracking starts only when the Umami instance is provisioned and the
env vars are set on Netlify.

The CSP allowlists analytics.urml.dev explicitly instead of proxying
through this origin, so the request stays visible in any Network tab.
Every other place the repo claimed "no analytics" (README, legacy
MkDocs config, layout and stylesheet comments) moves in the same
commit, and the stale MkDocs privacy page is deleted rather than left
to drift.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Ido Yahalomi <ido@jacob-ai.com>
@netlify

netlify Bot commented Jul 22, 2026

Copy link
Copy Markdown

Deploy Preview for urml-website ready!

Name Link
🔨 Latest commit b6512bc
🔍 Latest deploy log https://app.netlify.com/projects/urml-website/deploys/6a6112a1189ae70008ab330f
😎 Deploy Preview https://deploy-preview-43--urml-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

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