Back to Learn
#AEO

How to Set Up AI Referral Tracking in GA4

A step-by-step GA4 setup for combining native and custom AI referral channels, validating source domains, and reporting measurable traffic honestly.

Abstract analytics paths routing AI referral sources into a unified GA4 reporting channel on a dark background

To track AI referral traffic in GA4, inspect the native AI Assistant channel first, then create a custom channel group that captures recognized and omitted AI referrer domains in one view. Place the custom channel above AI Assistant and Referral, validate it against Session source / medium, and report the result as a measurable floor rather than complete AI attribution.

Why does GA4 need a custom AI referral channel?

GA4 added an AI Assistant channel to its default channel grouping in May 2026. The native channel improves reporting, but it does not eliminate fragmentation. Recognized sources can appear under AI Assistant, unrecognized AI domains can remain under Referral, and sessions without a referrer still appear as Direct.

A custom channel group solves the identifiable part of that problem. It applies one controlled domain list across historical and current session sources so the team can use a consistent reporting definition.

This guide focuses on that implementation. The broader guide to AI search attribution in GA4 covers dark traffic, assisted conversion, and the limits of click-based attribution.

Which AI referrer domains should you include?

Start with the domains that appear in your own Session source / medium report. Then compare them with the current platforms your buyers use.

[@portabletext/react] Unknown block type "table", specify a component for it in the `components.types` prop

The list should remain editable. Referrer behavior varies by product surface, mobile apps may remove it entirely, and platforms can change domains. Review the observed source rows quarterly instead of treating any published list as permanent.

Google AI Overviews and AI Mode are excluded because their clicks use Google as the referrer and remain part of Organic Search under Google’s default channel definitions. A custom AI-domain regex cannot separate those clicks.

How do you set up AI referral tracking in GA4?

The setup has six steps. Confirm that identifiable traffic exists, create an exact domain pattern, add a custom channel, test the classification, compare outcomes, and publish a shared report.

Step 1: check the native channel and source rows

Open Reports, then Acquisition, then Traffic acquisition. Set the date range to at least 90 days if traffic volume is low.

First choose the default session channel group dimension and look for AI Assistant. Then switch the dimension to Session source / medium and search for terms such as `chatgpt`, `perplexity`, `claude`, `gemini`, `copilot`, and `grok`.

This check establishes the baseline. Save the source rows you find because they are the evidence for the custom rule. If the property has no identifiable sessions, the channel can still be configured, but it will not create traffic that the referrer data does not contain.

Step 2: create an exact source regex

Use an anchored pattern so unrelated sources containing short strings such as `ai` or `gpt` do not match accidentally.

Copy this regex:

The prompt

`^(chatgpt\.com|chat\.openai\.com|perplexity\.ai|www\.perplexity\.ai|gemini\.google\.com|bard\.google\.com|claude\.ai|copilot\.microsoft\.com|edgeservices\.bing\.com|grok\.com|grok\.x\.com|deepseek\.com|you\.com)$`

The rule matches the Session source value, not a full landing-page URL. Add a new domain as another escaped alternative only after it appears in the source report or the platform documents its referrer behavior.

Avoid broad expressions such as `.ai.`. Google’s custom channel documentation explains the available operators and channel-order behavior, but examples must still be adapted to the exact source values in your property.

Step 3: create the custom channel group

Open Admin, then Data display, then Channel groups. Create a new channel group from the current default group and add a channel named AI Referral.

Set the condition to Session source matches regex and paste the pattern from step 2. Move AI Referral above both AI Assistant and Referral. GA4 assigns a session to the first matching channel, so ordering determines whether the custom definition can collect every identifiable source in one row.

Save the group with a name that distinguishes it from Google’s default grouping, such as Custom channel group: AI referrals. Standard property limits and required permissions are documented in the same channel-group guide.

Step 4: validate the channel in an Exploration

Open Explore and create a Free form Exploration. Add your custom channel group and Session source / medium as dimensions, then add Sessions as the metric. Google’s Explorations documentation covers the report controls.

Place the custom channel in rows and use Session source / medium as the breakdown. Every source matched by the regex should appear under AI Referral. If a domain remains under Referral, compare the recorded source value with the pattern and check the channel order.

