Agent setup: authorize Sight MCP and ask your agent to call get_tracking_setup. It configures this integration automatically.

Express

Express middleware that forwards AI-crawler page requests to Sight's POST /api/v1/track, preserving the original User-Agent. Crawlers don't run JavaScript, so /script.js never fires for them unless they also fetch the script URL. This is the origin-side path.

Humans are not recorded here — they still use /script.js or @sightapp/analytics. Tracking every request would double-count people.

Part of Sight — see sightapp/sight-backend SPEC.md and tasks/plan.md (Track B4).

Install

npm install @sightapp/express

Until the package is on npm, from a sibling checkout:

npm install file:../sight-express

Usage

const express = require("express");
const { sightCrawler } = require("@sightapp/express");

const app = express();
app.use(
  sightCrawler({
    apiKey: process.env.SIGHT_API_KEY,
  }),
);

Put it early, before static-file middleware if you want crawler hits on HTML routes counted. GET only; other methods are ignored.

The UA token list matches sight-backend's internal/api/agents.go (GPTBot, ClaudeBot, PerplexityBot, …). Keep them in sync when that list grows.

Verify

curl -s http://localhost:3000/pricing -A "GPTBot/1.0"
curl -s "https://api.usesight.dev/api/v1/query/agent-traffic?days=1" \
  -H "X-API-Key: YOUR_API_KEY"

GPTBot should show up. A request with a Chrome UA should not.

Source repository