Files
mintlify__docs/cli/analytics.mdx
Ethan Palm db3ca0500d CLI updates (#5150)
* update skills

* update migration guide

* update API migration guide

* update assistant page

* update analytics page

* update CLI commands

* deprecate openapi-check

* add coming soon

* update docs.json

* add index page

* add install page

* add preview page

* add analytics

* add commands reference

* update links

* delete installation.mdx

* add optional prereq steps

* Add telemetry section to commands reference

Incorporates telemetry content from #5039 which was merged to main after
this branch was created. Documents opt-out flags, env variables, and
config persistence.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* move global flags to top

* vale

* remove `mint upgrade`

* remove unnecessary prereq

* restructure analytics commands

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 10:40:51 -07:00

133 lines
3.9 KiB
Plaintext

---
title: "Analyze your documentation"
description: "View traffic, search queries, feedback, and assistant conversations from the terminal using the Mintlify CLI."
keywords: ["mint analytics", "analytics", "CLI", "stats", "feedback", "conversations"]
---
The `mint analytics` command gives you access to your [documentation analytics](/optimize/analytics) from the terminal. This is useful for scripting analytics reports, piping data into other tools, and quick checks without opening the dashboard.
## Prerequisites
You must log in to use analytics commands. Run `mint login` to authenticate with your Mintlify account.
See [Preview locally](/cli/preview#log-in-for-search-and-assistant) for details on authentication.
## View key metrics
Display a summary of views, visitors, searches, feedback, and assistant usage:
```bash
mint analytics stats
```
Use flags to filter by date range, page, or traffic source:
- `--from`: Start date in `YYYY-MM-DD` format. Defaults to 7 days ago.
- `--to`: End date in `YYYY-MM-DD` format. Defaults to today.
- `--page`: Filter to a specific page path.
- `--humans`: Show only human traffic.
- `--agents`: Show only AI traffic.
```bash Example analytics stats flags
mint analytics stats --from 2025-01-01 --to 2025-01-31
mint analytics stats --page /quickstart
mint analytics stats --humans
mint analytics stats --agents
```
## View search analytics
See what your users are searching for, with hit counts and click-through rates:
```bash
mint analytics search
```
Use flags to filter by query string or page:
- `--query`: Filter by search query substring.
- `--page`: Filter to a specific page path.
```bash Example analytics search flags
mint analytics search --query "authentication"
mint analytics search --page /api-reference
```
## View feedback
Review feedback submitted by users on your documentation pages:
```bash
mint analytics feedback
```
Use flags to aggregate feedback by page, or filter to code snippet feedback:
- `--type`: Aggregate feedback by page or code snippet. Defaults to page.
- `--page`: Filter to a specific page path.
```bash Example analytics feedback flags
mint analytics feedback --type page
mint analytics feedback --type code
```
## View assistant conversations
List recent conversations and conversation category buckets from the AI assistant:
```bash
mint analytics conversation list
mint analytics conversation buckets list
```
Each list output includes an ID for each entry. Pass that ID to the corresponding `view` command to see full details:
```bash
mint analytics conversation view <conversation-id>
mint analytics conversation buckets view <bucket-id>
```
## Choose an output format
All analytics commands default to `plain` output, which is tab-separated and suitable for piping to other tools. Use `--format` to change the output:
```bash
mint analytics stats --format table # Pretty-printed table with colors
mint analytics stats --format json # Raw JSON
mint analytics stats --format graph # Horizontal bar chart
```
Use the `--agent` flag for JSON output. The CLI auto-detects agent environments when the `CLAUDECODE` environment variable is `1`.
## Set defaults with config
To avoid repeating common flags, set defaults with `mint config`. The configuration saves in `~/.config/mintlify/config.json`.
Available configuration keys:
| Key | Description |
| --- | --- |
| `subdomain` | Default subdomain for analytics commands. |
| `dateFrom` | Default start date for analytics queries (`YYYY-MM-DD`). |
| `dateTo` | Default end date for analytics queries (`YYYY-MM-DD`). |
```bash Example configs
mint config set subdomain my-docs
mint config set dateFrom 2025-01-01
```
Once set, analytics commands use these values automatically:
```bash
# Uses the configured subdomain and dateFrom without flags
mint analytics stats
```
To view or clear a value, run:
```bash
mint config get subdomain
mint config clear subdomain
```