Sign up

CLI

MetricRaven CLI

On this page

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

  1. Create an access token

    In Settings → API & MCP, create a token. Reports only is enough to start; see scopes.

  2. Log in

    terminal
    npx @metricraven/cli login

    Paste the token when asked; it isn't shown as you type. To install the metricraven command permanently, run npm install -g @metricraven/cli. Node.js 20 or later.

  3. Pick a website and run a report

    terminal
    metricraven websites list
    metricraven use ana_pub_1a2b3c4d5e6f7a8b
    metricraven analytics traffic --period 7d

Periods and filters

FlagMeaning
--periodtoday, yesterday, 24h, 7d, 30d (default), 90d, 6m, 1y, wtd, mtd or all.
--from, --toCalendar days, YYYY-MM-DD, both inclusive.
--timezoneIANA name, e.g. America/New_York, for day boundaries. Default UTC.
--filter, -fdimension: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 .overview

Scripts, CI and agents

VariableMeaning
METRICRAVEN_TOKENAccess token; overrides the saved one.
METRICRAVEN_SITEDefault website ID.
METRICRAVEN_API_BASEAPI origin, default https://metricraven.com.
Log in from stdin
echo "$METRICRAVEN_TOKEN" | metricraven login

Global 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.