Skip to main content

Why server-side

The OpenRevenue tracker.js runs in the browser, but bots like ChatGPT, Perplexity, Googlebot, and GPTBot don’t execute JavaScript — they just fetch your HTML. To see them you forward each request’s User-Agent to OpenRevenue from your server. OpenRevenue classifies it and records the crawl if it’s a known bot.
Forwarding is fire-and-forget. Non-bot requests are ignored, so it’s safe to call on every request.

Auth

Each project has its own bot ingest key. Copy it from the Bots tab empty state (or mint via getBotIngestKeyForDomain in the dashboard) and set OPENREVENUE_BOT_INGEST_KEY in your app env. Do not reuse a platform-wide secret — keys are bound to projectId. Alternatively send a write-scoped OpenRevenue API key as Authorization: Bearer openrevenue_… (the key’s owner must be able to access the project).

Next.js middleware

Add a middleware.ts at your project root. It runs on every request and reports the User-Agent without blocking the response.

Node / any backend

Any server can report a hit with a single POST. Express example:

Payload

POST https://api.openrevenue.com/api/track/bot with header x-openrevenue-bot-key set to your per-project bot ingest key (required in production), or a write-scoped Authorization: Bearer API key, and a JSON body:

What gets detected

Recognised bots are grouped into three categories: