{"id":525,"date":"2026-09-25T08:00:18","date_gmt":"2026-09-25T08:00:18","guid":{"rendered":"https:\/\/keyworth.co\/blog\/ai-traffic-ga4-regex"},"modified":"2026-09-25T08:00:21","modified_gmt":"2026-09-25T08:00:21","slug":"ai-traffic-ga4-regex","status":"publish","type":"post","link":"https:\/\/keyworth.co\/blog\/ai-traffic-ga4-regex","title":{"rendered":"How to Track AI Referral Traffic in GA4 with a Regex"},"content":{"rendered":"<p>To track AI referral traffic in Google Analytics 4, you must create a custom channel group that uses a regular expression (Regex) to identify traffic from known AI sources like ChatGPT, Perplexity, and Gemini. This method involves navigating to the GA4 Admin panel, defining a new channel with the condition &#8216;Session source \/ medium&#8217; matches your Regex, and saving it as your primary channel group. This isolates AI referrals into a distinct, reportable channel, allowing for accurate performance analysis beyond what default GA4 settings provide.<\/p>\n<figure class=\"article-image\"><img src=\"https:\/\/kzvpvjjbqvmgluaudrhi.supabase.co\/storage\/v1\/object\/public\/article-images\/4fb8a3c7-cff0-466f-8ef4-2c9c8b476c01\/inline-0.jpg\" alt=\"Abstract diagram showing lines branching out to multiple nodes, symbolizing data connections and AI traffic\" loading=\"lazy\" style=\"width:100%;aspect-ratio:16\/9;object-fit:cover;\" decoding=\"async\"><figcaption>Abstract diagram showing lines branching out to multiple nodes, symbolizing data connections and AI traffic <span class=\"image-attribution\" style=\"font-size:0.75em;color:#888;\">(Photo by Google DeepMind on pexels)<\/span><\/figcaption><\/figure>\n<h2>Why You Must Track AI Traffic Now<\/h2>\n<p>The way users find information is fundamentally changing. As one observer noted, &#8220;The digital economy is moving from \u2018retrieval-based\u2019 search (finding a link) to \u2018synthesis-based\u2019 discovery (getting an answer), decoupling search volume from site traffic.&#8221; This means a growing portion of your audience will arrive not from a Google SERP, but from a link cited in an AI-generated answer. Ignoring this traffic is like ignoring mobile users in 2010; you are willfully blinding yourself to a massive user segment.<\/p>\n<p>Without proper tracking, this valuable traffic is often miscategorized as &#8216;Direct&#8217; or lumped into &#8216;(other)&#8217;, rendering it invisible. By isolating AI referrals, you can:<\/p>\n<ul>\n<li><strong>Measure the ROI of AI-friendly content:<\/strong> Understand which pages and topics are being surfaced in AI answers.<\/li>\n<li><strong>Adapt your content strategy:<\/strong> See what kinds of questions drive AI traffic and create content that directly answers them. This is how you build <code>Topical Authority<\/code>, proving your expertise not just to users, but to the models that serve them.<\/li>\n<li><strong>Justify SEO and content efforts:<\/strong> Provide concrete data on a new and growing acquisition channel.<\/li>\n<\/ul>\n<h2>Tracking AI Referral Traffic in GA4: The Definitive Method<\/h2>\n<p>The most effective and durable method for tracking AI referral traffic is by creating a <strong>custom channel group<\/strong>. While you can use segments in Explorations for one-off analysis, a custom channel group permanently re-categorizes incoming traffic, making &#8216;AI Referrals&#8217; a standard, visible channel in your core <code>Traffic acquisition<\/code> reports. It&#8217;s the difference between a temporary filter and a structural change to your analytics foundation.<\/p>\n<p>This method works by identifying the <code>referrer<\/code> domain. When a user clicks a link from an AI chat interface, their browser passes that source information to GA4, just like any other link. Our task is to teach GA4 how to recognize these specific AI referrers.<\/p>\n<h2>Step-by-Step: Creating Your AI Traffic Channel Group<\/h2>\n<p>Follow these exact steps to build your AI referral channel. This process redefines your primary reporting channel group, so it will apply to all data moving forward.<\/p>\n<h3>Step 1: Navigate to Admin and Find Channel Groups<\/h3>\n<p>In your GA4 property, click on the <strong>Admin<\/strong> gear icon in the bottom-left corner. In the &#8216;Data display&#8217; section of the Property column, click on <strong>Channel Groups<\/strong>.<\/p>\n<h3>Step 2: Create a New Channel Group<\/h3>\n<p>You will see the &#8216;Default Channel Group&#8217;. You cannot edit this directly, but you can copy it to create a new one. Click the three dots on the far right of the &#8216;Default Channel Group&#8217; row and select <strong>Create a copy<\/strong>. Give your new group a descriptive name, like &#8220;Primary Channels with AI&#8221;.<\/p>\n<figure class=\"article-image\"><img src=\"https:\/\/kzvpvjjbqvmgluaudrhi.supabase.co\/storage\/v1\/object\/public\/article-images\/4fb8a3c7-cff0-466f-8ef4-2c9c8b476c01\/inline-1.jpg\" alt=\"Hand pointing at a monitor displaying data charts, analyzing digital analytics and traffic metrics\" loading=\"lazy\" style=\"width:100%;aspect-ratio:16\/9;object-fit:cover;\" decoding=\"async\"><figcaption>Hand pointing at a monitor displaying data charts, analyzing digital analytics and traffic metrics <span class=\"image-attribution\" style=\"font-size:0.75em;color:#888;\">(Photo by Jakub Zerdzicki on pexels)<\/span><\/figcaption><\/figure>\n<h3>Step 3: Add and Define Your New AI Channel<\/h3>\n<p>Click <strong>Add new channel<\/strong>. This is where the magic happens.<\/p>\n<ol>\n<li><strong>Name the channel:<\/strong> Call it &#8220;AI Referrals&#8221;.<\/li>\n<li><strong>Define the condition:<\/strong> Set the condition to <code>Session source<\/code> <strong>matches regex<\/strong>.<\/li>\n<li><strong>Enter the Regex:<\/strong> Copy and paste the following expression into the value box. This string targets major AI platforms like <strong>ChatGPT<\/strong>, <strong>Perplexity<\/strong>, <strong>Gemini<\/strong>, <strong>Claude<\/strong>, and <strong>Microsoft Copilot<\/strong>.<\/li>\n<\/ol>\n<p>    <code>(perplexity\\.ai<\/p>\n<table>\n<thead>\n<tr>\n<th>chat\\.openai\\.com<\/th>\n<th>gemini\\.google\\.com<\/th>\n<th>copilot\\.microsoft\\.com<\/th>\n<th>claude\\.ai<\/th>\n<th>you\\.com<\/th>\n<\/tr>\n<\/thead>\n<tbody><\/tbody>\n<\/table>\n<p>bard\\.google\\.com)<\/code><\/p>\n<p>Your rule should look exactly like this: &#8220;Session source&#8221; <code>matches regex<\/code> <code>(perplexity\\.ai<\/p>\n<table>\n<thead>\n<tr>\n<th>...<\/th>\n<\/tr>\n<\/thead>\n<tbody><\/tbody>\n<\/table>\n<p>bard\\.google\\.com)<\/code>.<\/p>\n<blockquote><p>Don&#8217;t just track AI traffic; create content designed to be an AI&#8217;s first choice. The goal is to become the definitive source a model cites, which requires a new level of clarity and structure.<\/p><\/blockquote>\n<h3>Step 4: Reorder and Save Your Channels<\/h3>\n<p>Order matters. GA4 processes channel rules from top to bottom. Drag your new &#8220;AI Referrals&#8221; channel up the list so it sits above &#8216;Direct&#8217; and &#8216;Organic Search&#8217;. This ensures GA4 checks for an AI source <em>before<\/em> potentially misattributing it. Once ordered, click <strong>Save group<\/strong>.<\/p>\n<p>To make it your primary reporting view, find your newly created group in the Channel Groups list and set it as the <strong>Primary channel group<\/strong>.<\/p>\n<h2>Viewing and Analyzing Your AI Referral Traffic<\/h2>\n<p>After setting up your custom channel group, new traffic from these AI sources will be categorized correctly. You can now see &#8220;AI Referrals&#8221; directly in your <code>Reports > Acquisition > Traffic acquisition<\/code> report. This allows you to analyze AI-driven users alongside familiar channels like Organic Search, Paid Search, and Direct.<\/p>\n<p>This data is critical for refining your content strategy. If you see that pages produced by your <code>ai seo content generator<\/code> are driving significant traffic from Perplexity, you can double down on creating content optimized for that platform&#8217;s answer format. Analyzing the landing pages for this segment reveals which content is most valuable to an audience seeking synthesized answers. For a deeper look at user paths, you can build a segment in GA4&#8217;s <strong>Explore<\/strong> section using the same Regex, allowing you to compare the behavior of AI-referred users against other cohorts.<\/p>\n<figure class=\"article-image\"><img src=\"https:\/\/kzvpvjjbqvmgluaudrhi.supabase.co\/storage\/v1\/object\/public\/article-images\/4fb8a3c7-cff0-466f-8ef4-2c9c8b476c01\/inline-2.jpg\" alt=\"Laptop displaying Google Analytics Real-Time report with a notebook and pen nearby\" loading=\"lazy\" style=\"width:100%;aspect-ratio:16\/9;object-fit:cover;\" decoding=\"async\"><figcaption>Laptop displaying Google Analytics Real-Time report with a notebook and pen nearby <span class=\"image-attribution\" style=\"font-size:0.75em;color:#888;\">(Photo by StockSnap on pixabay)<\/span><\/figcaption><\/figure>\n<h2>Troubleshooting and Limitations<\/h2>\n<p>This method is powerful, but it isn&#8217;t perfect. Be aware of the limitations:<\/p>\n<ul>\n<li><strong>The &#8216;Direct&#8217; Traffic Problem:<\/strong> If a user copies a link from an AI chat app and pastes it into their browser, it will arrive as &#8216;Direct&#8217; traffic. There is no referrer to track. This is an unavoidable limitation.<\/li>\n<li><strong>New AI Tools:<\/strong> The Regex provided is a starting point. As new AI search tools emerge, you will need to update your Regex string to include their domains.<\/li>\n<li><strong>Misattribution:<\/strong> If your channel order is wrong, AI traffic could be incorrectly bucketed. Always place your custom AI channel before broad channels like &#8216;Organic Search&#8217; or &#8216;Referral&#8217;.<\/li>\n<\/ul>\n<p>If you see a sudden, unexplained spike in &#8216;Direct&#8217; traffic that correlates with your content efforts, it&#8217;s a strong indicator that you are getting untrackable AI traffic. This is where combining GA4 data with other signals becomes important. Using <code>automated AI keyword research<\/code> can help you spot the long-tail conversational queries that are likely being asked of AI assistants, giving you another signal to correlate with traffic patterns.<\/p>\n<blockquote><p>The most overlooked aspect of AI traffic is its intent. These are not users browsing; they are users who have received a specific, synthesized answer and are clicking for verification or deeper context. Your landing page must satisfy that high-intent click immediately.<\/p><\/blockquote>\n<h2>Frequently Asked Questions<\/h2>\n<h3>Why is my AI traffic showing up as &#8216;Direct&#8217;?<\/h3>\n<p>This happens when a user copies a URL from an AI interface (especially a desktop or mobile app) and pastes it directly into their browser. In this scenario, no referrer data is passed, and GA4 correctly classifies the session as &#8216;Direct&#8217;. There is currently no reliable way to track this specific behavior.<\/p>\n<h3>How often should I update the Regex for AI sources?<\/h3>\n<p>A good practice is to review your &#8216;(other)&#8217; and &#8216;Referral&#8217; channels quarterly for new, significant AI-like domains. As new AI chat and answer engines gain popularity, you can add them to your Regex list to keep your tracking comprehensive.<\/p>\n<h3>Can I use this method to track traffic from a specific AI, like just ChatGPT?<\/h3>\n<p>Yes. You would simply create a channel rule where &#8216;Session source&#8217; <code>contains<\/code> <code>chat.openai.com<\/code>. You could create separate channels for each major AI platform if you want that level of granularity in your main reports, but most find a single &#8220;AI Referrals&#8221; bucket more manageable.<\/p>\n<h3>Will creating a custom channel group affect my historical data?<\/h3>\n<p>No. Custom channel groups in GA4 only apply to data collected <em>after<\/em> the group is created and set as primary. Your historical data will remain categorized by the default channel group definitions.<\/p>\n<h3>What&#8217;s the difference between using a segment and a channel group?<\/h3>\n<p>A segment is a temporary filter you apply for a specific analysis, usually within GA4&#8217;s Explore reports. It&#8217;s for ad-hoc questions. A custom channel group is a permanent classification rule that affects how your data is organized across all standard reports, like the Traffic Acquisition report. For ongoing tracking, a channel group is the correct tool.<\/p>\n<p>Monitoring AI referrals is no longer an optional task for forward-thinking SEOs; it&#8217;s a core competency. By implementing this tracking, you gain a vital window into the future of search and user behavior. To stay ahead, you need a content engine that can consistently produce the high-quality, authoritative articles that AI models prefer to cite, which is where an automated platform can transform your strategy. To see how Keyworth automates this entire process, <a href=\"https:\/\/keyworth.co\" target=\"_blank\" rel=\"noopener noreferrer nofollow\">explore the platform<\/a>.<\/p>\n<h2>Related reading<\/h2>\n<ul>\n<li><a href=\"https:\/\/keyworth.co\/blog\/essential-seo-content-performance-tracking-tools\" target=\"_blank\" rel=\"noopener noreferrer nofollow\">Essential SEO Content Performance Tracking Tools<\/a>.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Without custom GA4 channels, AI referral traffic often gets miscategorized as &#8220;Direct&#8221; or &#8220;(other)&#8221;, hiding key user acquisition data.<\/p>\n","protected":false},"author":1,"featured_media":524,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-525","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/keyworth.co\/blog\/wp-json\/wp\/v2\/posts\/525","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/keyworth.co\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/keyworth.co\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/keyworth.co\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/keyworth.co\/blog\/wp-json\/wp\/v2\/comments?post=525"}],"version-history":[{"count":1,"href":"https:\/\/keyworth.co\/blog\/wp-json\/wp\/v2\/posts\/525\/revisions"}],"predecessor-version":[{"id":526,"href":"https:\/\/keyworth.co\/blog\/wp-json\/wp\/v2\/posts\/525\/revisions\/526"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/keyworth.co\/blog\/wp-json\/wp\/v2\/media\/524"}],"wp:attachment":[{"href":"https:\/\/keyworth.co\/blog\/wp-json\/wp\/v2\/media?parent=525"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/keyworth.co\/blog\/wp-json\/wp\/v2\/categories?post=525"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/keyworth.co\/blog\/wp-json\/wp\/v2\/tags?post=525"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}