Repository navigation
Fathom: correct page attribution, track production only - #279
Conversation
With canonical: true, the script read the path from the canonical link when the router called pushState, before Nuxt had updated it. Every client-side page view, and every departure ping, went to the page the visitor had just left. Each page sets its canonical to its own path, so reading location instead loses nothing. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RE7Gq8fzzVAfBahzvcUqTP
The plugin loads on previews and local runs too. With canonical: true they had reported as production, since WEBSITE_URL names production there. Without it they would report their own hostnames into the same site. includedDomains makes the script send nothing elsewhere. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RE7Gq8fzzVAfBahzvcUqTP
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RE7Gq8fzzVAfBahzvcUqTP
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🟢 Approval recommended
No blocking issues remain; production tracking should receive the documented post-deployment check.
No open issues 🎉
What changed in this PR
Corrects Fathom page attribution during Nuxt navigation and limits analytics to production.
Changes:
- Uses the current URL instead of the stale canonical link.
- Restricts tracking to
www.programmier.bar. - Documents verification results and historical analytics limitations.
| File | Description |
|---|---|
nuxt-app/plugins/fathom.client.ts |
Disables canonical attribution and restricts tracked domains. |
docs/dependency-upgrade-plan.md |
Records the diagnosis, verification, and post-deployment check. |
Review effort: Balanced
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2d09f77b02
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Explicit rather than derived from WEBSITE_URL, which is set per environment (localhost in .env.example), so a derived list would track the local runs it is meant to exclude. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RE7Gq8fzzVAfBahzvcUqTP
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RE7Gq8fzzVAfBahzvcUqTP
…o infrastructure-improvements
The bug
Every client-side navigation was recorded as a page view of the previous page. With
canonical: true, our Fathom script reads the path fromlink[rel=canonical]as soon as the router callspushState. At that moment, Nuxt has not updated the head yet.Reproduced in a production build, with every request to the Fathom domain intercepted and answered locally (nothing reached the real analytics):
/podcast/podcast//podcast/podcast/podcast/podcast/meetup/meetup/podcast/meetupDeparture pings (time on page) carried the same stale path. Entry pages were counted correctly. Every page reached by a click was counted under the previous page's name, and the last page of a session never at all. This has been the case since at least the Nuxt 3 migration (2023-02-10), so per-page numbers for in-site navigation are unreliable for that period. The plan's backlog said "counted twice". That was a departure ping followed by a page view, which is correct behaviour.
The changes
canonical: false. The script readslocation, which is already updated whenpushStatefires. Nothing is lost: every page sets its canonical to its own path, and production serveswww.programmier.bar, so the reported hostname is unchanged.includedDomains: ['www.programmier.bar']. The plugin also loads on Vercel previews and local runs, and thereWEBSITE_URLnames production. Withcanonical: true, those visits were reported as production traffic. Without it, they would report under their own hostnames into the same site. Now they send nothing.Verification
localhosttemporarily allowed, all five steps send the correct path, and the script tag carriesdata-included-domains.prettier:checkclean.lint0 errors, 156 warnings (unchanged).test306/306. Ratchet 226. Smoke 18/18.www.programmier.barshould show one page view per navigation.Details are in
docs/dependency-upgrade-plan.md.🤖 Generated with Claude Code
https://claude.ai/code/session_01RE7Gq8fzzVAfBahzvcUqTP