fix: port analytics review improvements from website PR - #1463
Open
ajbozarth wants to merge 1 commit into
Open
Conversation
The website (mellea-website#72) forked its analytics script from this repo's docs script, then refined it during review. Bring those fixes back: - Restrict analytics to the docs.mellea.ai production host so localhost and the planetf1.github.io preview build no longer report to the prod siteId - Poll for ibmStats instead of a single 100ms wait, so the initial pageview isn't dropped on a cold cache - Track pushState/replaceState navigations so non-Chromium browsers record in-app page views, not just the entry page - Remove dead script.defer on the dynamically injected script tag Assisted-by: Claude Code Signed-off-by: Alex Bozarth <ajbozart@us.ibm.com>
markstur
approved these changes
Jul 28, 2026
markstur
left a comment
Contributor
There was a problem hiding this comment.
LGTM
Verdict: ✅ Faithful port — The PR correctly adapts the mellea-website fixes:
- Host check properly changed from mellea.ai → docs.mellea.ai (correct for this repo's deployment)
- Polling logic is byte-for-byte identical
- History API fallback is identical
- script.defer removal is included
The only difference is the production hostname, which is correct since this repo's docs deploy to docs.mellea.ai, not mellea.ai.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Fixes #
Description
The website analytics script (mellea-website#72) was forked from this repo's docs analytics script, then refined during review. This ports those improvements back:
docs.mellea.ai. Previously it ran everywhere exceptlocalhost/127.0.0.1, so theplanetf1.github.iofork/preview build reported to the prodsiteId.ibmStatsinstead of a single 100ms wait, so the initial pageview isn't dropped on a cold cache.pushState/replaceStatenavigations so non-Chromium browsers (Firefox/Safari, which lack the Navigation API) record in-app page views, not just the entry page. Docusaurus is a client-side SPA, so this was previously losing nearly all navigation events on those browsers.script.deferon the dynamically injected script tag (no effect on injected scripts).The website PR's basePath fix does not apply here — the config already loads the script via
${BASE_URL}analytics.js.Testing
Client-side analytics script; no automated test coverage. Verified the host gate,
ibmStatspoll, and history-patching logic by inspection against the reviewed website script.Attribution