How to track AI referral traffic in GA4 and server logs
GA4 does not separate AI traffic by default. This guide shows you how to create custom channel groups, track AI referrals, and catch visits that GA4 misses.
Why AI traffic measurement is broken by default#
GA4 categorizes AI referral traffic as generic "Referral" traffic, lumped together with every other non-search referral source. There is no built-in "AI Search" channel. ChatGPT traffic appears alongside Pinterest referrals and forum links. Without custom configuration, you cannot tell how much traffic AI engines drive to your site.
The problem goes deeper. Free ChatGPT users (the majority of ChatGPT's user base) do not send referrer data. Their visits appear as "Direct" traffic in GA4. Visible AI referrals represent only 30-40% of actual AI-driven visits. The rest is invisible.
Google AI Mode does not appear as a distinct referrer in GA4 either. AI-driven visits from Google search blend into your organic search channel, indistinguishable from traditional Google clicks.
To get accurate AI traffic data, you need three layers: custom GA4 channel groups for visible referrals, server log analysis for referrals GA4 misses, and AI citation monitoring to track mentions that do not generate direct clicks.
Step 1: Create a custom AI Search channel group in GA4#
GA4 lets you create custom channel groups that categorize traffic by your own rules. Create an "AI Search" channel that captures referrals from all known AI platforms.
Navigate to Admin > Data display > Channel groups > Create new channel group. Name it something descriptive like "Custom with AI." Then add a new channel called "AI Search" with the following conditions.
Set the condition to: Source matches regex pattern. The pattern should capture all known AI referral domains. Set this channel's priority above the default Referral channel so AI traffic gets categorized correctly.
After creating the channel, apply it to your reports. Go to Reports > Acquisition > Traffic acquisition and switch the Channel Group dimension to your custom group. AI search traffic will now appear as its own channel.
# GA4 Custom Channel Regex Pattern for AI Referral Sources
# Use this in your channel group definition under Source condition
# Pattern (case-insensitive):
chatgpt.com|chat.openai.com|perplexity.ai|claude.ai|gemini.google.com|copilot.microsoft.com|bing.com/chat|poe.com|you.com|phind.com|deepseek.com|grok.x.ai|meta.ai
# For the Session Source / Medium condition:
# Source matches regex: chatgpt|openai|perplexity|claude|gemini|copilot|poe|phind|deepseek|grok|meta.ai
# Medium exactly matches: referralStep 2: Track AI traffic in GA4 Explorations#
Create a GA4 Exploration report for deeper AI traffic analysis. Go to Explore > Free-form and build a report with these dimensions and metrics.
Dimensions: Session source, Session medium, Landing page, Device category, Date.
Metrics: Sessions, Engaged sessions, Engagement rate, Conversions, Revenue (if applicable).
Filter: Session source matches regex for your AI referral domains (same pattern as the channel group).
This exploration shows you which AI platforms drive the most traffic, which pages they land on, how engaged that traffic is, and whether it converts. Compare AI engagement rates to your Google organic baseline. AI referral traffic typically shows higher engagement and conversion rates.
Save this exploration as a template for monthly reporting. Track the trend over time. AI referral traffic is growing for most sites, and quantifying that growth justifies continued GEO investment.
Step 3: Catch hidden AI traffic with server logs#
GA4 misses a significant portion of AI traffic. Free ChatGPT users do not send referrer data. Some AI platforms strip referrer headers. Server log analysis catches visits that GA4 cannot.
Access your server logs (Apache access_log, Nginx access.log, or your CDN's log files). Search for two types of entries.
Track your AI visibility for free
See how ChatGPT, Claude, Gemini, and 4 other AI platforms mention your brand.
First, look for AI crawler user-agents: GPTBot, ChatGPT-User, OAI-SearchBot, ClaudeBot, PerplexityBot, and others. These are AI bots indexing your content, not user visits, but their frequency indicates which platforms are actively crawling your site.
Second, look for referrer headers containing AI platform domains. The referrer header may appear even when GA4 does not capture it. Parse logs for referrers matching chatgpt.com, perplexity.ai, claude.ai, and similar domains.
If you use Cloudflare, check your Cloudflare analytics for bot traffic. Cloudflare identifies AI crawlers in its bot analytics dashboard and shows crawl frequency, pages visited, and response codes. This data is more accessible than raw server logs for most teams.
# Parse Nginx access logs for AI referral traffic
# Shows page URLs visited from AI platform referrers
grep -iE "chatgpt.com|perplexity.ai|claude.ai|copilot.microsoft" /var/log/nginx/access.log | awk '{print $7}' | sort | uniq -c | sort -rn | head -20
# Parse for AI crawler user-agents
grep -iE "GPTBot|ChatGPT-User|ClaudeBot|PerplexityBot" /var/log/nginx/access.log | awk '{print $1, $7}' | sort | uniq -c | sort -rn | head -20
# Count AI crawler requests by day
grep -iE "GPTBot|ChatGPT-User|ClaudeBot|PerplexityBot" /var/log/nginx/access.log | awk '{print $4}' | cut -d: -f1 | sort | uniq -cStep 4: UTM parameters for trackable AI mentions#
When you control the link (your llms.txt file, your schema markup, your bio on review platforms), add UTM parameters to help GA4 attribute AI-driven traffic correctly.
In your llms.txt file, add UTM parameters to the URLs you list. When an AI engine cites a link from your llms.txt, the UTM parameters carry through to GA4, giving you clear attribution.
Apply the same approach to URLs in your schema markup (mainEntityOfPage URLs, author URLs) and any external profiles you control (Crunchbase, G2, industry directories).
This technique does not capture organic AI citations (where the AI generates a link to your homepage without UTMs). But it captures a subset of AI-driven traffic with clean attribution, adding to the data from your custom channel group and server log analysis.
# Example llms.txt with UTM-tagged URLs
# Note: use these for tracking only on links you control
## Products
- [AI Visibility Scanner](https://yourdomain.com/features?utm_source=llms_txt&utm_medium=ai_crawl&utm_campaign=ai_visibility): Track brand citations across AI platforms
- [Site Audit](https://yourdomain.com/features/audit?utm_source=llms_txt&utm_medium=ai_crawl&utm_campaign=ai_visibility): 78 AI ranking factor checksBuilding your AI traffic dashboard#
Combine all three data sources into a unified view. Use Looker Studio (free) or your preferred BI tool to pull GA4 data via the GA4 connector and server log data from BigQuery or a similar data warehouse.
Your dashboard should show: total AI referral sessions (GA4 custom channel), estimated hidden AI traffic (server log analysis), AI traffic trend over time (weekly or monthly), top landing pages from AI referrals, AI traffic conversion rate vs overall conversion rate, and AI crawler activity (crawl frequency by platform).
This dashboard proves the ROI of AI visibility optimization. When you can show that AI referral traffic converts at 73% versus 23% for Google organic, and that AI traffic is growing 15% month-over-month, the investment case for GEO makes itself.
BrandCited complements this dashboard with citation data that does not generate direct traffic. Not every AI mention produces a click. Citation monitoring tracks mentions across all platforms regardless of whether users click through to your site. Together, traffic data and citation data give you the complete picture.
Frequently asked questions
Why does GA4 show less AI traffic than I expected?
Free ChatGPT users do not send referrer data. Their visits appear as Direct in GA4. Google AI Mode visits blend into organic search. Visible AI referrals represent only 30-40% of actual AI-driven traffic. Server log analysis and citation monitoring capture the rest.
Can I track which AI queries led to visits?
GA4 does not receive query data from AI platforms. You can see which landing pages AI visitors arrive on (suggesting the topics that triggered the visit) but not the specific query. BrandCited tracks which queries cite your brand, providing the query-level data GA4 lacks.
How do I attribute revenue to AI traffic?
Set up conversion tracking in GA4 and apply your custom AI Search channel group. GA4 attributes conversions to the AI Search channel when the session source matches an AI platform. For multi-touch attribution, use GA4 data-driven attribution models.
Is AI referral traffic really higher quality?
Data consistently shows 73% first-session conversion rates for AI referrals versus 23% for Google organic. The trust transfer from an AI recommendation drives higher purchase intent. Track your own conversion rates by channel to verify this for your specific business.
Was this guide helpful?
Next in Technical Implementation
Up next
Building your brand entity for AI recognition
14 min read
Related guides
Put this into practice
Run a free BrandCited scan and see how your site scores on the factors covered in this guide.
Try BrandCited freeGet weekly AI visibility tips
New guides, platform updates, and practitioner case studies. Every Tuesday.