Documentation
AI Agent Analytics
Most AI agents don't reliably execute third-party scripts. Measure gives them a way to be counted — automatically, or by self-reporting.
The blind spot
AI agents like ChatGPT, Claude, and Perplexity browse the web on behalf of their users. They fetch pages, read content, and follow links — but many don't execute third-party scripts, and even those that do may not trigger analytics reliably. That means this growing category of traffic is often invisible to site owners.
Measure solves this with three complementary approaches: automatic detection from User-Agent strings, a simple self-reporting API, and discovery mechanisms that let agents find the reporting endpoint without any prior knowledge of the site.
How it works
Step 1
Automatic detection
When any request hits the collect endpoint, Measure checks the User-Agent for known AI agent signatures (GPTBot, ClaudeBot, PerplexityBot, and others). If a match is found, the visit is automatically categorized under that agent in your dashboard. No configuration needed.
Step 2
Self-reporting API
Agents can explicitly identify themselves by including an
agent
field in their collect request. Self-reported names take priority
over User-Agent detection, giving agents full control over how
they appear in analytics.
Step 3
Endpoint discovery
Agents can find the collect endpoint without prior knowledge of
the site using two mechanisms: a
/.well-known/measure.json
file and an
X-Analytics-Ping
HTTP header.
Collect API
Send a POST request to report a page visit:
POST /api/collect
Content-Type: application/json
{
"site_id": "abc123def456",
"path": "/products/widget",
"agent": "MyAgent/1.0",
"referrer": "search-query",
"utm_source": "ai-agent",
"utm_medium": "referral",
"utm_campaign": "product-research"
} | Field | Required | Description |
|---|---|---|
site_id | Yes | The site's tracking ID |
path | Yes | The page path visited (e.g. /about) |
agent | Recommended | Your agent's name and version (e.g. MyAgent/1.0) |
referrer | No | Referring URL or source name |
utm_source | No | Campaign source |
utm_medium | No | Campaign medium |
utm_campaign | No | Campaign name |
The endpoint returns a 1x1 transparent GIF with a
200 status.
A 404 means the
site_id is invalid. A 429
means the site has exceeded its plan limits.
Example: curl
curl -X POST https://lets.measure.events/api/collect \
-H "Content-Type: application/json" \
-d '{
"site_id": "YOUR_TRACKING_ID",
"path": "/page-you-visited",
"agent": "MyAgent/1.0"
}' Discovery: .well-known/measure.json
Sites using Measure can host a
/.well-known/measure.json
file that tells agents how to report their visits. Agents should check
for this file when visiting a new domain, similar to how they check
robots.txt.
GET /.well-known/measure.json
{
"analytics_provider": "Measure",
"version": "1.0",
"collect_endpoint": "https://lets.measure.events/api/collect",
"method": "POST",
"content_type": "application/json",
"payload": {
"site_id": "your tracking ID (required)",
"path": "page path visited (required)",
"agent": "your agent name (recommended)",
"referrer": "referring URL or agent name (optional)"
},
"privacy": "https://example.com/privacy",
"documentation": "https://lets.measure.events/docs/ai-agents"
}
The collect_endpoint
is the full URL to POST visit data to. The
payload object
describes the expected fields and their purpose.
Discovery: X-Analytics-Ping header
Measure includes an
X-Analytics-Ping
response header on script and collect endpoint responses. The header
contains the full collect URL with the site's tracking ID pre-filled:
X-Analytics-Ping: https://lets.measure.events/api/collect?site_id=abc123def456
When an agent encounters this header on any HTTP response, it can send a
POST to the URL with a JSON body containing
path and
agent fields
to report its visit.
For site owners
If you use Measure, AI agent traffic from known agents is detected automatically. No extra setup required — just add the tracking script as usual and agent visits will appear in your dashboard.
To support cooperative self-reporting from agents, you can optionally
add a /.well-known/measure.json
file to your site. Create the file at the root of your domain with the
following content:
{
"analytics_provider": "Measure",
"version": "1.0",
"collect_endpoint": "https://lets.measure.events/api/collect",
"payload": {
"site_id": "YOUR_TRACKING_ID",
"path": "page path visited",
"agent": "agent name"
}
}
Replace YOUR_TRACKING_ID
with your site's tracking ID from the Measure dashboard.
Privacy guarantees
Agent analytics follow the same privacy-first architecture as all of Measure. We store aggregated counters only — never individual requests, IP addresses, or session identifiers.
- Agent name stored as aggregate count
- No individual request logs
- No IP addresses stored
- No session tracking or correlation
- Cannot reconstruct browsing patterns
- Same privacy architecture as human traffic
Automatically detected agents
Measure currently recognizes the following AI agents by their User-Agent strings:
| Agent | Provider |
|---|---|
| GPTBot | OpenAI |
| ChatGPT | OpenAI |
| ClaudeBot | Anthropic |
| PerplexityBot | Perplexity |
| Google AI (Google-Extended) | |
| Bytespider | ByteDance |
| CCBot | Common Crawl |
| Amazonbot | Amazon |
| FacebookBot | Meta |
Agents not on this list can use the
agent
field in the collect API to self-identify.
Building an AI agent?
Help site owners understand their AI traffic. It takes one HTTP request.
Questions? Reach out at support@measure.events.