cd /news/ai-search/tracking-traffic-from-chatgpt-perple… · home › topics › ai-search › article
[ARTICLE · art-151176] src=dev.to ↗ pub= topic=ai-search verified=true sentiment=· neutral

Tracking Traffic From ChatGPT, Perplexity and Gemini in GA4 and BigQuery

A developer published a method for isolating traffic from AI assistants such as ChatGPT, Perplexity, Gemini, Copilot, Claude and DeepSeek in Google Analytics 4 and BigQuery. The approach adds a custom "AI assistants" channel group in GA4 that matches referrer hosts and utm_source values, and provides a BigQuery query that identifies the first page_view of each session attributed to an AI assistant. The writeup notes that AI Overviews and AI Mode clicks arrive as ordinary Google organic traffic and that mobile apps, privacy settings and copy-pasted URLs often strip the referrer, leaving much AI-influenced traffic unattributed.

by read4 min views2 publishedOct 16, 2026

AI visibility metrics tell you how often assistants mention and cite you. Sooner or later someone asks the follow-up: does any of that turn into traffic?

Part of the answer is already in your analytics, mixed into "Referral" alongside every other website. This post separates it out:

It also covers the large share of AI-influenced traffic you can't see this way, because that limitation should shape how you report the numbers.

When a user clicks a source link inside an AI answer, the visit arrives in one of three ways:

Signal Example Notes
Referrer header https://chatgpt.com/ ,https://www.perplexity.ai/ Most common for web clients.
UTM parameter ?utm_source=chatgpt.com ChatGPT adds this to many outbound links.
Nothing (direct) Mobile apps, privacy settings and copy-pasted URLs often strip the referrer.

Referrer hosts to match (keep this list in one place, it changes):

chatgpt.com, chat.openai.com
perplexity.ai, www.perplexity.ai
gemini.google.com
copilot.microsoft.com
claude.ai
chat.deepseek.com

Google's AI Overviews and AI Mode clicks generally come through as ordinary Google organic traffic, so they won't appear here.

In Admin → Data display → Channel groups, copy the default group and add a channel called AI assistants with this condition:

^(chatgpt\.com|chat\.openai\.com|(www\.)?perplexity\.ai|gemini\.google\.com|copilot\.microsoft\.com|claude\.ai|chat\.deepseek\.com)$

Then drag the new channel above "Referral". Channels are evaluated in order, and the first match wins, so if Referral sits above it, AI traffic is still caught by Referral.

Because the rule matches source, it catches both referrer-based and utm_source=chatgpt.com visits. Custom channel groups also apply retroactively in GA4 reports, so you get history from day one.

The UI is fine for trends. For landing pages, joins and custom logic, use the BigQuery export. This query finds the first page_view of each session that came from an AI assistant, using either the referrer or the UTM source:

DECLARE ai_re STRING DEFAULT
  r'(chatgpt\.com|chat\.openai\.com|perplexity\.ai|gemini\.google\.com|copilot\.microsoft\.com|claude\.ai|chat\.deepseek\.com)';

WITH pv AS (
  SELECT
    PARSE_DATE('%Y%m%d', event_date)                                   AS day,
    user_pseudo_id,
    (SELECT value.int_value    FROM UNNEST(event_params) WHERE key = 'ga_session_id') AS session_id,
    (SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'page_location') AS page_location,
    (SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'page_referrer') AS page_referrer,
    collected_traffic_source.manual_source                              AS utm_source,
    event_timestamp
  FROM `my-project.analytics_123456789.events_*`
  WHERE _TABLE_SUFFIX BETWEEN FORMAT_DATE('%Y%m%d', DATE_SUB(CURRENT_DATE(), INTERVAL 28 DAY))
                          AND FORMAT_DATE('%Y%m%d', CURRENT_DATE())
    AND event_name = 'page_view'
),
landing AS (
  SELECT *,
    ROW_NUMBER() OVER (PARTITION BY user_pseudo_id, session_id ORDER BY event_timestamp) AS rn
  FROM pv
)
SELECT
  day,
  COALESCE(REGEXP_EXTRACT(page_referrer, ai_re), REGEXP_EXTRACT(utm_source, ai_re)) AS assistant,
  REGEXP_REPLACE(REGEXP_EXTRACT(page_location, r'^https?://[^/]+([^?#]*)'), r'/$', '') AS landing_path,
  COUNT(*) AS sessions
FROM landing
WHERE rn = 1
  AND (REGEXP_CONTAINS(IFNULL(page_referrer, ''), ai_re)
       OR REGEXP_CONTAINS(IFNULL(utm_source, ''), ai_re))
GROUP BY day, assistant, landing_path
ORDER BY sessions DESC;

Notes:

collected_traffic_source exists in exports from mid-2023 onward. For older data, rely on the referrer only.REGEXP_EXTRACT returns the matched host, so www.perplexity.ai and perplexity.ai both come out as _TABLE_SUFFIX keeps the scan, and the bill, to the date range you need.events_* matches events_intraday_* tables as well, so the most recent day can be double-counted. Use events_2* to match only the daily tables. If you're collecting citations (see the earlier posts in this series), you have, per page, how often AI answers cited it. Now you have, per page, how many sessions AI assistants sent. Put them side by side:

WITH cited AS (
  SELECT landing_path, SUM(citations) AS citations
  FROM `my-project.ai_visibility.page_citations_28d`   -- your citation data, by path
  GROUP BY landing_path
),
clicked AS (
  SELECT landing_path, SUM(sessions) AS ai_sessions
  FROM `my-project.ai_visibility.ai_sessions_28d`      -- the Step 2 result, saved
  GROUP BY landing_path
)
SELECT
  COALESCE(c.landing_path, k.landing_path) AS landing_path,
  IFNULL(c.citations, 0)    AS citations,
  IFNULL(k.ai_sessions, 0)  AS ai_sessions,
  SAFE_DIVIDE(k.ai_sessions, c.citations) AS sessions_per_citation
FROM cited c
FULL OUTER JOIN clicked k USING (landing_path)
ORDER BY citations DESC;

The four quadrants are the actionable part:

Be upfront with stakeholders about three blind spots:

This is why referral traffic alone underrates AI search, and why it needs to sit next to visibility metrics rather than replace them.

The useful report puts visibility (mentions, citations, share of voice) and outcome (AI sessions, conversions) in front of the same people, at the same cadence.

Vista AI's Brand Visibility Dashboard covers the visibility side: visibility by engine and region, share of voice against competitors, sentiment, per-query rankings and 30/90/365-day trends, with weekly email reports. It also supports multiple brands with separate query sets, which helps agencies report per client. Pair it with the GA4 channel above and you have both halves: how often AI recommends you, and how often that recommendation becomes a visit.

── more in #ai-search 4 stories · sorted by recency
── more on @google analytics 4 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/tracking-traffic-fro…] indexed:0 read:4min 2026-10-16 · —