Repository navigation
feat(traffic): compare AI visits with Google clicks on the AI Referral Trend card - #1176
Merged
Merged
Conversation
…l Trend card AT-008 part A (spec §3.3): the trend card gets a "vs Google clicks" tab. It draws AI visits and Google organic clicks, each indexed to 100 on its first day with data, with markers on the days actions entered the Action Center or prompts were added. - 00180 ai_traffic_google_trend: Search Console clicks per UTC day, the first and latest day it has rows for the brand, and the markers. Security invoker; RLS decides the brand. - The Google line is blank (not 0) before Search Console's history and after Google's latest reported day, which the view names. - A range that starts mid-day leaves out its partial first day so it doesn't set a misleading 100. - The 24-hour range offers "Show last 7 days" (Google reports by day). - Without Search Console the view keeps the AI line and says what the Google line needs (§3.8b). The view shows the "Needs Google Search Console" tag. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Collaborator
Author
|
@gkhngyk AT-008 part A, from Two notes:
Part B (page-level Search Console sync + "Is AI taking Google clicks?") comes next, stacked on this PR. |
This was referenced Oct 19, 2026
Merged
Merged
gkhngyk
approved these changes
Oct 19, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Tested on main with #1193: web vitest (1,646) and server tests (1,703) pass, and schema.sql is up to date. 00180 is applied on production. As a member of the largest Search Console brand it takes 0.9 s cold for 90 days and 41 ms for 30 days; a user from another organization gets an empty result. anon has no execute.
cihan-gyk
added a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Oct 19, 2026
main now has ansvisor#1176 (squash a98c35c, identical to this branch's 27f2ad2) and ansvisor#1193. The conflicts are the files ansvisor#1177 extends after ansvisor#1176: this branch's side kept; schema.sql rebuilt. Co-Authored-By: Claude Opus 5.5 <[email protected]>
cihan-gyk
added a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Oct 19, 2026
…raffic-untracked-queries main now has ansvisor#1176 (squash, identical to the stack's first commit) and ansvisor#1193; merged through feature/traffic-google-pages, which carries it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
cihan-gyk
added a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Oct 19, 2026
…ure/traffic-bot-ingest main now has ansvisor#1176 (squash, identical to the stack's first commit) and ansvisor#1193; merged through feature/traffic-untracked-queries, which carries it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
cihan-gyk
added a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Oct 19, 2026
…ffic-bot-logs main now has ansvisor#1176 (squash, identical to the stack's first commit) and ansvisor#1193; merged through feature/traffic-bot-ingest, which carries it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
cihan-gyk
added a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Oct 19, 2026
…ic-bot-connect main now has ansvisor#1176 (squash, identical to the stack's first commit) and ansvisor#1193; merged through feature/traffic-bot-logs, which carries it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
cihan-gyk
added a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Oct 19, 2026
…affic-bot-report main now has ansvisor#1176 (squash, identical to the stack's first commit) and ansvisor#1193; merged through feature/traffic-bot-connect, which carries it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
cihan-gyk
added a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Oct 19, 2026
…ffic-broken-links main now has ansvisor#1176 (squash, identical to the stack's first commit) and ansvisor#1193; merged through feature/traffic-bot-report, which carries it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
cihan-gyk
added a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Oct 19, 2026
…raffic-alerts main now has ansvisor#1176 (squash, identical to the stack's first commit) and ansvisor#1193; merged through feature/traffic-broken-links, which carries it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
cihan-gyk
added a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Oct 19, 2026
…-digest main now has ansvisor#1176 (squash, identical to the stack's first commit) and ansvisor#1193; merged through feature/traffic-alerts, which carries it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 20, 2026
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 Analytics, spec AT-008 part A (§3.3): the AI Referral Trend card gets a "vs Google clicks" tab. It compares AI visits with Google organic clicks, each indexed to 100, with markers on the days actions entered the Action Center or prompts were added.
Part B (page-level Search Console sync and the "Is AI taking Google clicks?" section) follows as its own PR, stacked on this one.
Why
Spec §3.3: "Two lines indexed to 100 at the start of the range: AI visits, and Google organic clicks. Event markers: Action Center actions sent, and prompts added. The legend states that AI Overviews / AI Mode clicks sit inside Google organic and can't be separated."
What changes
Migration
00180_ai_traffic_google_trend.sql:ai_traffic_google_trend(brand, since, until)returns jsonb with:It runs as security invoker:
gsc_query_stats,actionsandpromptseach have a member select policy, so RLS decides the brand.Tabs: the card header has By platform | vs Google clicks (the mockup's tabs). The view shows the "Needs Google Search Console" tag beside the title.
lib/traffic-google-trend.ts(pure) builds the view's points:Chart (
GoogleTrendChartin_charts.tsx):24-hour range: Google reports by day, so the tab says "Pick 7 days or longer…" with a Show last 7 days button. There is no hidden window of its own (F2).
Without Search Console: the view keeps the AI line, hides the Google line from the legend and tooltip, and says "The Google clicks line needs Google Search Console." (§3.8b's partial note). While the source states load, it shows a skeleton.
Not in this PR
typevalues and dimensions have no AI Overviews or AI Mode option, and a third-party check on 2026-08-11 found the report is UI-only. Per §5.3 the card and column stay hidden, with no placeholder numbers.Related issue
None. Spec AT-008 (AI Traffic Analytics plan, approved by product).
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
00180(one new function; no table change).Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/): no errors; 6 warnings, all in files this PR does not touchyarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Also run:
web:yarn test(1646) andyarn buildpass.supabase:bash supabase/build-schema.sh;schema.sqlupdated.traffic-google-trend.test.ts: the days, the partial first day, indexing, Google's blank days, markers.traffic-google-trend.test.ts(actions): the RPC read._google-trend.test.tsx: both lines, no Search Console, no clicks or a failed read, the first whole day and the loading states, 24h.🤖 Generated with Claude Code