跳转到主要内容
GET
/
v1
/
analytics
/
{projectId}
/
searches
获取搜索查询
curl --request GET \
  --url https://api.mintlify.com/v1/analytics/{projectId}/searches \
  --header 'Authorization: Bearer <token>'
{
  "searches": [
    {
      "searchQuery": "<string>",
      "hits": 123,
      "ctr": 123,
      "topClickedPage": "<string>",
      "lastSearchedAt": "<string>"
    }
  ],
  "totalSearches": 1,
  "nextCursor": "<string>"
}

使用方法

使用此端点导出文档搜索分析数据。结果按搜索次数降序排列,展示用户最常搜索的词条。 使用响应中返回的 nextCursor 参数对结果进行分页。当 nextCursor 不为 null 时继续获取。

筛选

使用 dateFromdateTo 参数按日期范围过滤搜索数据。

响应数据

每个搜索词条目包含:
  • searchQuery:用户输入的搜索词
  • hits:该词被搜索的次数
  • ctr:该搜索词的点击率
  • topClickedPage:该查询中被点击最多的结果页面路径(如果有)
  • lastSearchedAt:该词最后一次被搜索的时间戳
响应还包含 totalSearches,即请求日期范围内所有搜索事件的总数(所有 hits 的总和,而非不同查询的数量)。

授权

Authorization
string
header
必填

Authorization 请求头需要使用 Bearer Token。请使用管理员 API key(以 mint_ 开头)。这是仅供服务端使用的密钥。你可以在控制台的 API keys 页面 中生成。

路径参数

projectId
string
必填

你的项目 ID,可在控制台的 API keys 页面中复制。

查询参数

dateFrom
string

ISO 8601 或 YYYY-MM-DD 格式的日期

示例:

"2024-01-01"

dateTo
string

不包含在内的上界

示例:

"2024-01-01"

limit
number
默认值:50

每页返回的最大搜索词数

必填范围: 1 <= x <= 100
cursor
string

上一次响应中的分页游标

响应

搜索词汇总数据

searches
object[]
必填

Search terms ordered by hit count descending.

totalSearches
integer
必填

Total count of search events in the requested date range.

必填范围: x >= 0
nextCursor
string | null
必填

Opaque pagination cursor for the next page. Null if no more results.