# WP-CLI commands

<!-- Generated by `pnpm docs:reference`. Do not edit this file; change the code it is read from. -->

SleekTrack registers these WP-CLI commands. Each is documented by the WP-CLI docblock where it is declared; `wp help <command>` prints the same text on a site.

## `wp sleek track`

Reads analytics and runs maintenance for SleekTrack.

## `wp sleek track breakdown`

Shows a breakdown for a site.

```bash
wp sleek track breakdown <site-id> --property=<property> [--limit=<limit>] [--period=<period>] [--from=<date>] [--to=<date>] [--segment=<segment>] [--format=<format>]
```

| Argument | Description |
| --- | --- |
| `<site-id>` | The site id. |
| `--property=<property>` | One of page, entry_page, exit_page, page_title, scroll, source, referrer_domain, utm_source, utm_medium, utm_campaign, utm_content, utm_term, country, continent, region, city, device, browser, os, goal, site. goal lists named events only; pageview goals are reported by the dashboard. |
| `[--limit=<limit>]` | Rows to return, 1 to 100. Default 10. |
| `[--period=<period>]` | One of day, 7d, 30d, month, 6mo, 12mo, custom, all. Default 7d. |
| `[--from=<date>]` | Custom period start (Y-m-d). |
| `[--to=<date>]` | Custom period end (Y-m-d). |
| `[--segment=<segment>]` | Deprecated and ignored. |
| `[--format=<format>]` | Output format. Supports table, json and csv. |

**Examples**

```bash
wp sleek track breakdown 1 --property=page --period=30d
```

## `wp sleek track cleanup`

Prunes old events and expired salts, like the daily cron. While the daily statistics backfill runs, events are kept and the command says so.

```bash
wp sleek track cleanup [--retention-days=<days>]
```

| Argument | Description |
| --- | --- |
| `[--retention-days=<days>]` | Override the retention window for this run. 0 keeps everything. |

**Examples**

```bash
wp sleek track cleanup --retention-days=90
```

## `wp sleek track events`

Lists raw events for a site, newest first.

```bash
wp sleek track events <site-id> [--limit=<limit>] [--offset=<offset>] [--format=<format>]
```

| Argument | Description |
| --- | --- |
| `<site-id>` | The site id. |
| `[--limit=<limit>]` | Rows to return, 1 to 1000. Default 50. |
| `[--offset=<offset>]` | Rows to skip. Default 0. |
| `[--format=<format>]` | Output format. Supports table, json and csv. |

## `wp sleek track network`

Manages which network sites the plugin runs on.

## `wp sleek track network disable`

Disables the plugin on a network site, keeping its data.

```bash
wp sleek track network disable <blogId>
```

| Argument | Description |
| --- | --- |
| `<blogId>` | The blog id of the site to disable. |

**Examples**

```bash
wp sleek track network disable 2
```

## `wp sleek track network enable`

Enables the plugin on a network site, provisioning its tables.

```bash
wp sleek track network enable <blogId>
```

| Argument | Description |
| --- | --- |
| `<blogId>` | The blog id of the site to enable. |

**Examples**

```bash
wp sleek track network enable 2
```

## `wp sleek track network list`

Lists every site in the network with its plugin state.

```bash
wp sleek track network list [--format=<format>]
```

| Argument | Description |
| --- | --- |
| `[--format=<format>]` | Output format. Supports table and json. The json output carries the full per-site payload including stats. |

**Examples**

```bash
wp sleek track network list --format=json
```

## `wp sleek track realtime`

Shows active visitors from the last five minutes.

```bash
wp sleek track realtime <site-id> [--segment=<segment>] [--format=<format>]
```

| Argument | Description |
| --- | --- |
| `<site-id>` | The site id. |
| `[--segment=<segment>]` | Deprecated and ignored. |
| `[--format=<format>]` | Output format. Supports table and json. |

## `wp sleek track sites`

Manages the tracked sites.

## `wp sleek track sites create`

Adds a site to track.

```bash
wp sleek track sites create --domain=<domain> [--name=<name>] [--porcelain]
```

| Argument | Description |
| --- | --- |
| `--domain=<domain>` | The domain to track, like example.com. |
| `[--name=<name>]` | A display name. |
| `[--porcelain]` | Output just the new site id. |

**Examples**

```bash
wp sleek track sites create --domain=example.com --name=Example
```

## `wp sleek track sites delete`

Deletes a tracked site and purges its events.

```bash
wp sleek track sites delete <id> [--yes]
```

| Argument | Description |
| --- | --- |
| `<id>` | The site id. |
| `[--yes]` | Skip the confirmation prompt. |

## `wp sleek track sites get`

Shows one tracked site.

```bash
wp sleek track sites get <id> [--format=<format>]
```

| Argument | Description |
| --- | --- |
| `<id>` | The site id. |
| `[--format=<format>]` | Output format. Supports table and json. |

## `wp sleek track sites list`

Lists every tracked site.

```bash
wp sleek track sites list [--format=<format>]
```

| Argument | Description |
| --- | --- |
| `[--format=<format>]` | Output format. Supports table, json and csv. |

## `wp sleek track sites script`

Prints the tracking snippet for a site.

```bash
wp sleek track sites script <id>
```

| Argument | Description |
| --- | --- |
| `<id>` | The site id. |

## `wp sleek track sites self-register`

Registers the current install as a tracked site with the beacon injected automatically.

```bash
wp sleek track sites self-register [--porcelain]
```

| Argument | Description |
| --- | --- |
| `[--porcelain]` | Output just the site id. |

## `wp sleek track sites update`

Updates a tracked site.

```bash
wp sleek track sites update <id> [--name=<name>] [--domain=<domain>] [--active=<active>] [--auto-inject=<auto-inject>]
```

| Argument | Description |
| --- | --- |
| `<id>` | The site id. |
| `[--name=<name>]` | New display name. |
| `[--domain=<domain>]` | New domain. |
| `[--active=<active>]` | true or false. |
| `[--auto-inject=<auto-inject>]` | true or false, whether the beacon renders on this install. |

## `wp sleek track stats`

Shows aggregates and the timeseries for a site.

```bash
wp sleek track stats <site-id> [--period=<period>] [--from=<date>] [--to=<date>] [--segment=<segment>] [--format=<format>]
```

| Argument | Description |
| --- | --- |
| `<site-id>` | The site id (see `wp sleek track sites list`). |
| `[--period=<period>]` | One of day, 7d, 30d, month, 6mo, 12mo, custom, all. Default 7d. |
| `[--from=<date>]` | Custom period start (Y-m-d). |
| `[--to=<date>]` | Custom period end (Y-m-d). |
| `[--segment=<segment>]` | Deprecated and ignored. |
| `[--format=<format>]` | Output format. Supports table, json and csv. |

**Examples**

```bash
wp sleek track stats 1 --period=30d --format=json
```
