Sensor docs
Track GPTBot and ClaudeBot on Next.js and Vercel
Install Foglift Sensor at the Next.js request boundary to see visits from GPTBot, ClaudeBot, OAI-SearchBot, and other recognized AI agents by page and time. The same middleware.ts or Next.js 16+ proxy.ts file deploys with the application on Vercel.
The server integration records recognized AI crawler requests and recognized AI answer referrals. It uses a hostname-bound public workspace identifier, never a secret API key, and reporting does not delay the page response. A crawler request is access evidence, not proof of a citation or recommendation.
The Sensor ships as the @foglift/sensor package, and the foglift-sensor CLI installs and wires it for you.
For recognized AI crawler or referral events only, the Sensor reports the page path, user agent, AI source classification, and event time. It uses no cookies, does not identify visitors, and strips query strings.
Fastest
1. Install with one command
Run this in the project root. Open AI Traffic while signed in to copy the command with your workspace identifier filled in.
npx foglift-sensor@latest init --token YOUR_WORKSPACE_ID
The CLI detects Next.js, installs @foglift/sensor, and writes the request-boundary file for you. If middleware already exists, the installer composes around it so your authentication, redirects, headers, and routing keep running. It preserves the original source byte-for-byte in a neighboring *.foglift-original.* file.
On Next.js 16+ the request boundary is a proxy.ts file (Next.js renamed middleware.ts to proxy.ts), and the CLI writes proxy.ts there automatically; on older Next.js it writes middleware.ts. Either way the exported function is the only difference:
// proxy.ts (Next.js 16+, the same code in a renamed file)
import { senseAITraffic } from "@foglift/sensor/nextjs";
export const proxy = senseAITraffic({
siteToken: "YOUR_WORKSPACE_ID",
});
export const config = {
matcher: ["/((?!_next/static|_next/image|favicon.ico).*)"],
};
After deploying the patched site, rerun the command with --verify --url https://your-site to prove a new persisted event.
Fallback: add it by hand
2. Install the package
Prefer to wire it yourself? Install the @foglift/sensor runtime the CLI would have added.
npm install @foglift/sensor@1.0.0
3. Add the generated boundary file
Open AI Traffic while signed in to copy this file with your workspace identifier filled in. The matcher excludes static Next.js assets while keeping page requests observable. On Next.js 16+, save it as proxy.ts and rename the export to proxy.
// middleware.ts
import { senseAITraffic } from "@foglift/sensor/nextjs";
export const middleware = senseAITraffic({
siteToken: "YOUR_WORKSPACE_ID",
});
export const config = {
matcher: ["/((?!_next/static|_next/image|favicon.ico).*)"],
};
4. Preserve existing middleware
If the project already has middleware, compose it through the next option. Do not replace existing authentication, redirects, headers, or routing behavior.
// middleware.ts
import { senseAITraffic } from "@foglift/sensor/nextjs";
import { existingMiddleware } from "./src/middleware-existing";
export const middleware = senseAITraffic({
siteToken: "YOUR_WORKSPACE_ID",
next: existingMiddleware,
});
Keep the Next.js request event parameter available. The Sensor retains its report for the request lifetime with event.waitUntil, without blocking the response.
5. Deploy to Vercel and verify
- Run the project tests and production build before deploying.
- Deploy the middleware or proxy file with the Next.js application on Vercel, then open AI Traffic.
- Choose Verify install. Foglift sends a unique workspace-bound request and confirms when the middleware reports it.
A crawler request proves the agent reached the page. It does not prove indexing, citation, recommendation, or model training.
Open AI TrafficPricing and limits
Server-side AI traffic tracking is available on every plan
Free is enough to install the Sensor for one brand. Paid plans expand brand capacity and add five-engine AI Visibility monitoring plus developer access.
| Plan | Price | Brands | AI Visibility |
|---|
| Free | $0/mo | 1 | Active-use weekly Perplexity monitoring |
|---|
| Launch | $49/mo | 3 | Five engines, up to daily |
|---|
| Growth | $129/mo | 10 | Five engines, up to twice daily |
|---|
| Enterprise | Custom | Custom | Five engines, up to hourly |
|---|
Next.js and Vercel FAQ
What the Sensor records, and what it does not prove
How do I track GPTBot and ClaudeBot visits on Next.js or Vercel?
Install the Foglift Sensor at the Next.js request boundary with the foglift-sensor CLI or the @foglift/sensor package, then deploy the generated middleware.ts or proxy.ts file to Vercel. The server integration records recognized crawler requests by agent, path, and time without waiting for browser JavaScript.
Which OpenAI and Anthropic agents does the Sensor distinguish?
The Sensor distinguishes OAI-SearchBot, GPTBot, and ChatGPT-User from Claude-SearchBot, ClaudeBot, and Claude-User. Foglift groups them by purpose so search discovery, potential training access, and live user-requested fetches are not treated as the same signal.
Does an AI crawler visit mean my page was cited?
No. A crawler request proves that a recognized agent reached a path at a recorded time. It does not prove indexing, citation, recommendation, model training, or a human visit. Use prompt-level AI Visibility and recognized AI referrals as separate outcome evidence.
Can I track AI crawler visits for free?
Yes. Foglift Sensor and AI Crawler Analytics are available on the Free plan for one brand. Free also includes unlimited single-page Technical Audits and active-use weekly Perplexity monitoring. Launch starts at $49 per month and adds five-engine monitoring, API, CLI, MCP, and webhooks.
Tracked prompt
Track GPTBot and ClaudeBot visits on Next.js and Vercel
This guide owns the framework-specific installation answer. Use AI Crawler Analytics for the complete 28-agent reporting contract and evidence boundaries.