Skip to main content
The Cloudflare integration logs AI crawler and search bot visits to your site through a Cloudflare Worker. The Worker passes every request through to your site unchanged and sends a log line for each HTML page to ChatFeatured. The visits show up in Agent Analytics. In ChatFeatured, open Integrations and click Cloudflare under Agent analytics. The page has your API keys, the Worker code and a Copy Instructions button.

Before you start

  • Your site’s DNS must run through Cloudflare.
  • Buy the Cloudflare Workers Paid plan first ($5 a month), under Compute > Workers Plans in Cloudflare. The Worker runs on every request on its route, assets included, and the free plan stops at 100,000 requests a day, after which a busy site can stop logging or fail with Cloudflare error 1027. See Cloudflare’s Workers pricing.
  • Creating an API key needs an Owner or Admin by default.

Set it up

1

Create an API key

On the Cloudflare integration page, click New API Key, enter a name and click Create API Key. Copy the key from the dialog. Keys start with aa_.Any Agent Analytics key works for every log source, so you can reuse one from Website > Agent Analytics > Settings. A new key can take up to a minute to start working.
2

Create the Worker

  1. In the Cloudflare dashboard, click Workers & Pages in the sidebar.
  2. Click Create Application, select Start with Hello World! and click Deploy.
  3. Click Edit Code, clear the editor, paste the code below and click Deploy.
3

Add the endpoint and key

In the Worker’s settings, open Variables and Secrets and add two entries:Add ANALYTICS_KEY as a Secret. Click Deploy after adding them.
4

Route your domain through the Worker

  1. Open your domain in Cloudflare and click Workers Routes in the sidebar.
  2. Click Add Route.
  3. Enter a pattern scoped to your site, such as example.com/*. Use *example.com/* if you also want subdomains like www.example.com and blog.example.com.
  4. Select your Worker and click Save.
To leave a section out, add a more specific route, such as example.com/admin/*, with its Worker set to None.

Check that it works

A browser visit won’t show anything, because ChatFeatured keeps only requests from recognized bots. Send a request with a crawler user agent instead:
The visit should appear in Website > Agent Analytics within a few minutes, as a GPTBot request. If it doesn’t, test the key on its own:
A working key returns {"status":"accepted","accepted":1,"filtered":0}. If that works but the first test doesn’t, check the route, the Worker’s variables, and any Cloudflare security setting that might block the test request.

What gets recorded

ChatFeatured keeps requests from AI crawlers and search engine bots (see what gets counted) and discards everything else.

What the Worker skips

The Worker only reports text/html responses with a status below 500, and skips static files by extension. So crawler fetches of robots.txt, llms.txt and sitemap.xml don’t appear. To track them, remove txt|xml from IGNORE_EXT and loosen the !contentType.startsWith("text/html") check.

Troubleshooting

Missing API key means the X-API-Key header didn’t arrive. Invalid API key means the key is mistyped, deactivated, deleted, or less than a minute old.
The key works, but the userAgent in the body didn’t match a known bot. Use a crawler string such as GPTBot/1.0.
You’re probably on the Workers free plan and went past 100,000 requests. Upgrade to Workers Paid under Compute > Workers Plans.