How to see AI crawler traffic on a Next.js site on Vercel or Netlify
Analytics tools for Next.js measure visits that run JavaScript in the browser. AI agents request the HTML and leave, so they never show up. The place in Next.js that sees every request is middleware.
Why middleware
Middleware runs before each page is served, including static and cached pages. That is where you can read each request's user agent, IP and signatures and send a summary out in the background, without making the response wait.
How to install
- Create the free Knocklog project with your site's address and pick Next.js.
- No middleware yet: save the generated file at the project root as proxy.js (Next.js 16 or newer) or middleware.js (earlier versions). Your ingest key is already in it.
- Already have middleware: copy the reportToKnocklog function into it and call event.waitUntil(reportToKnocklog(request)) at the top.
- Deploy. Visits show in the report right away.
export function middleware(request, event) {
event.waitUntil(reportToKnocklog(request));
// ...your middleware stays the same
}If the site is behind Cloudflare
If your domain runs through Cloudflare, installing there also covers files and routes middleware does not reach, and works with any framework. It is one click in the Knocklog dashboard.
What you get to see
- Which AI agents read the site and which pages each one read.
- Which were genuine and which used someone else's name.
- How many people AI assistants sent and which became leads.
See how your Next.js site treats AI agents
The check is free and needs no sign-up.
Sources
Read next
- Knocklog vs Cloudflare AI Crawl Control vs Known Agents
- How to block AI training without disappearing from ChatGPT
- What is llms.txt and how to create yours
- An RB2B alternative that also sees the AI agents
- GPTBot vs ChatGPT-User vs OAI-SearchBot: what each OpenAI bot does
- How to see AI bot traffic on WordPress
- How to tell if the GPTBot, ClaudeBot or Googlebot that visited your site is fake
- How the 1,000 most-visited websites treat AI agents
- How to see ChatGPT traffic in Google Analytics 4
- Tools to see which AI agents and crawlers visit your website
- How to make a Lovable site visible to ChatGPT and other AI agents
- How to see which AI agents visit my website
- Directory of AI agents