Skip to content

fix(tracking): mount visitor tracker at top of body tree#238

Merged
saitejesh-cyber merged 1 commit into
colaberry:mainfrom
saitejesh-cyber:fix/tracker-mount-top
May 19, 2026
Merged

fix(tracking): mount visitor tracker at top of body tree#238
saitejesh-cyber merged 1 commit into
colaberry:mainfrom
saitejesh-cyber:fix/tracker-mount-top

Conversation

@saitejesh-cyber
Copy link
Copy Markdown
Collaborator

@saitejesh-cyber saitejesh-cyber commented May 19, 2026

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:

<Script src="https://enterprise.colaberry.ai/v1/track.js"
        strategy="afterInteractive"
        data-site="worldoftaxonomy" />

Attribute order also reordered to match the prescribed form.

Behavior

No functional change. next/script de-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

  • Frontend change

Test plan

  • Deploy
  • Verify only one <script src=".../v1/track.js"> is injected (DevTools > Elements, search track.js)
  • Refresh the homepage twice; on the second refresh expect 1 POST to /api/t/event (the pageview) plus heartbeat POSTs every 60 seconds

🤖 Generated with Claude Code

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>
@saitejesh-cyber saitejesh-cyber merged commit 7d0a7bf into colaberry:main May 19, 2026
6 checks 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.

1 participant