Skip to content

WP CLI Reference

Richard Kent Gates edited this page Jun 9, 2026 · 2 revisions

WP-CLI Reference

All Rich Statistics commands are grouped under the rich-stats top-level command. Run wp help rich-stats at any time to see this list in your terminal.

wp rich-stats overview

Print a traffic summary for the given period to stdout.

wp rich-stats overview [--period=<period>] [--blog-id=<id>]
Option Default Values
--period 30d 7d, 30d, 90d, thismonth, lastmonth
--blog-id current site Multisite: switch to this blog ID before querying

Example:

$ wp rich-stats overview --period=30d
+------------+--------+
| Metric     | Value  |
+------------+--------+
| Page Views | 41,200 |
| Sessions   | 27,800 |
| Avg Time   | 1m 28s |
| Bounce Rate| 43.2%  |
+------------+--------+

wp rich-stats top-pages

List top pages by view count.

wp rich-stats top-pages [--period=<period>] [--limit=<n>]
Option Default Description
--period 30d Time range: 7d, 30d, 90d, thismonth, lastmonth
--limit 10 Number of rows to return

Example:

$ wp rich-stats top-pages --period=30d --limit=5
+---+---------------------------+-------+----------+
| # | Page                      | Views | Avg Time |
+---+---------------------------+-------+----------+
| 1 | /blog/privacy-analytics/  | 3,210 | 1m 42s   |
| 2 | /about/                   | 1,840 | 0m 58s   |
+---+---------------------------+-------+----------+

wp rich-stats audience

Show audience breakdown by OS, browser, and language.

wp rich-stats audience [--period=<period>] [--blog-id=<id>]
Option Default Description
--period 30d Time range
--blog-id current site Multisite: switch to this blog ID before querying

Example:

$ wp rich-stats audience --period=7d

OS
+----------+-------+
| Label    | Count |
+----------+-------+
| Windows  | 8,412 |
| macOS    | 5,230 |
+----------+-------+

Browser
+----------+-------+
| Label    | Count |
+----------+-------+
| Chrome   | 9,104 |
| Firefox  | 2,381 |
+----------+-------+

wp rich-stats purge

Delete event records older than the configured retention period. Useful for manual housekeeping or testing.

wp rich-stats purge [--older-than=<days>] [--dry-run] [--blog-id=<id>]
Option Default Description
--older-than site retention setting Override retention period (days) for this run
--dry-run false Report count without deleting anything
--blog-id current site Multisite: switch to this blog ID before querying

Example:

$ wp rich-stats purge --older-than=90 --dry-run
Dry run — no data will be deleted.
Would delete approximately 4,821 event rows.

$ wp rich-stats purge --older-than=90
Success: Pruned 4821 records.

wp rich-stats export

Export raw event data to JSON or CSV.

wp rich-stats export [--period=<period>] [--format=<format>] [--output=<file>] [--blog-id=<id>]
Option Default Description
--period 90d Time range to export
--format json json or csv
--output stdout File path to write output; omit to print to terminal
--blog-id current site Multisite: switch to this blog ID before querying

Example:

$ wp rich-stats export --period=90d --format=csv --output=/tmp/analytics-q1.csv
Exporting (90d, csv)…
Success: Written to /tmp/analytics-q1.csv
  Exported data contains **no IP addresses** — none are stored. Each row includes: timestamp, page path, session UUID, referrer domain, browser, OS, screen resolution, and UTM fields (utm_source, utm_medium, utm_campaign).

wp rich-stats email-test

Send a test digest email to verify delivery and formatting.

wp rich-stats email-test [--recipient=<email>] [--blog-id=<id>]
Option Default Description
--recipient site admin email Override recipient address for this test
--blog-id current site Multisite: switch to this blog ID before querying

Example:

$ wp rich-stats email-test --recipient=dev@example.com

wp rich-stats status

Print plugin version, tier, and current configuration at a glance.

wp rich-stats status [--blog-id=<id>]
Option Default Description
--blog-id current site Multisite: switch to this blog ID before querying
$ wp rich-stats status
Rich Statistics Status

