Skip to content
Logo

AI crawlers and bots

The Bots & AI crawlers page in your project shows which crawlers fetch your site (GPTBot, ClaudeBot, PerplexityBot, OAI-SearchBot, ChatGPT-User, Googlebot, Bingbot and hundreds more), how often, which pages they read and which of those pages answered them with an error.

Why the script cannot see them

AI crawlers, AI assistants fetching a page for a user, and search engine bots download your HTML and leave. They do not run JavaScript, so the FlarePanel script (op1.js) never loads and nothing reaches FlarePanel. To see them, report page requests from the place that serves them: your server, your Cloudflare Worker or your framework's middleware. If your site is on Cloudflare, you can instead connect Cloudflare and skip the code.

What you report is matched against FlarePanel's bot list (several hundred user agents). A known bot is kept with its name, category, path, time, and the response status and verification you send. Anything else, including every human visitor, is dropped.

Bot hits are never analytics events: they do not appear in your reports and do not count towards your event quota. They are kept for 30 days. The Latest hits list keeps up to 5,000 hits a day; the totals, charts and tables count every hit.

What the page shows

Every bot is put in one of five groups, by what it fetched your page for:

GroupWhat it isExamples
AI answersAn AI assistant fetched the page because a person asked it something. These are the visits closest to a citation.ChatGPT-User, Claude-User, Perplexity-User, MistralAI-User, DuckAssistBot, Google-Agent, Meta-ExternalFetcher
AI search indexingCrawls that build the index AI search answers from.OAI-SearchBot, Claude-SearchBot, PerplexityBot, Google-CloudVertexBot
AI trainingCrawls that collect training data for models.GPTBot, ClaudeBot, Meta-ExternalAgent, Applebot-Extended, Bytespider, CCBot, Amazonbot
Search enginesClassic search crawlers.Googlebot, Bingbot
OtherEverything else: SEO tools, monitors, feed readers, previews.AhrefsBot, uptime checks

The tables also show the bot list's own category (for example AI Data Scraper). Days follow your workspace's time zone.

  • Crawled pages lists the most requested paths, including robots.txt, llms.txt, sitemaps and .md files, with the number of 4xx and 5xx responses bots got. Send the status field to fill these in.
  • Verified only keeps the hits your edge verified as the real crawler. User agents are easy to fake; Cloudflare checks a verified bot against its operator's published IP ranges. The switch turns itself on when the period has verified hits.
  • AI visibility puts the AI crawler activity next to the visits that came from AI answers (ChatGPT, Perplexity, Claude, Gemini and others) in the same period, so you can see crawling turn into visitors.

Monthly allowance

On FlarePanel Cloud a project keeps up to 100,000 bot hits a month (calendar month, UTC). Past that, /track/crawl still answers 202 with "capped": true, the hit is not stored, and the page says so until the next month starts. Self-hosted installs have no allowance.

Connect Cloudflare (no code)

If your site's DNS is proxied through Cloudflare (the orange cloud), FlarePanel can read the crawler traffic straight from your zone's analytics: no Worker, no code on your site. It works on every Cloudflare plan, including Free.

1. Create a read-only API token

  1. In the Cloudflare dashboard, open My Profile → API Tokens (dash.cloudflare.com/profile/api-tokens) and select Create Token.
  2. Next to Create Custom Token, select Get started.
  3. Name it, for example FlarePanel crawler import.
  4. Under Permissions, add:
    • Zone → Analytics → Read (required: this is what FlarePanel reads).
    • Zone → Zone → Read (optional: lets FlarePanel list your zones so you can pick one; without it you paste the zone ID).
  5. Under Zone Resources, select Include → Specific zone → your site's zone. Do not grant all zones.
  6. Leave Client IP Address Filtering empty (the import runs on Cloudflare's network, not from a fixed address). A TTL is fine, but the import stops when the token expires.
  7. Select Continue to summary, check that the summary lists only the read permissions above, then Create Token and copy it. Cloudflare shows it once.

The token can only read analytics. It cannot change DNS, settings or anything else in your account.

2. Connect it in FlarePanel

  1. Open your project's Bots & AI crawlers page and find the Cloudflare card (it is under the setup guide while the page is empty).
  2. Paste the token and select Continue. FlarePanel lists the zones the token can see; pick your site's zone. If the token has no Zone → Zone → Read, enter the Zone ID instead: it is on the zone's Overview page in Cloudflare, in the API section.
  3. Check the Hostnames. They start as your project's domain (with and without www.) and its allowed origins; only requests to these hostnames are imported. Leave the field empty to import every hostname in the zone.
  4. Select Connect. FlarePanel checks the token against the zone with one small query before it saves anything.

The token is stored encrypted and is never shown again; the card shows its last four characters only. Disconnect removes it from FlarePanel; delete the token in Cloudflare as well.

What happens next

  • The first sync reads the last 7 days. After that FlarePanel syncs every hour, a little past the hour, and picks up where the previous sync stopped (never more than 30 days back, which is what Cloudflare keeps). Sync now on the card queues a sync straight away.
  • FlarePanel reads Cloudflare's HTTP request analytics (httpRequestsAdaptiveGroups in the GraphQL Analytics API): real visitor requests (not Cloudflare's own), on your hostnames, whose user agent contains one of the AI crawler, AI assistant or search engine names FlarePanel recognises, per hour, path and response status. Each user agent is then matched against the same bot list as /track/crawl, so the groups, categories and 4xx/5xx columns work the same way. SEO tools, monitors and other bots are not imported; report those with a snippet if you want them.
  • The numbers are estimates. Cloudflare samples its analytics on busy zones and scales the counts back up, so imported hits are rounded estimates rather than an exact log. The page says so and marks the data source as Cloudflare. The Latest hits list gets a few sample rows per sync, marked Cloudflare, not every hit.
  • Imported hits are matched by user agent only, so Verified only does not include them.
  • Imported hits count towards the monthly allowance like reported ones.
  • Each sync uses a handful of queries; Cloudflare allows 300 analytics queries per 5 minutes per user. If the limit is hit, the sync waits and retries a few minutes later, and the card says so.

