# Caprail — analytics for AI agents

> Your analytics can't see AI agents. Caprail can. See ChatGPT, Claude,
> Gemini and every AI agent reading your site, live — even headless crawlers
> that never run JavaScript.

The HTML landing page demos this live: it detects each visitor server-side
(browser, country, AI referral source) from request headers alone and streams
the result into its live traffic visualization. If you are an AI agent reading
this markdown, that detection is exactly how you were classified and served
this file.

## What Caprail does

Caprail is server-side analytics built for AI agent traffic. A tiny collector
in your middleware beacons request metadata (method, path, user agent) to the
Caprail ingest API, where each request is classified by who
sent it:

- **Crawlers** — ClaudeBot, GPTBot, CCBot, Google-Extended, …
- **Fetchers** — Claude-User, ChatGPT-User, Perplexity-User, Gemini, Codex, …
- **Search bots** — Googlebot, Bingbot, OAI-SearchBot, Claude-SearchBot, …
- **Agentic browsers** — ChatGPT Agent / Atlas, …
- **Humans** — everything else

Because classification happens server-side from raw request facts, headless
agents that never execute JavaScript are counted too — the blind spot of
script-tag analytics.

The dashboard shows a live feed of agent requests, grades every response by
served format (**markdown ✓** is agent-readable, **html ✗** is not), and
tracks **AI referrals**: human visitors arriving from ChatGPT, Perplexity,
Claude, and other AI surfaces — so you can measure AI ROI in both directions.

## Install (Next.js, two lines)

```ts
// proxy.ts / middleware.ts
import { createCaprailMiddleware } from "@caprail-dev/analytics/next";

export const middleware = createCaprailMiddleware();

export const config = {
  matcher: ["/((?!_next/static|_next/image|favicon.ico).*)"],
};
```

Adapters also exist for Cloudflare Workers and generic Node servers (Express,
Hono). Full agent-readable instructions: [/install.md](https://caprail.dev/install.md).

## Get started

Sign up at [https://caprail.dev](https://caprail.dev) with GitHub or Google. Free during the
private beta — no credit card.

## Blog

Notes on the agentic web, from the people building Caprail:
[/blog](https://caprail.dev/blog). Every post is also served as markdown,
and the feed is at [/blog/rss.xml](https://caprail.dev/blog/rss.xml).

## More

- Blog: [/blog](https://caprail.dev/blog)
- Install guide: [/install.md](https://caprail.dev/install.md)
- Terms & conditions: [/terms.md](https://caprail.dev/terms.md)
- Doc index: [/llms.txt](https://caprail.dev/llms.txt)
