CLI
MetricRaven CLI
Traffic, revenue, goals, visitors and websites from your terminal. Output is readable by default and JSON with --json, so it also works for scripts and AI agents that run shell commands.
Install and log in
Create an access token
In Settings → API & MCP, create a token. Reports only is enough to start; see scopes.
Log in
terminalnpx @metricraven/cli loginPaste the token when asked; it isn't shown as you type. To install the
metricravencommand permanently, runnpm install -g @metricraven/cli. Node.js 20 or later.Pick a website and run a report
terminalmetricraven websites list metricraven use ana_pub_1a2b3c4d5e6f7a8b metricraven analytics traffic --period 7d
Periods and filters
| Flag | Meaning |
|---|---|
| --period | today, yesterday, 24h, 7d, 30d (default), 90d, 6m, 1y, wtd, mtd or all. |
| --from, --to | Calendar days, YYYY-MM-DD, both inclusive. |
| --timezone | IANA name, e.g. America/New_York, for day boundaries. Default UTC. |
| --filter, -f | dimension:operator:value, repeatable. Operators is, is_not, contains, not_contains. |
terminal
metricraven analytics breakdown referrer --sort revenue --limit 20
metricraven analytics traffic -f country:is:US -f device:is:mobile --json | jq .overviewScripts, CI and agents
| Variable | Meaning |
|---|---|
| METRICRAVEN_TOKEN | Access token; overrides the saved one. |
| METRICRAVEN_SITE | Default website ID. |
| METRICRAVEN_API_BASE | API origin, default https://metricraven.com. |
Log in from stdin
echo "$METRICRAVEN_TOKEN" | metricraven loginGlobal flags: --site, --json, --verbose (request URLs and status codes on stderr), --help and --version. All commands are in the command reference.
Prefer the hidden prompt, stdin or
METRICRAVEN_TOKEN over --token, which can end up in your shell history.Details
- The token is saved to ~/.config/metricraven/config.json (or $XDG_CONFIG_HOME), readable only by you.
- Without a default website, the CLI uses the only website the token can see, or asks you to pick one.
- Money is shown in your reporting currency's main unit, as in the dashboard.