AI Agents
The AI Agents page shows ChatGPT, Claude, Perplexity, Gemini, Meta AI, Claude Code and other AI products: the pages they read, whether they fetched HTML, markdown or llms.txt, and the visitors they sent you.
Agents that run JavaScript and visitors referred by AI assistants show up automatically through the Databuddy script. Crawlers and coding agents like GPTBot, ClaudeBot and Claude Code don't run JavaScript, so they only show up once @databuddy/sdk/agents runs on your server.
Setup
No API key is needed, only your website ID. If you already use the Databuddy SDK, it's set:
NEXT_PUBLIC_DATABUDDY_CLIENT_ID=your_website_idThe NUXT_PUBLIC_, VITE_ and REACT_APP_ versions of the variable work too, as does DATABUDDY_WEBSITE_ID. Requests are only recorded when they come from your website's domain or one of its allowed origins, so local development never shows up.
Next.js and Fumadocs
If you don't have a proxy yet, create proxy.ts (Next.js 16) next to your app folder:
export { proxy } from "@databuddy/sdk/agents";On Next.js 15, create middleware.ts instead:
export { proxy as middleware } from "@databuddy/sdk/agents";If you already have a proxy, add one line to it:
import { trackAgents } from "@databuddy/sdk/agents";
import { type NextFetchEvent, type NextRequest, NextResponse } from "next/server";
export function proxy(request: NextRequest, event: NextFetchEvent) {
event.waitUntil(trackAgents(request));
return NextResponse.next();
}Fumadocs sites need nothing extra. Markdown requested through a .md URL or an Accept: text/markdown header is recorded as markdown, and llms.txt and llms-full.txt are recorded on their own.
Vercel (any framework)
For Vite, Astro or any other site on Vercel, add middleware.ts at the project root:
export { proxy as default } from "@databuddy/sdk/agents";Cloudflare Workers, Hono and other fetch handlers
import { trackAgents } from "@databuddy/sdk/agents";
export default {
async fetch(request, env, ctx) {
ctx.waitUntil(trackAgents(request, { websiteId: "your_website_id" }));
return fetch(request);
},
};Workers don't have process.env, so pass the website ID as an option.
Express and Node
import { trackAgents } from "@databuddy/sdk/agents";
app.use((req, _res, next) => {
trackAgents(req);
next();
});What gets recorded
trackAgents only reports GET and HEAD requests from known AI products, and skips images, scripts, styles and fonts. Each request records the page path without its query string, the host, the user agent, the referrer, the agent, and the format served:
It never throws and never delays your response: requests to Databuddy run in the background and time out after 3 seconds.
Test your setup
Deploy, then open the AI Agents page in your dashboard and click Test setup. Databuddy requests your homepage and /llms.txt as GPTBot and tells you whether each request was recorded. Test requests never show up in your data.
Static hosts without middleware (GitHub Pages, S3) and hosted docs platforms that don't let you run code can't report crawler requests.
How is this guide?