Repository navigation
feat(webapp): send Google's googsrc AI-click tag to GA4 - #7548
Merged
Merged
Conversation
Since 2026-12-01 Google appends ?googsrc=ai-uk to organic links clicked from AI Overviews, AI Mode and Discover AI features by UK users. GA4 only sees it in page_location of the landing page_view. Read it at gtag boot, keep it in sessionStorage for the tab, and set it as a googsrc event parameter so every event in the session (including signup) can be segmented through a custom dimension of the same name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014w6ZthrgZnq8SojR7CSPt1
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Changes
?googsrc=ai-ukto organic links clicked from AI Overviews, AI Mode and Discover AI features by UK users (Google docs). It is the first way to see a Google AI click outside Search Console.page_locationof the landingpage_view. The gtag boot inPixels.tsxnow reads it, keeps it insessionStoragefor the tab, and callsgtag('set', { googsrc })beforeconfig, so every GA4 event in that session (signup included) carries agoogsrcparameter.googsrcin the GA4 property (admin step, not in code).Known gap, not fixed here: when
/posts/<old-slug>308s to the current slug (thegetStaticPropsredirect inpages/posts/[id]/index.tsx), the query string is dropped, sogoogsrc(and UTM params) are lost on that hop. Checked live on 2026-12-02.getStaticPropscannot see the query, so this is best fixed where the redirect leaves the edge.Events
No new events. New GA4 event parameter
googsrcon existing events, only when present.Experiment
No.
Manual Testing
Ran the snippet on a live daily.dev page with
?googsrc=ai-uk: it setsgoogsrc: 'ai-uk'on the landing page and again after the query is gone (fromsessionStorage), and does nothing without the parameter.Generated by Claude Code
Preview domain
https://claude-project-thread-az3o2z.preview.app.daily.dev