> This page is for version v1 (default).
> For other versions, use one of these documentation indexes:
> - v1 (default): https://docs.butterix.com/en/llms.txt
> - v0: https://docs.butterix.com/en/v0/llms.txt

> For the MDX source of any page, append .mdx to the page URL.
> For a complete documentation index, see https://docs.butterix.com/en/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.butterix.com/_mcp/server.
> If something on this page is wrong or missing, POST JSON {"page": "<page URL>", "message": "<what is wrong>"} to https://docs.butterix.com/_biti/feedback/agent.

# Traffic

`GET /sites/{site}/analytics`

Splits traffic by User-Agent into humans, AI (training crawlers and AI assistants), and other crawlers. `.md` requests, requests for index and spec files, and MCP calls are counted separately.

Base URL: https://api.butterix.com/v1

Authentication: bearer token in Authorization header or API key in cookie `biti_session`

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `site` | string | yes | Site slug or id |

## Query parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `days` | integer | no |  |

## Example request

```bash
curl https://api.butterix.com/v1/sites/acme-payments/analytics \
     -H "Authorization: Bearer <token>"
```

## Responses

### 200

Statistics

Content type: `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `totals` | object | no |  |
| `totals.views` | integer | no | Total page and .md visits |
| `totals.humanViews` | integer | no |  |
| `totals.visitors` | integer | no | 访客数，按天去重后累计，真人、AI 与爬虫都算 |
| `totals.aiViews` | integer | no | AI crawlers and AI assistants |
| `totals.botViews` | integer | no | Search engines and other crawlers |
| `totals.markdownRequests` | integer | no |  |
| `totals.agentFileRequests` | integer | no | Requests for indexes (llms.txt, llms-full.txt) and API spec files, not included in the numbers above |
| `totals.mcpCalls` | integer | no |  |
| `totals.searches` | integer | no |  |
| `totals.questions` | integer | no |  |
| `totals.feedbackUp` | integer | no |  |
| `totals.feedbackDown` | integer | no |  |
| `daily` | list of objects | no |  |
| `daily[].date` | date | no |  |
| `daily[].human` | integer | no |  |
| `daily[].ai` | integer | no |  |
| `daily[].bot` | integer | no |  |
| `daily[].visitors` | object | no | 当天按类型去重的访客 |
| `daily[].visitors.human` | integer | no |  |
| `daily[].visitors.ai` | integer | no |  |
| `daily[].visitors.bot` | integer | no |  |
| `topPages` | list of objects | no |  |
| `topPages[].path` | string | no |  |
| `topPages[].views` | integer | no |  |
| `aiAgents` | list of objects | no |  |
| `aiAgents[].name` | string | no |  |
| `aiAgents[].count` | integer | no |  |
| `referrers` | list of objects | no |  |
| `referrers[].host` | string | no |  |
| `referrers[].count` | integer | no |  |
| `countries` | list of objects | no |  |
| `countries[].code` | string | no |  |
| `countries[].count` | integer | no |  |
| `notFound` | list of objects | no |  |
| `notFound[].path` | string | no |  |
| `notFound[].count` | integer | no |  |
| `agentFiles` | list of objects | no | Most requested index and spec files |
| `agentFiles[].path` | string | no |  |
| `agentFiles[].type` | enum | no | Allowed: `index`, `spec`. |
| `agentFiles[].agents` | integer | no |  |
| `agentFiles[].humans` | integer | no |  |
| `agentFiles[].count` | integer | no |  |
| `topSearches` | list of objects | no |  |
| `topSearches[].q` | string | no |  |
| `topSearches[].count` | integer | no |  |

### Example response (200)

```json
{
  "totals": {
    "views": 1,
    "humanViews": 1,
    "visitors": 1,
    "aiViews": 1,
    "botViews": 1,
    "markdownRequests": 1,
    "agentFileRequests": 1,
    "mcpCalls": 1,
    "searches": 1,
    "questions": 1,
    "feedbackUp": 1,
    "feedbackDown": 1
  },
  "daily": [
    {
      "date": "2026-11-20",
      "human": 1,
      "ai": 1,
      "bot": 1,
      "visitors": {
        "human": 1,
        "ai": 1,
        "bot": 1
      }
    }
  ],
  "topPages": [
    {
      "path": "string",
      "views": 1
    }
  ],
  "aiAgents": [
    {
      "name": "ClaudeBot",
      "count": 1
    }
  ],
  "referrers": [
    {
      "host": "github.com",
      "count": 1
    }
  ],
  "countries": [
    {
      "code": "CN",
      "count": 1
    }
  ],
  "notFound": [
    {
      "path": "string",
      "count": 1
    }
  ],
  "agentFiles": [
    {
      "path": "/llms.txt",
      "type": "index",
      "agents": 1,
      "humans": 1,
      "count": 1
    }
  ],
  "topSearches": [
    {
      "q": "Custom domains",
      "count": 1
    }
  ]
}
```
