Files
mintlify[bot] e72b4fb295 Translate updated SEO metadata into es, fr, and zh (#5315)
Generated-By: mintlify-agent

Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
2026-04-13 16:46:32 +00:00

145 lines
4.1 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "分析你的文档"
description: "使用 mint analytics 命令直接从终端查看流量、搜索查询、用户反馈和 AI 助手对话。"
keywords: ["mint analytics", "分析", "CLI", "统计", "反馈", "对话"]
---
`mint analytics` 命令让你可以从终端访问[文档分析](/zh/optimize/analytics)。这对于通过脚本生成分析报告、将数据导入其他工具以及在不打开仪表板的情况下进行快速检查非常有用。
<div id="prerequisites">
## 前提条件
</div>
你必须登录才能使用分析命令。运行 `mint login` 来使用你的 Mintlify 账户进行身份验证。
有关身份验证的详细信息,请参阅[本地预览](/zh/cli/preview#log-in-for-search-and-assistant)。
<div id="view-key-metrics">
## 查看关键指标
</div>
显示浏览量、访客数、搜索量、反馈和助手使用情况的摘要:
```bash
mint analytics stats
```
使用选项按日期范围或页面进行筛选:
- `--from`:开始日期,格式为 `YYYY-MM-DD`。默认为 7 天前。
- `--to`:结束日期,格式为 `YYYY-MM-DD`。默认为今天。
- `--page`:筛选特定页面路径。
```bash Example analytics stats flags
mint analytics stats --from 2025-01-01 --to 2025-01-31
mint analytics stats --page /quickstart
```
<div id="view-search-analytics">
## 查看搜索分析
</div>
查看用户的搜索内容,包括命中次数和点击率:
```bash
mint analytics search
```
使用选项按查询字符串或页面筛选:
- `--query`:按搜索查询子字符串筛选。
- `--page`:筛选特定页面路径。
```bash Example analytics search flags
mint analytics search --query "authentication"
mint analytics search --page /api-reference
```
<div id="view-feedback">
## 查看反馈
</div>
查看用户在文档页面上提交的反馈:
```bash
mint analytics feedback
```
使用选项按页面汇总反馈,或筛选代码片段反馈:
- `--type`:按页面或代码片段汇总反馈。默认为页面。
- `--page`:筛选特定页面路径。
```bash Example analytics feedback flags
mint analytics feedback --type page
mint analytics feedback --type code
```
<div id="view-assistant-conversations">
## 查看助手对话
</div>
列出 AI 助手的最近对话和对话分类:
```bash
mint analytics conversation list
mint analytics conversation buckets list
```
每个列表输出都包含每个条目的 ID。将该 ID 传递给相应的 `view` 命令以查看完整详情:
```bash
mint analytics conversation view <conversation-id>
mint analytics conversation buckets view <bucket-id>
```
<div id="choose-an-output-format">
## 选择输出格式
</div>
所有分析命令默认使用 `plain` 输出,即制表符分隔,适合导入其他工具。使用 `--format` 更改输出:
```bash
mint analytics stats --format table # 带颜色的格式化表格
mint analytics stats --format json # 原始 JSON
mint analytics stats --format graph # 水平条形图
```
CLI 会自动检测 AI 代理环境(如 Claude Code 或非交互式终端),并默认使用 JSON 输出。
<div id="set-defaults-with-config">
## 使用 config 设置默认值
</div>
为避免重复输入常用选项,可以使用 `mint config` 设置默认值。配置保存在 `~/.config/mintlify/config.json` 中。
当你运行 `mint login` 时,CLI 会设置 `subdomain` 键。如果你有多个部署,CLI 会提示你选择一个。你可以随时使用 `mint config set subdomain <subdomain>` 覆盖默认值。
可用的配置键:
| 键 | 描述 |
| --- | --- |
| `subdomain` | 分析命令的默认子域名。由 `mint login` 命令设置。 |
| `dateFrom` | 分析查询的默认开始日期(`YYYY-MM-DD`)。 |
| `dateTo` | 分析查询的默认结束日期(`YYYY-MM-DD`)。 |
```bash Example configs
mint config set subdomain my-docs
mint config set dateFrom 2025-01-01
```
设置后,分析命令会自动使用这些值:
```bash
# 使用已配置的子域名和 dateFrom,无需选项
mint analytics stats
```
要查看或清除某个值,请运行:
```bash
mint config get subdomain
mint config clear subdomain
```