fix(tracking): mount visitor tracker at top of body tree#238
Merged
saitejesh-cyber merged 1 commit intoMay 19, 2026
Merged
Conversation
Move <Script> to the first child of <body>, ahead of <Providers>, so the snippet sits at the very top of the layout subtree (matches Colaberry tracker install guidance verbatim). Attribute order also reordered to match the prescribed snippet. No runtime behavior change: next/script de-dupes injection regardless of JSX position; this aligns placement with the install doc so future audits do not re-flag it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Move the Colaberry visitor
<Script>to the first child of<body>(ahead of<Providers>) so the snippet is mounted at the very top of the layout subtree, exactly matching the install snippet from the Colaberry tracker install email:Attribute order also reordered to match the prescribed form.
Behavior
No functional change.
next/scriptde-dupes injection regardless of JSX position, and the script was already mounted exactly once via the root layout (verified live:grep -c "track.js"on the rendered HTML returns 1; a headless Playwright capture of two full page loads showed exactly one pageview POST per load). This PR only aligns the placement with the install doc so future audits don't re-flag it.Type
Test plan
<script src=".../v1/track.js">is injected (DevTools > Elements, searchtrack.js)/api/t/event(the pageview) plus heartbeat POSTs every 60 seconds🤖 Generated with Claude Code