How to Track AI Crawler and Answer-Fetch Traffic in Cloudflare, Vercel and Nginx
Tell AI answer fetches, search crawls, training crawls and AI referrals apart in your server logs, with copy-paste filters for Cloudflare, Vercel log drains, Nginx and SQL, and why browser analytics miss most of it.
On this page
When ChatGPT, Claude or Perplexity answers a question about your product, it often fetches one of your pages first. That request lands in your server or CDN logs and almost never in your analytics, because the fetcher runs no JavaScript. This guide shows how to separate the four kinds of AI traffic in your logs, with filters to copy for Cloudflare, Vercel, Nginx and SQL, and how to read the requests for pages that don't exist.
Four kinds of AI traffic
Count these separately. They answer different questions, and adding them together produces a number that means nothing.
| Kind | What happened | Example user agents | What it tells you |
|---|---|---|---|
| Answer fetch | An AI system retrieved your page to build an answer for someone, right now | ChatGPT-User, Claude-User, Perplexity-User, DuckAssistBot | Which pages AI answers read about your topic |
| Search crawl | An AI search crawler indexed your page so it can be found and cited later | OAI-SearchBot, Claude-SearchBot, PerplexityBot, bingbot | Whether AI search knows the page exists |
| Training crawl | A crawler collected your page as possible training data | GPTBot, ClaudeBot, Bytespider, Meta-ExternalAgent, Amazonbot | What goes into future models |
| AI referral | A person clicked a link in an AI answer and arrived on your site | A normal browser, with a referrer such as chatgpt.com | Which answers send you visitors |
Two smaller groups sit beside them:
- Coding agents. Claude Code, Gemini CLI, Aider, OpenCode, Qwen Code and Crush fetch pages from a developer's machine while writing code, with user agents such as
claude-code/andGoogle-Gemini-CLI/. These are answer fetches too, and worth counting on their own if your buyers write code. - Acting agents.
Google-Agentnavigates sites and takes actions when a person asks it to.
The answer fetch is the one to watch most closely. It is the closest signal you have to "an AI answer about this topic just read this page", and it happens whether or not the answer ever sends a visitor.
The AI user-agent lookup names the crawler or agent behind any user agent or log line you paste, and puts it in one of these groups.
Why browser analytics miss it
Google Analytics, PostHog and similar tools count a visit when the page's JavaScript runs in a browser. AI fetchers request the HTML and stop. So:
- Answer fetches and crawls never appear. The request is served and logged by your server or CDN, and no analytics script runs.
- 404s never appear. When an AI system requests a page that doesn't exist, nothing on your site records it except the server log. These requests are demand: an answer expected a page, often with a guessed URL like
/docs/webhooksor/pricing/enterprise, that you haven't published. - Referrals do appear, sometimes. A person clicking through from an AI answer runs your analytics script. Browsers that block your analytics script still hide some of them.
So AI traffic needs two sources: the server or CDN log for machines, and analytics for people.
Filter your logs
Each filter below matches the answer fetchers DevTune's AI Traffic counts. The user-agent lookup generates the same filters for every group, including coding agents, search crawlers and training crawlers.
Cloudflare
For a WAF custom rule, use an expression:
(lower(http.user_agent) contains "chatgpt-user") or (lower(http.user_agent) contains "claude-user") or (lower(http.user_agent) contains "claude-web") or (lower(http.user_agent) contains "perplexity-user") or (lower(http.user_agent) contains "duckassistbot") or (lower(http.user_agent) contains "google-notebooklm") or (lower(http.user_agent) contains "mistralai-user") or (lower(http.user_agent) contains "amzn-user/")
To export the raw requests, add a filter to a Logpush job on the HTTP requests dataset so it ships only matching lines:
{
"where": {
"or": [
{
"key": "ClientRequestUserAgent",
"operator": "contains",
"value": "ChatGPT-User"
},
{
"key": "ClientRequestUserAgent",
"operator": "contains",
"value": "Claude-User"
},
{
"key": "ClientRequestUserAgent",
"operator": "contains",
"value": "Claude-Web"
},
{
"key": "ClientRequestUserAgent",
"operator": "contains",
"value": "Perplexity-User"
},
{
"key": "ClientRequestUserAgent",
"operator": "contains",
"value": "DuckAssistBot"
},
{
"key": "ClientRequestUserAgent",
"operator": "contains",
"value": "Google-NotebookLM"
},
{
"key": "ClientRequestUserAgent",
"operator": "contains",
"value": "MistralAI-User"
},
{
"key": "ClientRequestUserAgent",
"operator": "contains",
"value": "Amzn-User/"
}
]
}
}
Include EdgeResponseStatus in the job's fields so you can split 200s from 404s and from the 403s your own bot rules send.
Vercel
A Vercel log drain sends request logs as newline-delimited JSON. Log drains need a Vercel Pro or Enterprise team. Filter a saved batch with jq:
jq -c 'select((.proxy.userAgent // []) | tostring | test("ChatGPT-User|Claude-User|Claude-Web|Perplexity-User|DuckAssistBot|Google-NotebookLM|MistralAI-User|Amzn-User\\/"; "i"))' vercel-logs.ndjson
proxy.statusCode and proxy.path on each line give you the status and page.
Nginx
Write AI answer fetches to their own log with a map:
map $http_user_agent $ai_bot {
default 0;
"~*(ChatGPT-User|Claude-User|Claude-Web|Perplexity-User|DuckAssistBot|Google-NotebookLM|MistralAI-User|Amzn-User\/)" 1;
}
access_log /var/log/nginx/ai-answer-fetch.log combined if=$ai_bot;
The map block goes in the http context; the access_log line goes in the server block for your site.
SQL
If your logs already land in a database, one query splits every kind apart. Coding agents come first so their fetches count on their own:
SELECT
CASE
WHEN user_agent ILIKE ANY (ARRAY['%Google-Gemini-CLI/%', '%opencode%', '%claude-code/%', '%QwenCode/%', '%crush/1%', '%Aider/%']) THEN 'coding_agent'
WHEN user_agent ILIKE ANY (ARRAY['%DuckAssistBot%', '%Amzn-User/%', '%ChatGPT-User%', '%Claude-User%', '%Claude-Web%', '%Perplexity-User%', '%Google-NotebookLM%', '%MistralAI-User%']) THEN 'answer_fetch'
WHEN user_agent ILIKE ANY (ARRAY['%Google-Agent%']) THEN 'acting_agent'
WHEN user_agent ILIKE ANY (ARRAY['%Amzn-SearchBot/%', '%OAI-SearchBot%', '%Claude-SearchBot%', '%PerplexityBot%', '%Google-CloudVertexBot%', '%Applebot/%', '%bingbot%', '%MistralAI-Index%']) THEN 'ai_search_index'
WHEN user_agent ILIKE ANY (ARRAY['%Amazonbot/%', '%GPTBot%', '%ClaudeBot%', '%anthropic-ai%', '%Bytespider%', '%Meta-ExternalAgent%']) THEN 'model_training'
ELSE 'other'
END AS ai_traffic,
count(*) AS requests
FROM access_logs
GROUP BY 1
ORDER BY requests DESC;
Check the requests are real
A user agent is a claim. Anyone can send ChatGPT-User, and scrapers do. Before you act on the numbers, check the source address against the ranges the operator publishes:
- OpenAI:
https://openai.com/chatgpt-user.json,https://openai.com/searchbot.jsonandhttps://openai.com/gptbot.json - Anthropic:
https://claude.com/crawling/bots.json - Perplexity:
https://www.perplexity.ai/perplexity-user.jsonandhttps://www.perplexity.ai/perplexitybot.json - Microsoft:
https://www.bing.com/toolbox/bingbot.json
Coding agents are the exception. Claude Code and Gemini CLI run on the developer's own machine, so their requests come from ordinary home and office addresses and can't be checked this way.
Read the 404s
Filter AI answer fetches and search crawls to 404 responses and group them by path. Clusters of guessed URLs show the pages AI systems expect you to have. A run of requests for /docs/rate-limits means answers about your product look for rate-limit documentation and find none.
For each cluster, either publish the page or redirect the path to the page that answers it. Then keep your sitemap current so crawlers find the new page quickly: the sitemap checker confirms robots.txt declares your sitemap, shows how fresh its lastmod dates are, and gives you an IndexNow submission to copy.
Track referrals
Referrals come through your analytics, identified by the referrer host or the utm_source tag on the landing URL. The hosts to match:
chatgpt.comandchat.openai.comclaude.aiperplexity.aigemini.google.comcopilot.microsoft.commeta.ai
Match on utm_source as well as referrer. ChatGPT adds utm_source=chatgpt.com to many of its links, though not all; October 2026 ChatGPT Referral Drop - Unpacked shows what happens to reports when that tag goes missing. Exclude clicks carrying a paid utm_medium so ads don't count as AI referrals.
Do it without the log work
DevTune's AI Traffic does all of the above continuously. Connect one crawler sensor per hostname: a Cloudflare pull, edge middleware in your app, or a Vercel log drain. AI Traffic then counts answer fetches, search crawls, training crawls and coding-agent fetches separately by page and platform, checks hosted crawlers and fetchers against their operators' published addresses, and clusters 404 demand into the pages to publish. Connect GA4, PostHog or the DevTune snippet for referral visits and what they convert to.
The same numbers are available over the REST API and the MCP server, so you can ask Claude Code, Cursor or another agent which pages ChatGPT fetched this week. Integrations has the connect steps for each agent.
Before any of it, make sure the crawlers can reach you: robots.txt for AI search crawlers covers the rules and the CDN settings that block them.