Setup guide

Connect a site in three steps: create a site and copy its key, send visits with the edge sensor or your server code, then check the dashboard.

1. Get a site key

Create an account, open Sites and account, enter your hostname (for example example.com) and choose Add site. Copy the key that appears. It is shown only once, and you can rotate it later. Need a separate key for another server? Create more under API keys on the same page, and revoke any of them on its own.

2a. Edge sensor (sites on Cloudflare)

No code changes. The sensor runs in front of your site, passes every request through, and reports only bot visits.

  1. In the Cloudflare dashboard open Workers and Pages, then Create, then Create Worker.
  2. Replace the code with the contents of edge-sensor.js, then deploy.
  3. In the Worker's Settings, Variables, add the text variable TRACKER_URL with the value https://your-tracker.example and the secret TRACKER_KEY with your site key.
  4. Under Domains and Routes add the route example.com/* for your zone. Set the failure mode to fail open so your site keeps loading if the Worker is ever unavailable.

2b. Node.js (Express)

const { AiBotTracker } = require('./middleware/nodejs');

app.use(new AiBotTracker({
  database: false, // or { type: 'sqlite', path: './data/bot_visits.db' } to also keep a local copy
  report: { endpoint: 'https://your-tracker.example', key: process.env.TRACKER_KEY, site: 'example.com' },
}).middleware());

Copy the middleware/nodejs, core and signatures folders from the project together.

2c. Flask

from ai_bot_tracker_flask import AiBotTrackerFlask

AiBotTrackerFlask(app, {
    "database": False,
    "report": {"endpoint": "https://your-tracker.example", "key": os.environ["TRACKER_KEY"], "site": "example.com"},
})

2d. Django

MIDDLEWARE = ["ai_bot_tracker_django.AiBotTrackerMiddleware", ...]
AI_BOT_TRACKER = {
    "database": False,
    "report": {"endpoint": "https://your-tracker.example", "key": os.environ["TRACKER_KEY"], "site": "example.com"},
}

2e. PHP

The PHP middleware reports bot visits for you. People are ignored, and a tracker that is down never breaks your page.

$tracker = new AiBotTracker\AiBotTracker([
    'database' => false,   // report only
    'report' => ['endpoint' => 'https://your-tracker.example', 'key' => getenv('TRACKER_KEY'), 'site' => 'example.com'],
]);
$tracker->processRequest();

2f. Any language: one HTTPS call

Send a POST for each request, or up to 100 events at a time in {"events": [...]}. The key decides which site the visit belongs to. People are ignored, so you can send every request.

curl -X POST https://your-tracker.example/api/ingest \
  -H "Authorization: Bearer abt_your_site_key" \
  -H "Content-Type: application/json" \
  -d '{"ip":"132.196.86.5","ua":"Mozilla/5.0; compatible; GPTBot/1.4","path":"/pricing","status":200}'

Fields: ua and path are required. Optional: ip, method, status, referer, country, asn, asOrg, ts (unix seconds).

3. Check it works

Send the curl command above with your key, then open the dashboard. A GPTBot visit appears under Training within a few seconds. If you get 401, the key is wrong, was rotated or was revoked.

4. Read your stats from a script

Under API keys on the Sites and account page, create a read key for all your sites or for one. It can read the same numbers as the dashboard, and nothing else: it cannot send visits, change keys or open your account.

curl -H "Authorization: Bearer abtr_your_read_key" \
  "https://your-tracker.example/api/v1/summary?range=7d"

Other endpoints: timeseries, bots, pages, heatmap, recent, export.csv, export.json and sites. Add ?range=24h|7d|30d|90d, &site=ID or &ai=0 to include search and social crawlers. Keep read keys out of web pages and public repositories; anyone who has one can read your stats until you revoke it.