Test across a longer date range and review at least one known landing page. A clean rollup in the Exploration is the acceptance test before the team uses the channel for reporting.

Step 5: compare engagement and conversions

In Traffic acquisition, use the custom channel group as the primary dimension. Compare AI Referral with Organic Search and Referral using Sessions, Engaged sessions, Average engagement time per session, Key events, and Session key event rate.

Small channels can produce unstable conversion rates, so report the numerator and denominator together. A channel with two conversions from twenty sessions should not be presented with the same confidence as one with hundreds of sessions.

This report measures visits that preserve an identifiable source. Use the guide to tracking ChatGPT citations for visibility outcomes that do not produce a click.

Step 6: publish a shared report

Customize the Traffic acquisition report with the custom channel group as its default dimension. Save it as a new report, add it to a collection in the Reports Library, and publish the collection.

Google documents how editors can customize detail reports and publish them through the Library. Give the report a clear name such as AI referral traffic so teammates do not confuse it with Google’s native AI Assistant channel.

Keep one owner for the regex and review date. A shared definition prevents teams from presenting different AI traffic totals based on separate filters.

What does the native AI Assistant channel capture?

The native channel classifies sessions when Google recognizes an AI assistant source or receives the channel values defined in its documentation. Its source list can change as Google updates the default channel rules.

Use the native channel as a starting point and comparison, not a complete record. As of August 2026, Google’s published default channel definitions should be checked directly before stating which assistants are included. A custom channel remains useful when an observed source is missing or when the team needs one auditable historical definition.

Compare AI Assistant and AI Referral in the same Exploration. A large difference should be explainable by specific domains present in the custom rule rather than by an unexplained reporting discrepancy.

How should you report dark AI traffic?

Some AI visits arrive without a referrer and appear as Direct. GA4 cannot reliably recover the original assistant after the browser or app removes that information. Do not apply a generic percentage to Direct traffic and label the result as AI.

Report the custom channel as identifiable AI referral traffic. Describe it as a floor, retain Direct as unattributed, and supplement analytics with self-reported discovery fields on signup or sales forms when the business needs a broader attribution view.

Server logs can help diagnose requests and crawler activity, but they do not turn every referrerless human visit into attributable AI traffic. The AI search attribution guide covers the three-layer measurement model for referral, dark, and visibility signals.

How do you distinguish crawler activity from referrals?

AI crawlers and human referral sessions are different events. OpenAI documents GPTBot, OAI-SearchBot, and ChatGPT-User in its bot documentation. A crawler request shows that an agent requested a page. It does not prove that a person clicked a citation or that the page appeared in an answer.

Most crawlers do not execute the analytics JavaScript required for a GA4 session. Review and filter bot activity at the CDN or server layer, where request headers and user agents are available, instead of changing referral-channel rules to compensate for crawler logs.

If GA4 sessions and server requests differ, compare like with like. Human sessions belong in GA4. Crawler requests belong in server or CDN logs. Citation visibility belongs in a dedicated AI-search tracking panel.

How do you account for Google AI Overviews?

Clicks from Google AI Overviews and AI Mode remain mixed with Google Organic traffic in GA4. Google’s Generative AI performance reporting can provide additional visibility where the feature is available, but it does not convert those visits into a separate GA4 referral source.

Use Search Console to identify pages receiving generative-search impressions, then inspect those landing pages within Google Organic traffic in GA4. Treat the comparison as directional because GA4 still cannot label an individual organic session as an AI Overview click.

For a weekly practical lesson on AEO measurement and content operations, subscribe to The Messy Middle newsletter. It focuses on the operating decisions behind reliable reporting rather than headline metrics.

Which setup mistakes produce bad AI traffic data?

Five mistakes account for most reporting problems:

  • Skipping the native-channel baseline. Record what Google already classifies before adding another definition.
  • Using a broad regex. Exact, escaped domains reduce unrelated matches.
  • Placing the custom channel too low. First-match ordering can leave sessions in AI Assistant or Referral.
  • Treating identifiable referrals as total AI influence. Referrerless visits and visibility without clicks remain outside the channel.
  • Leaving the rule ownerless. Domains and GA4 definitions change, so the pattern needs a documented review date.

A useful report is auditable. The source list, regex, order, validation report, and limitations should all be visible to the team using the number.

Frequently Asked Questions

Related Content