> AI agents: this is one page of nextanalytica's docs. The full index for agents: https://nextanalytica.app/llms.txt

# AI crawlers

> Count the requests of ChatGPT, Claude, Perplexity and other AI crawlers to your site with a Cloudflare Worker, and see which pages they read.

Updated: 2026-11-20

An AI crawler is a bot that reads your pages for an AI company: to train a model, to build a search index for answers, or to fetch a page because a person asked an assistant about it. It never runs the tag, so the tag can't see it. Your server sees it, so a sender on your server tells nextanalytica.

With a sender in place, your agent reads which bots came, which pages they read, and whether each one is who it says it is.

## What does a sender do?

For every request to your site, the sender looks at the user agent, the bot's name in the request. If it's the name of an AI crawler on the list below, the sender passes one hit to `https://t.nextanalytica.app/b` after your site has answered. Every other request is never sent.

Use one sender per site. Two senders on the same site, the Worker and the WordPress plugin for example, each send the same request, so every hit counts twice.

| Bot | Owner | Why it reads |
| --- | --- | --- |
| `ChatGPT-User` | OpenAI | A person asked ChatGPT about a page |
| `OAI-SearchBot` | OpenAI | Builds ChatGPT's search results |
| `GPTBot` | OpenAI | Trains models |
| `Claude-User` | Anthropic | A person asked Claude about a page |
| `Claude-SearchBot` | Anthropic | Builds Claude's search results |
| `ClaudeBot` | Anthropic | Trains models |
| `Perplexity-User` | Perplexity | A person asked Perplexity about a page |
| `PerplexityBot` | Perplexity | Builds Perplexity's search results |
| `Meta-ExternalFetcher` | Meta | A person asked a Meta assistant about a page |
| `Meta-ExternalAgent` | Meta | Trains models |
| `MistralAI-User` | Mistral | A person asked a Mistral assistant about a page |
| `DuckAssistBot` | DuckDuckGo | Fetches a page live for an AI answer |
| `Amazonbot` | Amazon | Improves Amazon's products and may train its models |
| `Bytespider` | ByteDance | Trains models |
| `CCBot` | Common Crawl | An open crawl others use to train models |

## What is sent and what isn't?

| Sent | Never sent or never kept |
| --- | --- |
| The time, your host, the path without its query, and the status your site answered | Cookies, request headers and page content |
| The bot's user agent, to name it | Any request from a person or another bot |
| The connecting IP address, to check the bot (see below) | The IP address after the check: nextanalytica never stores it |

nextanalytica keeps the bot's name, its owner and purpose, the host, the path, the status and the check's result. The path is cleaned like the tag's: emails and long ids are removed. The user agent isn't kept.

A crawler hit is not a visit. It belongs to no person and no session, and it is never counted in your visits, pages or channels.

## How do I set up the Cloudflare Worker?

You need your site's DNS on Cloudflare with the record proxied (the orange cloud), and a server key. For the key, see [What do you need?](/docs/tracking/segment-and-rudderstack#what-do-you-need) on the Segment and RudderStack page; it's the same key. Your agent can also make one with `make_server_key`.

