Add SenseGap to Next.js or Node
1. Add the package
npm install https://sensegap.com/downloads/sensegap-node.tgz2. Set your site key
Create a key on your site's Install page under Next.js / Node, then add it to .env and to your host's environment variables (Vercel, Railway, your server):
SENSEGAP_KEY=your-site-key3. Turn it on
Next.js 16: create proxy.ts next to your app folder.
import { withSenseGap } from "@sensegap/node/next";
export const proxy = withSenseGap(); // or withSenseGap(yourExistingProxy)
export const config = { matcher: ["/((?!_next/static|_next/image|favicon.ico).*)"] };On Next.js 15 and earlier, name the file middleware.ts and export middleware instead of proxy.
Express, Connect or plain Node:
import { senseGap } from "@sensegap/node";
app.use(senseGap());Only bot requests and visits from AI products are sent. Plain human traffic is dropped on your server. Files your host serves from a CDN never reach your code, so bot visits to them aren't seen.
The package is open source: read it on GitHub.