Snippet and Cloudflare together

You can use both. FlarePanel never adds them up for the same hour: an hour with any hit from your server snippet shows the snippet's exact numbers, and Cloudflare's estimates fill the hours the snippet did not report (for example before you installed it, or while it was down). If your snippet covers only part of the zone (say, docs.example.com), limit the Cloudflare connection to the other hostnames so the two do not overlap within an hour.

The page shows where the numbers come from: Server snippet, Cloudflare, or Server snippet + Cloudflare.

Cloudflare Workers

If your site runs behind Cloudflare, wrap the Worker that serves it. Every response is returned as it is; requests whose user agent looks like a bot are reported after the response is sent, with its status and what Cloudflare knows about the bot.

npm install @flarepanel/sdk
// A Worker on your site's route, for example example.com/*.
import { withCrawlCapture } from '@flarepanel/sdk';
 
interface Env {
  FLAREPANEL_CLIENT_ID: string;
  FLAREPANEL_CLIENT_SECRET: string;
}
 
export default withCrawlCapture({
  async fetch(request: Request, env: Env) {
    // Whatever the Worker already does: proxy to your origin, serve assets…
    return fetch(request);
  },
});

Set the two values on the Worker, the secret as a secret:

npx wrangler secret put FLAREPANEL_CLIENT_SECRET
// wrangler.jsonc
{
  "vars": { "FLAREPANEL_CLIENT_ID": "YOUR_CLIENT_ID" }
}

If the Worker serves static assets, return env.ASSETS.fetch(request) from fetch. Self-hosting? Set FLAREPANEL_API_URL to your API's address.

Verified bots

The wrapper sends Cloudflare's request.cf.verifiedBotCategory (for example AI Crawler or Search Engine Crawler) and request.cf.botManagement.verifiedBot when the request carries them. Cloudflare documents both with its Bot Management variables, and they are not present on every plan. When neither is present, the hit is kept without a verification, and Verified only stays off.

Without the package

The same thing by hand, if you would rather not add a dependency:

const FLAREPANEL_CRAWL_URL = 'https://api.flarepanel.dev/track/crawl';
// Cheap pre-filter. Anything it lets through is checked by FlarePanel.
const BOT_HINT =
  /bot|crawl|spider|slurp|scrape|archiver|preview|fetch|GPT|Claude|anthropic|Perplexity|Google-|cohere|MistralAI|meta-external|facebookexternalhit|Bytespider|Amazonbot|Applebot|DuckAssist|CCBot|Kimi|Grok|xAI/i;
// Assets are noise; robots.txt, llms.txt, sitemaps and pages are not.
const ASSET = /\.(?:css|js|mjs|map|png|jpe?g|gif|webp|avif|svg|ico|woff2?|ttf)$/i;
 
export default {
  async fetch(request, env, ctx): Promise<Response> {
    // Serve the page first: the report never delays it.
    const response = await fetch(request);
 
    const userAgent = request.headers.get('user-agent') ?? '';
    const url = new URL(request.url);
    if (
      request.method === 'GET' &&
      BOT_HINT.test(userAgent) &&
      !ASSET.test(url.pathname)
    ) {
      const verifiedCategory = request.cf?.verifiedBotCategory || undefined;
      ctx.waitUntil(
        fetch(FLAREPANEL_CRAWL_URL, {
          method: 'POST',
          headers: {
            'content-type': 'application/json',
            'openpanel-client-id': env.FLAREPANEL_CLIENT_ID,
            'openpanel-client-secret': env.FLAREPANEL_CLIENT_SECRET,
          },
          body: JSON.stringify({
            path: url.pathname,
            host: url.host,
            userAgent,
            referrer: request.headers.get('referer') ?? undefined,
            status: response.status,
            // Sent only when Cloudflare set it (see "Verified bots").
            ...(verifiedCategory
              ? { verified: true, verifiedCategory }
              : {}),
          }),
        }).catch(() => undefined)
      );
    }
 
    return response;
  },
} satisfies ExportedHandler<Env>;

