AI traffic: Cloudflare
What it does
Section titled “What it does”This connection works today. The other screens show what the engines say; the AI Traffic screen shows what the bots did: which page they fetched, how many times, and what your server answered. A page that returns 404 to PerplexityBot cannot be cited, no matter how good the content is.
There are two routes. Logpush is Cloudflare’s own batch delivery: no extra cost, and it works in hourly batches. A Worker catches the request as it happens, and it is the only option when the Logpush menu does not appear on your plan.
Requirements
Section titled “Requirements”- The Radar Pro or Custom plan in Zeo Radar. Log upload and the ingest token unlock with those plans.
- Your domain served through Cloudflare, plus admin access to the dashboard.
- An ingest token, generated with the “Connect a continuous stream” button on the AI Traffic screen in the app. The token represents your brand, so keep it secret; generating a new one invalidates the old one.
Route 1: Logpush
Section titled “Route 1: Logpush”- In the Cloudflare dashboard, select your domain and go to Analytics & Logs > Logpush.
- Choose Create a Logpush job, with HTTP destination as the target.
- Paste the address below as the endpoint, with your token in it. The trailing parameter matters: Cloudflare sends the batch as gzipped bytes, and without that header the batch is mistaken for text and cannot be read.
https://app.zeoradar.com/api/bot-logs?token=YOUR_INGEST_TOKEN&header_Content-Type=application%2Foctet-stream- Set the dataset to HTTP requests. Under Send the following fields, these six fields are enough:
ClientIPClientRequestHostClientRequestURIClientRequestUserAgentEdgeResponseStatusEdgeStartTimestamp- Choose Submit. Before it saves the job, Cloudflare tests the endpoint with a gzipped trial batch; if the job saves, the connection is working.
Route 2: Worker
Section titled “Route 2: Worker”The Worker below passes the request through, returns the response without holding it up, and
sends only the AI bot lines to Zeo Radar. Define ZEO_RADAR_URL, including your token, as a
secret variable.
const AI_BOTS = /(OAI-SearchBot|ChatGPT-User|PerplexityBot|Perplexity-User|Claude-SearchBot|Claude-User|GPTBot|ClaudeBot|anthropic-ai|Google-Extended|CCBot|Bytespider|meta-externalagent|meta-webindexer|meta-externalfetcher|Applebot-Extended|Applebot|Diffbot|Timpibot|Googlebot|Bingbot|Amazonbot)/;
export default { async fetch(request, env, ctx) { const response = await fetch(request); const ua = request.headers.get("user-agent") || ""; if (env.ZEO_RADAR_URL && AI_BOTS.test(ua)) { const row = { ts: new Date().toISOString(), ua: ua, path: new URL(request.url).pathname, status: response.status, ip: request.headers.get("cf-connecting-ip") || null }; ctx.waitUntil( fetch(env.ZEO_RADAR_URL, { method: "POST", headers: { "Content-Type": "application/x-ndjson" }, body: JSON.stringify(row) + "\n" }).catch(() => {}) ); } return response; }};- Create a Worker with
npx wrangler init zeo-radar-bot-logsand put the code insrc/index.js. - Run
npx wrangler secret put ZEO_RADAR_URLand enter the full address including the token. - Publish it with
npx wrangler deploy, then point the Worker at your domain in the dashboard.
Verify it works
Section titled “Verify it works”Open the AI Traffic screen in the app. With Logpush traffic appears within an hour, with a Worker within a few minutes. You can also trigger it yourself:
curl -A "PerplexityBot/1.0" https://yourdomain.com/ -o /dev/null -sThe Bot requests counter on screen should go up, and a PerplexityBot row should appear
in the table.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause | Fix |
|---|---|---|
| The Logpush job will not save, “error validating destination” | The address is missing the header_Content-Type parameter | Paste the address exactly as shown in step 3 |
| The job saved but no data arrives | A field is missing, the user agent is not being sent | Tick the ClientRequestUserAgent field |
| Response 401 “Unknown ingest token” | The token is wrong, or a new one has been generated | Get a new token from the app and update the address |
| The Worker is live but the counter does not move | ZEO_RADAR_URL is undefined, or there is no Worker route | Check the secret variable and the route match |
| There is no Logpush menu in the dashboard | Your Cloudflare plan does not include Logpush | Use the Worker route |
| A high number in the unverified column | The bot name arrives from an address the vendor never published | That means a fake bot, block it at the network layer rather than in robots.txt |
feedback.question
feedback.thanks