+----------------------+-----------------------+
| Setting              | Value                 |
+----------------------+-----------------------+
| Version              | 2.4.27                 |
| Tier                 | Free                  |
| Retention (days)     | 90                    |
| Bot threshold        | 5                     |
| Email digest enabled | No                    |
| Email frequency      | weekly                |
| Next maintenance     | 2026-03-20 03:00 UTC  |
| Next digest          | not scheduled         |
+----------------------+-----------------------+

wp rich-stats referrers

Show referrer traffic sources for the given period.

wp rich-stats referrers [--period=<period>] [--limit=<n>] [--blog-id=<id>]
Option Default Description
--period 30d Time range: 7d, 30d, 90d, thismonth, lastmonth
--limit 10 Number of rows to return
--blog-id current site Multisite: switch to this blog ID before querying

Example:

$ wp rich-stats referrers --period=30d --limit=5
+-----------------+-----------+
| Domain          | Pageviews |
+-----------------+-----------+
| google.com      |     4,120 |
| (direct)        |     3,980 |
+-----------------+-----------+

wp rich-stats behavior

Show engagement metrics: time-on-page histogram, session depth distribution, entry/exit pages.

wp rich-stats behavior [--period=<period>] [--blog-id=<id>]
Option Default Description
--period 30d Time range
--blog-id current site Multisite: switch to this blog ID before querying

Example:

$ wp rich-stats behavior --period=7d

wp rich-stats campaigns (Premium)

Show UTM campaign performance: sessions and pageviews grouped by source / medium / campaign.

wp rich-stats campaigns [--period=<period>] [--limit=<n>] [--medium=<medium>] [--blog-id=<id>]
Option Default Description
--period 30d Time range: 7d, 30d, 90d, thismonth, lastmonth
--limit 10 Number of rows to return
--medium Filter to a specific UTM medium (e.g. email, cpc)
--blog-id current site Multisite: switch to this blog ID before querying

wp rich-stats user-flow (Premium)

Show how sessions navigate through your site — entry pages, transition pairs, and path exploration.

wp rich-stats user-flow [--period=<period>] [--steps=<n>] [--focus-page=<path>] [--min-sessions=<n>] [--blog-id=<id>]
Option Default Description
--period 30d Time range
--steps 4 Depth of steps to return
--focus-page Center the flow on a specific page path
--min-sessions 1 Minimum session count to include a path node
--blog-id current site Multisite: switch to this blog ID before querying

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>] [--blog-id=<id>]
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
--blog-id current site Multisite: switch to this blog ID before querying

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.

wp rich-stats woocommerce (Premium)

Show a WooCommerce analytics summary: conversion funnel, revenue totals, top viewed products, and top add-to-cart products. Requires both an active Premium licence and WooCommerce to be installed and active.

wp rich-stats woocommerce [--period=<period>] [--limit=<n>] [--blog-id=<id>]
Option Default Description
--period 30d Time range: 7d, 30d, 90d, thismonth, lastmonth
--limit 10 Number of top products to show per table
--blog-id current site Multisite: switch to this blog ID before querying

Example:

$ wp rich-stats woocommerce --period=30d

Funnel
+-----------------+-------+
| Event           | Count |
+-----------------+-------+
| Product Views   | 4,210 |
| Add to Cart     | 1,830 |
| Orders          |   412 |
+-----------------+-------+

Revenue
  Total orders:  412
  Total revenue: $18,340.00

Top Viewed Products
+---+---------------------------+-------+
| # | Product                   | Views |
+---+---------------------------+-------+
| 1 | Blue Widget Pro           | 1,820 |
| 2 | Red Widget Standard       |   940 |
+---+---------------------------+-------+

Top Add-to-Cart
+---+---------------------------+--------+
| # | Product                   | Events |
+---+---------------------------+--------+
| 1 | Blue Widget Pro           |    812 |
| 2 | Red Widget Standard       |    430 |
+---+---------------------------+--------+
Requires an active Premium licence and WooCommerce to be installed and active. Returns an error on free-tier installs or when WooCommerce is not present.

Documentation

Features

User Guide

Compliance


External Links

Clone this wiki locally