feat(website): count a visit from a tagged link, by channel - #1157
Merged
Merged
Conversation
The agents in 999-multibots-telegraf now publish blog links tagged per channel (render utm.ts: https://t27.ai/?utm_source=x&utm_campaign=blog &utm_content=<slug>#/blog/<slug>). A tag counts nothing by itself: the link lands here, and here nothing read it, so blog traffic stayed invisible. - src/lib/trafficArrival.ts: on load, the utm tags of the page's own query (before the #, where HashRouter leaves them) are reported once per browser session to render's /api/traffic/arrival, which keeps a count per (day, channel) and nothing personal. No tags, no call; a failure never reaches the page. - main.tsx: called at the entry, except for a page on its way to another address (the legacy Queen redirect). - qa/traffic-arrival-contract.mjs (`check:traffic-arrival`): 9 checks, including that a query written after the # is not read. Mutation: the once-per-session guard removed -> the contract fails. tsc --strict on the module: clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FJktaYxNrfAUdxSwdQw3gV
Owner
Author
|
CI status on
Generated by Claude Code |
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
The agents in
gHashTag/999-multibots-telegrafnow publish blog links with a per-channel tag (epic gHashTag/999-multibots-telegraf#2974), for examplehttps://t27.ai/?utm_source=x&utm_campaign=blog&utm_content=<slug>#/blog/<slug>. A tag records nothing on its own. These links land on this site, and until now nothing here read the tag, so blog traffic stayed invisible.src/lib/trafficArrival.ts. On load, the page reads the utm tags from its own query string. They sit before the#, where HashRouter leaves them. It reports them once per browser session to render's/api/traffic/arrival, which keeps a count per day and channel and stores nothing personal.main.tsxcalls it at the entry, except when the page is about to redirect elsewhere (the legacy Queen redirect).qa/traffic-arrival-contract.mjs(npm run check:traffic-arrival) has 9 checks, including one that a query written after the#is not read.Checks
tsc --stricton the new module is clean.node_modules, and the hooks were bypassed for this commit. The change is 1 new module, 1 contract, 5 lines inmain.tsxand 1 script inpackage.json.Work report
{ "version": 1, "head_sha": "7ecadeb9787e0cc29df3526240c113fdb6043740", "summary": "The site now counts a visit that arrives from a tagged blog link: it reads the utm tags from its own address once per browser session and reports them to the render service, which keeps a count per day and channel and nothing personal.", "changes": [ "New module src/lib/trafficArrival.ts reads utm_source, utm_medium, utm_campaign and utm_content from the query before the hash and reports them once per session.", "main.tsx calls the report at the entry, except when the page is about to redirect to the legacy Queen address.", "New contract qa/traffic-arrival-contract.mjs with nine checks, wired as npm run check:traffic-arrival." ], "tests": [ { "command": "node apps/website/qa/traffic-arrival-contract.mjs", "result": "The contract ran nine checks and all nine passed.", "status": "passed", "evidence": "Output: traffic-arrival contract: 9 checks passed" }, { "command": "Mutation: remove the once-per-session guard, then rerun the contract", "result": "The contract failed on the once-per-session check, so the guard is tested.", "status": "passed", "evidence": "The contract exited non-zero naming the session check; restoring the guard made it pass again." }, { "command": "lefthook pre-commit hooks of this repository", "result": "The hooks were not run because the clone had no installed node_modules.", "status": "not_run", "evidence": "The commit was made with hooks bypassed; CI Website checks are the gate instead." } ], "limitations": [ "Counting depends on the render route /api/traffic/arrival being public; that fix shipped separately in gHashTag/999-multibots-telegraf#2982.", "Only tagged visits are counted; an untagged visit is not reported as direct traffic because it cannot be proven." ], "tags": [ "analytics", "utm", "website" ], "blog": { "title": "Counting where blog readers come from", "summary": "Agents publish every blog link with a channel tag, and this change is the half that listens: the site reports each tagged visit once, and the owner sees arrivals per channel without any personal data being stored.", "outline": [ "A tag on a link measures nothing until the page it lands on reads it and reports it somewhere.", "The site reads the tags before the hash, where the hash router leaves them, and reports each visit once per browser session.", "The render service keeps only a count per day and channel, with a per-address rate limit, and stores no person." ] } }🤖 Generated with Claude Code
https://claude.ai/code/session_01FJktaYxNrfAUdxSwdQw3gV