> ## Documentation Index
> Fetch the complete documentation index at: https://www.mintlify.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Analyze your documentation

> Use the mint analytics command to view traffic, search queries, user feedback, and AI assistant conversations directly from your terminal.

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 theme={null}
mint analytics stats
```

Use flags to filter by date range or page:

* `--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.

```bash Example analytics stats flags theme={null}
mint analytics stats --from 2025-01-01 --to 2025-01-31
mint analytics stats --page /quickstart
```

## View search analytics

See what your users are searching for, with hit counts and click-through rates:

```bash theme={null}
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 theme={null}
mint analytics search --query "authentication"

mint analytics search --page /api-reference
```

## View feedback

Review feedback submitted by users on your documentation pages:

```bash theme={null}
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 theme={null}
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 theme={null}
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 theme={null}
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 theme={null}
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
```

The CLI automatically detects AI agent environments like Claude Code or non-interactive terminals and defaults to JSON output.

## Set defaults with config

To avoid repeating common flags, set defaults with `mint config`. The configuration saves in `~/.config/mintlify/config.json`.

When you run `mint login`, the CLI sets the `subdomain` key. If you have multiple deployments, the CLI prompts you to choose one. You can override the default at any time with `mint config set subdomain <subdomain>`.

Available configuration keys:

| Key         | Description                                                                |
| ----------- | -------------------------------------------------------------------------- |
| `subdomain` | Default subdomain for analytics commands. Set by the `mint login` command. |
| `dateFrom`  | Default start date for analytics queries (`YYYY-MM-DD`).                   |
| `dateTo`    | Default end date for analytics queries (`YYYY-MM-DD`).                     |

```bash Example configs theme={null}
mint config set subdomain my-docs
mint config set dateFrom 2025-01-01
```

Once set, analytics commands use these values automatically:

```bash theme={null}
# Uses the configured subdomain and dateFrom without flags
mint analytics stats
```

To view or clear a value, run:

```bash theme={null}
mint config get subdomain
mint config clear subdomain
```


## Related topics

- [Mintlify CLI](/docs/cli/index.md)
- [Analytics](/docs/optimize/analytics.md)
- [How to understand your documentation audience](/docs/guides/understand-your-audience.md)
