Agent setup: authorize Sight MCP and ask your agent to call
get_tracking_setup. It configures this integration automatically.
Django
Django 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 the browser tracker 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 the browser tracker. Tracking every request would double-count people.
Part of Sight — see
sightapp/sight-backend
SPEC.md and tasks/plan.md (Track B4).
Install
settings.py:
Config comes from Django settings (not constructor args) since Django
instantiates middleware itself with just get_response — this is the
standard way Django middleware takes configuration.
GET requests only; other methods are ignored. The send happens in a
background thread — a slow/unreachable Sight backend never adds latency
to the real request.
The UA token list matches sight-backend's internal/api/agents.go
(GPTBot, ClaudeBot, PerplexityBot, …). Keep them in sync when that list
grows.
Verify
GPTBot should show up. A request with a Chrome UA should not.
Tests
5 tests, all passing against real Django (RequestFactory, settings
configured programmatically — no mocked framework internals): agent
detection, a GPTBot GET producing exactly one tracked call, a human GET
producing none, and the required-SIGHT_API_KEY check.