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
Create the middleware file
Add the following file to the root of your project (same level as
package.json):Fill in your credentials
Replace the two placeholder values in the file:
| Placeholder | Value |
|---|---|
<TRAFFIC_INGEST_SERVICE_URL> | The URL of the traffic-ingest-service (ask your Siftly admin) |
<YOUR_ORGANIZATION_ID> | Your Organisation ID from the Siftly dashboard |
Netlify
For Netlify, use an Edge Function instead of middleware:netlify/edge-functions/bot-tracker.js
netlify.toml:
netlify.toml