feat(analytics): tag cross-site links with UTMs for source attribution#555
Merged
Merged
Conversation
Append a link-decorator to the worker-injected PostHog snippet that stamps outbound links to sibling DataViking properties (dataviking.tech, synthbench.org, traitprint.com) with canonical utm_source/medium/campaign params. Covers the hand-authored static HTML (blog, recommended-models) without per-link edits. Each property is a separate PostHog project on a separate cookie domain, so sessions can't be stitched natively; UTMs let each destination project attribute inbound referrals from its siblings. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaQWhEdJrx2uKvQst7f3fe
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.
What changed
Appends a cross-site link decorator to the PostHog snippet in
site/_worker.js: outbound links to sibling DataViking properties (dataviking.tech,synthbench.org,traitprint.com) getutm_source=synthpanel&utm_medium=referral&utm_campaign=cross-site. Internal, non-sibling, and already-tagged links are left alone.Why
The DataViking properties report to separate PostHog projects on separate cookie domains, so cross-site referrals can't be session-stitched natively. UTM source tags let each destination attribute the referral even when the HTTP referrer is stripped (the common case for cross-origin navigations). Part of the Tier-0 cross-site source-attribution effort.
Type of change
Test plan
<head>only; the decorator runs client-side at DOMContentLoaded. Worker build/deploy is exercised in CI.Semver impact
semver:skip— change is to the marketing-site worker (site/_worker.js), not the publishedsynth_panelPython package.Checklist
ruff check src/ tests/passes — N/A (no Python changed)mypy src/synth_panel/passes — N/A (no Python changed)🤖 Generated with Claude Code
https://claude.ai/code/session_01PTupdVrN9mfou6zYfHqrqX
Generated by Claude Code