跳转到主要内容
GET
/
v1
/
analytics
/
{projectId}
/
visitors
Get unique visitors
curl --request GET \
  --url https://api.mintlify.com/v1/analytics/{projectId}/visitors \
  --header 'Authorization: Bearer <token>'
{
  "totals": {
    "human": 123,
    "ai": 123,
    "total": 123
  },
  "visitors": [
    {
      "path": "<string>",
      "human": 123,
      "ai": 123,
      "total": 123
    }
  ],
  "hasMore": true
}

使用方法

使用此端点导出独立访客分析数据。结果包括全站总计和按页面的明细,按人类和 AI 流量分类。total 字段在人类和 AI 流量之间去重。 使用基于偏移量的分页浏览结果。当 hasMore 为 true 时,将 offset 增加 limit 的值。

筛选

使用 dateFromdateTo 参数按日期范围过滤访客数据。

响应数据

响应包含一个 totals 对象(全站聚合数据)和一个 visitors 数组(按页面的数据)。每个条目包含:
  • path:文档页面路径
  • human:来自人类流量的独立访客数
  • ai:来自 AI 机器人流量的独立访客数
  • total:近似独立访客数(在人类和 AI 之间去重)

授权

Authorization
string
header
必填

The Authorization header expects a Bearer token. Use an admin API key (prefixed with mint_). This is a server-side secret key. Generate one on the API keys page in your dashboard.

路径参数

projectId
string
必填

Your project ID. Can be copied from the API keys page in your dashboard.

查询参数

dateFrom
string

Date in ISO 8601 or YYYY-MM-DD format

示例:

"2024-01-01"

dateTo
string

Date in ISO 8601 or YYYY-MM-DD format. dateTo is an exclusive upper limit. Results include dates before, but not on, the specified date.

示例:

"2024-01-01"

limit
integer
默认值:50

Max results per page (1-250, default 50). Increment offset by limit while hasMore is true to paginate.

必填范围: 1 <= x <= 250
offset
integer
默认值:0

Number of rows to skip. Use offset = (page - 1) * limit for page-based access.

必填范围: x >= 0

响应

Site-wide totals and per-path visitor counts

totals
object
必填

Site-wide unique visitor totals for the date range.

visitors
object[]
必填

Per-page visitor counts.

hasMore
boolean
必填

Whether additional results are available beyond this page.