1. In a new folder, install the package with `pnpm add @nextanalytica/tag wrangler`.
2. Create `src/worker.ts` with the line below. It re-exports the sender, which is already a complete Worker.
3. Create `wrangler.toml` with the `name` of your Worker, `main = "src/worker.ts"` and a `compatibility_date` of today.
4. Run `pnpm wrangler deploy`.
5. Store your server key as a secret: run `pnpm wrangler secret put NEXTANALYTICA_SERVER_KEY` and paste the key.
6. In the Cloudflare dashboard, open **Workers & Pages**, select your Worker, then **Settings** > **Domains & Routes** > **Add** > **Route**. Pick your zone and enter `example.com/*` with your own domain. Then set the route's failure mode to fail open, as described under the free plan's request limit in [Cloudflare's Workers limits](https://developers.cloudflare.com/workers/platform/limits).

The file `src/worker.ts`:

```ts title="src/worker.ts"
export { default } from "@nextanalytica/tag/cloudflare/crawlers";
```

The Worker returns your site's response as it is. It sends the hit after the response, without making anyone wait, and gives up after 1 second. If the send fails, nothing happens to your site, and if the Worker itself fails, the request goes on to your site as if the Worker weren't there.

> **Warning:** Set the route to fail open. The Workers Free plan allows **100,000** requests a day. The Worker runs on every request to your site, human ones too, and every one counts. A route that fails closed then shows your visitors Cloudflare's error 1027 for the rest of the day. A route that fails open sends the request to your site as it would go without the Worker: crawler hits stop for that day and your site keeps working. See [Cloudflare's Workers limits](https://developers.cloudflare.com/workers/platform/limits).

## How do I set up WordPress?

The nextanalytica WordPress plugin (1.2.0 and later) can send the hits itself. For the plugin itself, see [WordPress and WooCommerce](/docs/tracking/wordpress). To send crawler hits:

1. In WordPress, open **Settings** > **nextanalytica**.
2. Under **Server key (optional)**, paste your server key (see [What do you need?](/docs/tracking/segment-and-rudderstack#what-do-you-need) on the Segment and RudderStack page) and select **Save**. From a terminal or an agent: `wp nextanalytica server-key nask_…`.

The key is saved on your server only. The page never shows it again in full, and an empty field keeps the saved key. On a WooCommerce store, the same key also sends the orders the browser can't. Like those orders, crawler hits pause on a copy of the site at another address. The plugin sends the hit after WordPress has answered, and only for an AI crawler's request, so people never wait for it. When PHP runs under PHP-FPM or LiteSpeed, the plugin finishes the bot's response before sending. Elsewhere the bot's own response can wait up to half a second, the send's time limit.

> **Warning:** The plugin only sees requests that reach WordPress. A page served from a full-page cache (a caching plugin, your host's cache or a CDN) never reaches it, so a crawler that gets that page isn't counted. For a cached site, use the Cloudflare Worker above.

The plugin sends the address WordPress sees. When that address is one of [Cloudflare's own](https://www.cloudflare.com/ips/), the plugin sends the bot's address from Cloudflare's `CF-Connecting-IP` header instead, so the check works behind Cloudflare too. Behind another proxy or load balancer, WordPress sees the proxy's address, the check can't match the owner's list and the hit is stored as `unverified`.

## How do I set up Next.js?

In your app's `middleware.ts`, call `sendCrawlerHit`. You need a server key (see [What do you need?](/docs/tracking/segment-and-rudderstack#what-do-you-need) on the Segment and RudderStack page).

1. Install the package with `pnpm add @nextanalytica/tag`.
2. Store your server key as the environment variable `NEXTANALYTICA_SERVER_KEY` on your host.
3. Add the call to `middleware.ts`, as below. Pass the key from your own `middleware.ts`: Next.js gives middleware the environment variables it finds written in your code, and on Vercel's Edge runtime a read from inside a package may not be one of them.

```ts title="middleware.ts"
import { NextResponse, type NextFetchEvent, type NextRequest } from "next/server";
import { sendCrawlerHit } from "@nextanalytica/tag/next/crawlers";

export function middleware(req: NextRequest, event: NextFetchEvent) {
  sendCrawlerHit(req, event, { serverKey: process.env.NEXTANALYTICA_SERVER_KEY });
  return NextResponse.next();
}
```

The sender sends the hit after your response, without making anyone wait, and gives up after 1 second. If the send fails, nothing happens to your site.

The address it sends depends on your host. On Vercel and Netlify it sends the address the platform itself sets. Anywhere else it sends none, so the hits are stored as `unknown`. It never sends `x-forwarded-for`: wherever a proxy adds to that header, a client can write its first address, and a fake bot could borrow an owner's address. If you host the app yourself behind a proxy that overwrites a header with the client's address, pass that header with the `ip` option, for example `ip: (req) => req.headers.get("x-real-ip") ?? undefined`. Only do this when your proxy overwrites the header, never when it adds to it.

> **Note:** Middleware runs before your route, so the sender doesn't know the status your site answered. These hits are stored without a status, so they read as `unknown` in the dashboard's `crawl_status` part. Crawler hits never count in your site's own error rates.

To send for some paths only, set a `matcher` in `middleware.ts`. A page served from a CDN cache may never reach your middleware, so a crawler that gets it isn't counted.

## Does this work with Webflow?

Webflow supports Cloudflare in front of a custom domain through its orange-to-orange (O2O) setup. Follow Webflow's guide, [Using Cloudflare orange-to-orange (O2O) with Webflow](https://help.webflow.com/hc/en-us/articles/45039458051347-Using-Cloudflare-Orange-to-Orange-O2O-with-Webflow), to put your domain on Cloudflare. Then follow the Worker steps above for the same domain.

We haven't tested this setup ourselves.

## How does nextanalytica know a crawler is real?

Anyone can write `GPTBot` as their user agent. So for the owners that publish the addresses their crawlers come from, nextanalytica checks the connecting IP against those lists, then drops the IP. Each hit is stored with one of three results:

| Result | Meaning |
| --- | --- |
| `verified` | The IP is inside the owner's published addresses. The bot is who it says it is. |
| `unverified` | The owner publishes addresses and the IP is outside them. Most likely something pretending to be the bot. |
| `unknown` | The owner publishes no usable list, or the sender gave no IP. It can't be checked either way. |

OpenAI, Perplexity and Common Crawl publish their addresses, and nextanalytica refreshes a list when a hit arrives and its copy is more than a day old, and a failed refresh keeps the last good copy. Anthropic, Meta, Amazon, Mistral, DuckDuckGo and ByteDance publish no list nextanalytica can check against, so their hits are `unknown`.

## Why don't Gemini and Copilot show up?

Gemini and Copilot read your pages through Googlebot and Bingbot, the same bots that crawl for plain search. nextanalytica can't tell a fetch for Gemini from a fetch for Google Search, so neither bot is on the list and neither is sent.

## Did a fetch lead to a visit?

When a person asks ChatGPT, Claude or Perplexity about your site, the assistant often fetches your page right then. If the person then clicks through, the visit lands in the AI assistants channel. The `ai_chain` block of `get_dashboard` joins the two: it gives every visit in the AI assistants channel that started in the period one level, the first that fits.

| Level | Meaning |
| --- | --- |
| `fetched_page` | The same assistant fetched the page the visit entered on, in the **30 minutes** before the visit started. |
| `fetched_site` | The same assistant fetched another page of your site in those 30 minutes. |
| `ai_referred` | The visit came from the assistant with no fetch by it in those 30 minutes. |

The same assistant means a `ChatGPT-User` fetch counts for a visit from ChatGPT, a `Claude-User` fetch for a visit from Claude, a `Meta-ExternalFetcher` fetch for a visit from Meta AI, and so on. Only fetches made because a person asked count: a search or training crawl never does. A fetch checked as `unverified` never counts either; `verified` and `unknown` ones do.

The levels never overlap, so together they add up to the AI assistants channel's visits that started in the period. The `visits` metric for that channel can differ slightly: a visit that crossed midnight into the period, or a visit without a page view, can be counted by one and not the other. For each level your agent reads:

| Field | What it is |
| --- | --- |
| `sessions` | Visits at that level. |
| `conversions` | The visits' conversions, each counted once per visit, as in your [conversions](/docs/tracking/custom-events#how-does-an-event-become-a-conversion). |
| `revenue` | [Orders](/docs/tracking/custom-events#record-an-order) in those visits, plus Stripe payments that carry the visitor's id (see below), in your project's currency at the European Central Bank's rate of each day. |

A Stripe payment counts for the person's latest visit that started before it, and only when that person sent no order in the period, so a purchase sent both as an order and through Stripe counts once. Refunds don't reduce revenue, as in the `revenue` metric. Conversions and orders after the period's last day aren't counted, so a visit that started near the end of the period may have more than its level shows.

The block also has:

- `routes`: up to **20** pages, each with its live fetches in the period and the `fetched_page` visits that entered on it, the most visits first, then the most fetches.
- `median_lag_seconds`: the median time from the fetch to the visit, for `fetched_page` visits.
- `revenue_left_out`: money the chain can't tie to a visit, Stripe payments without the visitor's id and Odoo orders and won deals.
- `money_note`, only when some amounts had no exchange rate for their day: how many, left out of the money.

When the period has no visit in the AI assistants channel, no live fetch and no one who said an assistant sent them, the block is a note instead of zeros. If the block can't be read in time, it's a note too, and the rest of the dashboard is complete.

Every `ai_chain` answer with levels carries this note, word for word:

> **Note:** Levels show visits that followed an assistant's fetch in time, not proof the answer caused the visit. Most fetches lead to no visit.

A level says what happened in what order, not why. Most people who read an assistant's answer never click, so many fetches have no visit after them.

## Who says an assistant sent them?

Many people read an assistant's answer, then come later by typing your address or searching your name. Those visits land in Direct or Organic search, never in a level. When your site asks "How did you hear about us?" and sends the answer as `heard_from` (see [Custom events](/docs/tracking/custom-events#how-do-i-record-where-people-heard-about-you)), the block counts those people in `self_reported`:

| Field | What it is |
| --- | --- |
| `people` | People with an answer in the period that names an AI assistant, whatever channel their visits came from. |
| `conversions` | Their visits' conversions in the period, each counted once per visit. |
| `revenue` | Orders in their visits in the period, those your server sent included, plus their Stripe payments when they sent no order in the period, in your project's currency. |
| `also_in_levels` | Those of them with a visit in the AI assistants channel in the period, so at one of the three levels too. |

`self_reported` is never added to the levels. A person who is also at a level shows in both, and `also_in_levels` says how many did, so nothing is counted twice when you read them together.

A person counts once, however many times they answer, and when any of their answers names an assistant: "a friend", then "ChatGPT", counts. A person is someone who agreed to cookies or whom your site identified, by their own id or the `user_id` your server sends. A visitor who answers before agreeing to cookies has no id, so their answer counts once, in that visit, with that visit's conversions and orders. People you asked to forget are left out.

## What does the chain leave out?

- Visits that reach your site without the assistant's referrer or a UTM tag land in Direct, not the AI assistants channel, so they're not in the chain.
- Gemini and Copilot visits are always `ai_referred`: their fetches can't be told apart from search crawling (see [Why don't Gemini and Copilot show up?](#why-dont-gemini-and-copilot-show-up)).
- `DuckAssistBot` fetches show in `routes` but never give a visit a `fetched_page` or `fetched_site` level: nextanalytica doesn't tie them to an assistant's visits.
- Stripe payments without the visitor's id and Odoo money are counted in `revenue_left_out`, not in a level.
- The block covers every device, even when you ask the dashboard for one, and it has no comparison with the period before.

## How do I check it works?

Ask your agent to check the setup:

- "Check my nextanalytica setup." `check_setup` lists the senders that sent AI crawler hits in the last 7 days, or says none has.
- "Which AI crawlers read my site this week?" `get_dashboard` has an `ai_traffic` block with `crawlers` (each bot with its purpose, its check result, its hits and the pages it read), `crawled_routes` (the pages bots read because a person asked an assistant about them, without `unverified` hits) and `crawl_status` (the hits by the class of status your site answered: `2xx`, `3xx`, `4xx`, `5xx` or `unknown`).

To try it, fetch a page with a bot's name as your user agent:

```bash
curl -A "ChatGPT-User/1.0" https://example.com/pricing
```

That hit comes from your own address, so it's stored as `unverified`: it shows the Worker works, and that nextanalytica doesn't trust a name alone.

## Next steps

- [What the tag collects](/docs/tracking): what the tag counts on its own.
- [Segment and RudderStack](/docs/tracking/segment-and-rudderstack): the other thing a server key sends.
- [Agent keys and OAuth](/docs/model-context-protocol/agent-keys): how your agent signs in.

Canonical address: https://nextanalytica.app/docs/tracking/ai-crawlers
