Knocklog

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

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

See how your Next.js site treats AI agents

The check is free and needs no sign-up.

Sources

Read next