Skip to content

feat(site): add Umami analytics - #195

Merged
ryanlewis merged 1 commit into
mainfrom
site/umami
Sep 5, 2026
Merged

ryanlewis merged 1 commit into
mainfrom
site/umami

Conversation

@ryanlewis

Copy link
Copy Markdown
Owner

Adds the Umami tag to every page of the site.

<script defer src="https://arloo-stats.exe.xyz/script.js" data-website-id="ca6a5ba0-17fd-4ec8-94a0-67a3c71e288f"></script>

How

It lives in the shared head.html partial, which baseof.html includes, so the landing page and the docs layout both get it from one edit.

The script URL and website id are params in docs/hugo.toml rather than literals in the layout, so either can change without touching templates. Both must be set for the tag to render — a half-configured site emits nothing rather than a script tag with an empty data-website-id.

The tag is emitted only when hugo.IsProduction. hugo server runs in the development environment, so local previews record no visits.

Verification

Check Result
Production build (hugo --minify --gc) tag on all 6 pages, exactly once each
Tag vs. the one requested byte-for-byte identical
hugo --environment development absent from public/ entirely
Real hugo server, /, /install/, /agents/ 0 occurrences on each
Either param cleared no tag at all, and no empty-attribute tag

Collection itself was not verified from a headless browser — Umami ignores those.

Note

Production is Hugo's default environment, so any plain hugo run reports to the live instance, not only CI. A data-domains allowlist would fix that, but the workflow builds with --baseURL "${PAGES_ORIGIN}${BASE_PATH}/", and if that origin ever resolved to the github.io host rather than the custom domain the allowlist would silently drop all real traffic. Dropping real data is worse than the stray local hit, so it is left off deliberately.

Adds the Umami tag to every page through the shared head partial, which
baseof.html includes, so both the landing page and the docs layout get it.

The script URL and website id are params in docs/hugo.toml rather than
literals in the layout, so either can change without touching templates,
and clearing one turns the tag off rather than emitting a half-filled tag.

Emitted only when hugo.IsProduction, so a local `hugo server` — which
runs in the development environment — does not record visits.
@ryanlewis
ryanlewis merged commit 9792ae2 into main Sep 5, 2026
10 checks passed
@ryanlewis
ryanlewis deleted the site/umami branch September 5, 2026 17:54
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