Next.js middleware

// middleware.ts. On Next.js 16: proxy.ts, with the function named `proxy`.
import { captureCrawl } from '@flarepanel/sdk';
import {
  type NextFetchEvent,
  type NextRequest,
  NextResponse,
} from 'next/server';
 
export function middleware(request: NextRequest, event: NextFetchEvent) {
  // Reads FLAREPANEL_CLIENT_ID and FLAREPANEL_CLIENT_SECRET from the environment.
  captureCrawl(request, event);
  return NextResponse.next();
}
 
export const config = {
  // Pages only: skip Next.js internals and static files.
  matcher: [
    '/((?!_next/static|_next/image|favicon.ico|.*\\.(?:css|js|png|jpe?g|gif|webp|avif|svg|ico|woff2?)$).*)',
  ],
};

Put FLAREPANEL_CLIENT_ID and FLAREPANEL_CLIENT_SECRET in your environment (for example .env.local locally and your host's environment settings in production). Never prefix them with NEXT_PUBLIC_. Middleware runs before the page, so it cannot send the response status; on Cloudflare, the Worker wrapper can.

Any server

From any JavaScript server, after the response is on its way:

import { trackCrawl } from '@flarepanel/sdk';
 
await trackCrawl(
  {
    clientId: process.env.FLAREPANEL_CLIENT_ID!,
    clientSecret: process.env.FLAREPANEL_CLIENT_SECRET!,
  },
  { path: '/pricing', host: 'example.com', userAgent, status: 200 }
);

trackCrawl never throws; it answers null when the report could not be sent. Anything else can call the endpoint directly:

curl -X POST https://api.flarepanel.dev/track/crawl \
  -H "Content-Type: application/json" \
  -H "openpanel-client-id: $FLAREPANEL_CLIENT_ID" \
  -H "openpanel-client-secret: $FLAREPANEL_CLIENT_SECRET" \
  -d '{"path":"/pricing","host":"example.com","status":200,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; GPTBot/1.2; +https://openai.com/gptbot)"}'

The answer is {"bot":{"name":"GPTBot","type":"AI Data Scraper"},"capped":false}, and the hit shows up on the Bots & AI crawlers page within seconds.

The endpoint

POST https://api.flarepanel.dev/track/crawl

Self-hosting? Use your own API URL instead of https://api.flarepanel.dev.

HeaderValue
openpanel-client-idYour client ID
openpanel-client-secretYour client secret. Required: this endpoint only accepts server-side calls.
Content-Typeapplication/json

Body:

FieldType
pathstring, up to 2,048 charactersThe requested path (/pricing) or full URL. Required.
userAgentstring, up to 1,024 charactersThe request's User-Agent header. Required.
hoststringThe site's host (example.com). Optional; useful when one project tracks several sites.
referrerstringThe request's Referer header. Optional.
statusinteger, 100 to 599The HTTP status your site answered with. Optional; fills the 4xx and 5xx columns.
verifiedbooleanWhether your edge verified the bot. Optional; leave it out when you do not know.
verifiedCategorystring, up to 64 charactersYour edge's category for a verified bot, such as Cloudflare's verifiedBotCategory. Optional; sending it implies verified: true.

Responses:

StatusBodyMeaning
202{"bot":{"name":"GPTBot","type":"AI Data Scraper"},"capped":false}A known bot; the hit was recorded.
202{"bot":{…},"capped":true}A known bot, but the project used its monthly allowance; nothing was stored.
202{"bot":null,"capped":false}Not a known bot; nothing was stored.
401textMissing or wrong client ID or secret.
400JSONThe body is missing a field, or a field is too long or out of range.

The endpoint is not rate limited per IP address, because many sites call it from shared Cloudflare or hosting addresses.

Read the numbers back

With a read client, the same numbers the page shows:

curl "https://api.flarepanel.dev/insights/$PROJECT_ID/bots?range=30d&group=answers&verified=true" \
  -H "openpanel-client-id: $READ_CLIENT_ID" \
  -H "openpanel-client-secret: $READ_CLIENT_SECRET"

range (or startDate and endDate), group (answers, indexing, training, search, other) and verified are optional. The answer has totals, sources (hits from the server snippet and from Cloudflare), a daily series, topBots, topPaths (with status counts per class) and the month's usage. AI tools connected through MCP get the same through the get_bot_traffic tool.

Bots that run JavaScript

Some automation (headless browsers, a few monitoring tools) does run JavaScript. When the script sees a known bot user agent it records the hit on the same page instead of counting an event, so those appear without any setup.