Repository navigation
fix(traffic): say whether the tracking snippet is installed, not a bare 0 (00433) - #1927
Merged
Merged
Conversation
…re 0 AI Traffic called the snippet "detected" only after an AI visit in the last 7 days, so a site with the snippet and no AI visitors read the same as one without it; the empty card never said "Add the tracking snippet" because tracking_code is always set; MCP get_ai_traffic and Chat get_ai_traffic_summary answered total_visits: 0 either way. - Check, with no request added to customers' pages: the server reads the brand's home page through safe-fetch (public addresses only), at the domain as added then www., and looks for the snippet (its t.js tag or the tracking code). POST /api/brands/:id/tracking-snippet/check (any brand member, own rate limit) for Check again; setup's site type detection runs it once too. A read that fails keeps nothing. - 00433: brands.snippet_checked_at and snippet_found_at; schema.sql and the Supabase types regenerated. A deploy ahead of it reads nulls. - Three states (traffic-sources.ts snippetState): active (AI visit in 7 days), installed_quiet (the check found it, or any AI visit before), not_detected. The Data sources strip says "Not detected on {domain}" or "Installed - no AI visits in the last 7 days"; the code banner, shown only while not detected, gives the steps and Check again with what it saw (not found, unreachable, no domain); the empty card asks to add the snippet only then; the export names the state. - MCP and Chat: tracking: 'not_detected' | 'installed_quiet' | 'active' in the answer, and the tool descriptions say what it means. skills/*/SKILL.md and docs (mcp-server, api-reference/metrics) need a line about it: separate docs PR. - Help: connect-ai-traffic-sources, ai-referral-traffic. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ons do Without the reload, PostgREST keeps serving brands without snippet_checked_at and snippet_found_at until its next restart. Co-Authored-By: Claude Opus 5.5 <[email protected]>
POST /brands/:id/tracking-snippet/check reads the brand's home page and writes when it was checked; a demo brand's site is a sample, so the demo guard refuses it like detect-site-type. Names the route in the demo-brand coverage test's guarded list. Co-Authored-By: Claude Opus 5.5 <[email protected]>
8 of 13 tasks
# Conflicts: # supabase/schema.sql
5 of 10 tasks
gkhngyk
pushed a commit
that referenced
this pull request
Nov 2, 2026
…iewer (#1964) The MCP tools changed in #1920, #1927 and #1916; the skills and the MCP guide still described the old answers. - get_ai_traffic / GET /ai-traffic: `tracking` (not_detected, installed_quiet, active); a 0 with not_detected means nothing is measured yet. Coach skills (MCP + REST), mcp-server.mdx and api-reference/metrics.mdx (GET /api/v1/ai-traffic returns it too). - run_site_audit / POST /site-audits: a running page's audit comes back with alreadyRunning and no credit; a page audited in the last 10 minutes returns recently_audited and starts nothing unless force. Coach skills, audit-fix (Chat) and mcp-server.mdx; library.json refreshed. - get_content_draft_package: the qualified reviewer (reviewer) and its WebPage reviewedBy JSON-LD once the page names them. mcp-server.mdx. Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
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
AI Traffic said "Not detected" for the tracking snippet whenever there had been no AI visit in the last 7 days. So a site with the snippet and no AI visitors read the same as a site without it, and MCP and Chat answered "0 visits" either way.
Now the server checks the brand's home page for the snippet, and AI Traffic tells three states apart. Customer priorities plan, P0 item 4.
What changes
www..t.jstag or the tracking code.POST /api/brands/:id/tracking-snippet/check: every member of the brand may call it, with its own rate limit.brands.snippet_checked_atandbrands.snippet_found_at, and reloads the API schema;schema.sqlandsupabase.tsare updated.active: an AI visit in the last 7 days;installed_quiet: the check found the snippet, or an AI visit was ever stored;not_detected: neither.tracking: 'not_detected' | 'installed_quiet' | 'active', and the tools' descriptions say what each means.detect-site-type, because its site is a sample. The route is in the demo-brand coverage list.connect-ai-traffic-sources.mdandai-referral-traffic.md;approved-articles.jsonrefreshed.Next: "Check the snippet once on the first open" is stacked on this PR (owner decision 2026-11-01).
For @gkhngyk:
get_ai_trafficgainstracking; a skills docs PR follows.Related issue
None. Customer priorities plan, P0 item 4.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
www.try;Checked in the browser at 1024px: Active and Installed states on the strip. The user approved the screens.
Checklist
yarn lintpasses (0 errors; 7 old warnings in files this PR doesn't touch)yarn typecheckpassesyarn format:checkpasseshelp/(or no user-visible change)supabase/schema.sqlrebuiltFull checks on this branch (d7b2012): web 806 files / 8395 tests pass, and
yarn buildpasses. Serverformat:checkand lint are clean, and 354 files / 5006 tests pass (3 skipped).🤖 Generated with Claude Code