Skip to content

Load the Umami tracker only after the page has loaded - #300

Merged
stesee merged 1 commit into
mainfrom
fix/umami-load-after-page-load
Nov 15, 2026
Merged

stesee merged 1 commit into
mainfrom
fix/umami-load-after-page-load

Conversation

@stesee

@stesee stesee commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

When Umami hung on 2026-11-14, pages that load its tracker with defer rendered but never finished loading. A deferred script holds the page's load event until it arrives.

The Docusaurus scripts entry now points at a small static/stats-loader.js. That file adds https://analytics.codeuctivity.cloud/script.js only after load has fired, and it passes the same data-website-id and data-domains through.

I checked a local build with the analytics host made to never respond. With this change the home page reached load in about 0.5 s, and the tracker tag was then added with both attributes. Without it, the page never reached load and timed out.

Trade-off: visitors who leave before the page finishes loading aren't counted.


Generated by Claude Code

A deferred script holds the page's load event until it arrives. When
Umami hung on 2026-11-14, pages rendered but never finished loading.
static/stats-loader.js now adds the tracker after load, so a slow
Umami can't delay the page.
Copilot AI balanced review requested due to automatic review settings November 15, 2026 10:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@stesee
stesee merged commit 6393d18 into main Nov 15, 2026
1 check 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.

2 participants