Skip to content

feat(webapp): send Google's googsrc AI-click tag to GA4 - #7548

Merged
nimrodkra merged 1 commit into
mainfrom
claude/project-thread-az3o2z
Dec 3, 2026
Merged

nimrodkra merged 1 commit into
mainfrom
claude/project-thread-az3o2z

Conversation

@nimrodkra

@nimrodkra nimrodkra commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Changes

  • 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 (Google docs). It is the first way to see a Google AI click outside Search Console.
  • GA4 only sees it inside page_location of the landing page_view. The gtag boot in Pixels.tsx now reads it, keeps it in sessionStorage for the tab, and calls gtag('set', { googsrc }) before config, so every GA4 event in that session (signup included) carries a googsrc parameter.
  • To use it in reports, register an event-scoped custom dimension named googsrc in the GA4 property (admin step, not in code).

Known gap, not fixed here: when /posts/<old-slug> 308s to the current slug (the getStaticProps redirect in pages/posts/[id]/index.tsx), the query string is dropped, so googsrc (and UTM params) are lost on that hop. Checked live on 2026-12-02. getStaticProps cannot see the query, so this is best fixed where the redirect leaves the edge.

Events

No new events. New GA4 event parameter googsrc on existing events, only when present.

Experiment

No.

Manual Testing

Ran the snippet on a live daily.dev page with ?googsrc=ai-uk: it sets googsrc: 'ai-uk' on the landing page and again after the query is gone (from sessionStorage), and does nothing without the parameter.


Generated by Claude Code

Preview domain

https://claude-project-thread-az3o2z.preview.app.daily.dev

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
@nimrodkra nimrodkra self-assigned this Dec 2, 2026
@vercel

vercel Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
daily-webapp Ready Ready Preview Dec 2, 2026 11:29am UTC

Request Review

@nimrodkra
nimrodkra requested a review from idoshamun December 2, 2026 12:58
@nimrodkra
nimrodkra merged commit 1663075 into main Dec 3, 2026
12 checks passed
@nimrodkra
nimrodkra deleted the claude/project-thread-az3o2z branch December 3, 2026 20:18

This branch was successfully deployed

1 active deployment
Preview — 75a99fff Deployed Dec 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants