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

# Analytics

> View platform and post-level analytics from the command line

## Platform Analytics

Get analytics for a specific integration/channel. Returns metrics like followers, impressions, and engagement over time.

```bash theme={null}
postiz analytics:platform <integration-id>
```

### Options

| Flag         | Description                              |
| ------------ | ---------------------------------------- |
| `-d, --date` | Number of days to look back (default: 7) |

### Examples

```bash theme={null}
# Last 7 days (default)
postiz analytics:platform your-integration-id

# Last 30 days
postiz analytics:platform your-integration-id -d 30

# Last 90 days
postiz analytics:platform your-integration-id -d 90
```

The response is an array of metrics, each with daily data points:

```json theme={null}
[
  {
    "label": "Followers",
    "data": [
      { "total": "1250", "date": "2025-01-01" },
      { "total": "1280", "date": "2025-01-02" }
    ],
    "percentageChange": 2.4
  },
  {
    "label": "Impressions",
    "data": [
      { "total": "5000", "date": "2025-01-01" },
      { "total": "5200", "date": "2025-01-02" }
    ],
    "percentageChange": 4.0
  }
]
```

<Note>
  The metrics returned depend on the platform. For example, X returns followers and impressions, while YouTube may return subscribers and views.
</Note>

## Post Analytics

Get analytics for a specific published post. Returns metrics like likes, comments, shares, and impressions.

```bash theme={null}
postiz analytics:post <post-id>
```

### Options

| Flag         | Description                              |
| ------------ | ---------------------------------------- |
| `-d, --date` | Number of days to look back (default: 7) |

### Examples

```bash theme={null}
# Last 7 days (default)
postiz analytics:post your-post-id

# Last 30 days
postiz analytics:post your-post-id -d 30
```

The response follows the same format as platform analytics:

```json theme={null}
[
  {
    "label": "Likes",
    "data": [
      { "total": "150", "date": "2025-01-01" },
      { "total": "175", "date": "2025-01-02" }
    ],
    "percentageChange": 16.7
  },
  {
    "label": "Comments",
    "data": [
      { "total": "25", "date": "2025-01-01" },
      { "total": "30", "date": "2025-01-02" }
    ],
    "percentageChange": 20.0
  }
]
```

<Tip>
  Post analytics are only available for published posts. Draft or queued posts won't return analytics data.
</Tip>

## Scripting with Analytics

Extract specific metrics using `jq`:

```bash theme={null}
# Get just the follower count trend
postiz analytics:platform integration-id -d 30 | jq '.[] | select(.label=="Followers")'

# Get percentage changes for all metrics
postiz analytics:platform integration-id | jq '.[] | {label, percentageChange}'

# Get the latest total for each post metric
postiz analytics:post post-id | jq '.[] | {label, latest: .data[-1].total}'
```
