Repository navigation
feat(traffic): count ChatGPT Shopping visits from feed links tagged utm_medium=feed - #1425
Merged
Merged
Conversation
…tm_medium=feed A product link in a merchant's feed tagged utm_source=chatgpt.com and utm_medium=feed comes from a ChatGPT Shopping product card. Those visits were counted as plain ChatGPT; now they are marked as ChatGPT Shopping and still count under ChatGPT. - Source list (version 3): ChatGPT gets a shopping surface, matched by the medium feed (classifyAiSurface, landingMedium in ai-sources.js). - /track reads the surface from the landing URL it stores, so visits from a cached older snippet are marked too, and writes source_surface. The visit stays source_platform = 'chatgpt.com'. - Google Analytics sync asks for sessionMedium and stores the medium and the surface on ga_ai_traffic_stats. The medium joins the row key; rows synced before have none and are replaced as their days are re-read. - Migration 00251: source_surface on ai_traffic_logs and medium/surface on ga_ai_traffic_stats with checks, the new unique key, a one-off backfill of stored ChatGPT visits whose landing URL has utm_medium=feed, and ai_traffic_merged / ga_platform_value returning the visits and figures by surface while platform totals stay whole. - AI Traffic page: ChatGPT Shopping shows as its own row under ChatGPT in Referrals by Platform (with change, engaged and key events), in the Platform Breakdown bars, in the Top platform card and in the platforms export, each marked as part of ChatGPT's visits. Closes #1283
6 of 9 tasks
cihan-gyk
added a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Oct 23, 2026
…hors Renumbers our migration 00251→00252: main took 00251 in ansvisor#1425.
cihan-gyk
added a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Oct 23, 2026
Renumbers our migration 00252→00253: main took 00251 in ansvisor#1425.
cihan-gyk
added a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Oct 23, 2026
…heck Renumbers our migration 00253→00254: main took 00251 in ansvisor#1425.
cihan-gyk
added a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Oct 23, 2026
…rver Renumbers our migration 00254→00255: main took 00251 in ansvisor#1425.
cihan-gyk
added a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Oct 23, 2026
Renumbers our migration 00255→00256: main took 00251 in ansvisor#1425.
This was referenced Oct 23, 2026
Merged
Merged
cihan-gyk
added a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Oct 23, 2026
Renumbers our migration 00252→00256, as asked in review: main took 00251 in ansvisor#1425.
cihan-gyk
added a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Oct 23, 2026
Renumbers our migration 00253→00257, as asked in review: main took 00251 in ansvisor#1425.
cihan-gyk
added a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Oct 23, 2026
…heck Renumbers our migration 00254→00258, as asked in review: main took 00251 in ansvisor#1425.
cihan-gyk
added a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Oct 23, 2026
…rver Renumbers our migration 00255→00259, as asked in review: main took 00251 in ansvisor#1425.
cihan-gyk
added a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Oct 23, 2026
Renumbers our migration 00256→00260, as asked in review: main took 00251 in ansvisor#1425.
cihan-gyk
added a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Oct 23, 2026
…rt-byline Renumbers our migration 00257→00261, as asked in review: main took 00251 in ansvisor#1425.
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
A product URL in a feed tagged
utm_source=chatgpt.com&utm_medium=feedtells a visit from a ChatGPT Shopping product card apart from one through a ChatGPT answer. Until now both were ChatGPT, and nothing read the medium.ai-sources.jsonv3): ChatGPT gets ashoppingsurface,utm_medium = feed.classifyAiSurface(source, medium)matches the medium exactly, in any case.landingMedium(url)reads the firstutm_mediumof a URL./track: works out the surface from the landing URL it stores, not from a body field, so older cached snippets' visits are marked too.source_surface = 'shopping'and stayssource_platform = 'chatgpt.com', so ChatGPT's totals don't change.ga-sync.js): the AI report also readssessionMedium.feedcarrysurface = 'shopping'.ai_traffic_logs.source_surface, with a check. A one-off pass marks earlier ChatGPT visits whose URL hasutm_medium=feed; there are none on prod today.ga_ai_traffic_stats.mediumand.surface. The unique key becomes(brand_id, date, source, medium, landing_page_query), nulls not distinct.ai_traffic_mergedalso returnssurfaces, andga_platform_valuealso returns asurfacescolumn. Platform totals are unchanged.Checked on production, by running 00251 in a transaction that was rolled back:
ai_traffic_merged(all time) gives the same output as today apart from the newsurfaces;ga_platform_valuegives the same 28 platform rows.Not in this PR:
Related issue
Closes #1283
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 testsDeploy order
backfill-ga-ai-history.js, so GA history before the last few days gets its medium too.How to test
https://<a tracked site>/<product>?utm_source=chatgpt.com&utm_medium=feedfrom a browser.utm_source=chatgpt.comstays plain ChatGPT.Tests cover:
/track: shopping, upper case, older host, other mediums, a Perplexity feed link;Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)🤖 Generated with Claude Code