Skip to main content
AI bot traffic detection — Vercel/Netlify middleware intercepts AI crawler requests

How It Works

Framework middleware intercepts every incoming request before your page code runs. When an AI bot is detected, the bot’s metadata is sent to the traffic-ingest-service as a fire-and-forget background fetch — zero latency added to real user loads.

Setup

1

Create the middleware file

Add the following file to the root of your project (same level as package.json):
2

Fill in your credentials

Replace the two placeholder values in the file:
3

Deploy

Commit and push (or run vercel deploy). The middleware activates automatically on every incoming request.No additional environment variables, build steps, or packages are required.

Netlify

For Netlify, use an Edge Function instead of middleware:
netlify/edge-functions/bot-tracker.js
Add the edge function route in netlify.toml:
netlify.toml

Verifying It Works

After deploying, visit your site with a spoofed User-Agent to confirm events appear in Siftly:
Check the Traffic section of the Siftly dashboard within a few minutes.