WP-CLI Reference
All Rich Statistics commands are grouped under the rsa top-level command. Run wp help rsa at any time to see this list in your terminal.
wp rsa overview
Print a traffic summary for the given period to stdout.
wp rsa overview [--period=<period>] [--format=<format>]
| Option | Default | Values |
|---|---|---|
--period | 7d | today, yesterday, 7d, 30d, 90d |
--format | table | table, json, csv, yaml |
Example:
$ wp rsa overview --period=30d --format=json
{
"pageviews": 41200,
"sessions": 27800,
"bounce_rate": "43.2%",
"avg_time_on_page": "1m 28s"
}
wp rsa pages
List top pages by pageview count.
wp rsa pages [--period=<period>] [--count=<count>] [--format=<format>]
| Option | Default | Description |
|---|---|---|
--period | 7d | Time range |
--count | 10 | Number of rows to return |
--format | table | Output format |
Example:
$ wp rsa pages --period=30d --count=5
+----------------------------------+--------+----------+
| page | views | sessions |
+----------------------------------+--------+----------+
| /blog/privacy-analytics/ | 3210 | 2150 |
| /about/ | 1840 | 1610 |
+----------------------------------+--------+----------+
wp rsa referrers
List top traffic sources.
wp rsa referrers [--period=<period>] [--count=<count>] [--format=<format>]
wp rsa prune
Manually run the data pruning job. Deletes rows older than the configured retention period.
wp rsa prune [--days=<days>] [--dry-run]
| Option | Default | Description |
|---|---|---|
--days | rsa_retention_days option | Override retention period for this run |
--dry-run | false | Report what would be deleted without deleting |
Example:
$ wp rsa prune --dry-run
Would delete 4,821 rows older than 90 days.
$ wp rsa prune
Pruned 4,821 rows. (0.34s)
wp rsa export
Export raw pageview data to a CSV file.
wp rsa export [--period=<period>] [--output=<file>]
| Option | Default | Description |
|---|---|---|
--period | 30d | Time range to export |
--output | rsa-export-{date}.csv | Destination file path |
Example:
$ wp rsa export --period=90d --output=/tmp/analytics-q1.csv
Exported 38,420 rows to /tmp/analytics-q1.csv
Exported CSVs contain no IP addresses because no IP addresses are stored. The export contains: timestamp, page path, session UUID, referrer domain, browser, OS, screen resolution, and UTM fields.
wp rsa version
Print the plugin version.
$ wp rsa version
Rich Statistics 1.1.0
wp rich-stats clicks (Premium)
List click events grouped by protocol and element. Shows the actual destination value for each click type.
wp rich-stats clicks [--period=<period>] [--limit=<n>] [--page=<path>]
| Option | Default | Description |
|---|---|---|
--period | 30d | Time range: 7d, 30d, 90d, thismonth, lastmonth |
--limit | 20 | Number of rows to display |
--page | (all pages) | Filter by specific page path |
Example:
$ wp rich-stats clicks --period=7d
+----------+----------------+---------+----------+--------+
| Protocol | Destination | Tag | Text | Clicks |
+----------+----------------+---------+----------+--------+
| tel | +15551234567 | a | Call us | 42 |
| mailto | hi@example.com | a | Email us | 18 |
+----------+----------------+---------+----------+--------+
Requires an active Premium licence. Returns an error on free-tier installs.