| name | supalytics |
| description | Query web analytics data using the Supalytics CLI. Use when the user wants to check pageviews, visitors, top pages, traffic sources, referrers, countries, revenue metrics, conversions, funnels, events, or realtime visitors. |
| metadata | {"openclaw":{"emoji":"📊","requires":{"bins":["supalytics"]},"homepage":"https://supalytics.co"}} |
Supalytics CLI
Query web analytics data from Supalytics - simple, fast, GDPR-compliant analytics with revenue attribution.
Installation
Requires Bun runtime (not Node.js):
curl -fsSL https://bun.sh/install | bash
export PATH="$HOME/.bun/bin:$PATH"
bun add -g @supalytics/cli
Authentication
Important: OAuth in Agent Contexts
The supalytics login command uses OAuth device flow which requires user interaction in a browser. In agent contexts (OpenClaw, etc.), the process may be killed before OAuth completes.
Solution for OpenClaw: Use background: true mode:
await exec({
command: 'supalytics login',
background: true,
yieldMs: 2000
});
The agent should:
- Run login in background mode
- Extract and present the verification URL to the user
- Wait for user to complete browser authorization
- Poll background session to check completion
Quick Setup
supalytics init
Manual Setup
supalytics login
supalytics sites add
Commands
Quick Stats
supalytics stats
supalytics stats today
supalytics stats yesterday
supalytics stats week
supalytics stats month
supalytics stats 7d
supalytics stats --all
Realtime Visitors
supalytics realtime
supalytics realtime --watch
Trend (Time Series)
supalytics trend
supalytics trend --period 7d
supalytics trend --compact
Breakdowns
supalytics pages
supalytics referrers
supalytics countries
Events
supalytics events
supalytics events signup
supalytics events signup --property plan
Custom Queries
The query command is the most flexible:
supalytics query -d page -m visitors,revenue
supalytics query -d country,device -m visitors
supalytics query -d page -f "page:contains:/blog" -f "country:is:US"
supalytics query -d hour -m visitors -p 7d
supalytics query -d utm_source,utm_campaign -m visitors,revenue
supalytics query -d page --sort revenue:desc
supalytics query -d page -f "event:is:signup"
supalytics query -d country -f "event_property:is:plan:premium"
Available metrics: visitors, pageviews, bounce_rate, avg_session_duration, revenue, conversions, conversion_rate
Available dimensions: page, referrer, country, region, city, browser, os, device, date, hour, event, utm_source, utm_medium, utm_campaign, utm_term, utm_content
Site Management
supalytics sites
supalytics sites add example.com
supalytics sites update my-site -d example.com
supalytics default example.com
supalytics remove example.com
Global Options
All analytics commands support:
| Option | Description |
|---|
-s, --site <domain> | Query specific site (otherwise uses default) |
-p, --period <period> | Time period: 7d, 14d, 30d, 90d, 12mo, all |
--start <date> | Start date (YYYY-MM-DD) |
--end <date> | End date (YYYY-MM-DD) |
-f, --filter <filter> | Filter: field:operator:value |
--json | Output raw JSON (for programmatic use) |
--no-revenue | Exclude revenue metrics |
-t, --test | Query localhost/test data |
Filter Syntax
Format: field:operator:value
Operators: is, is_not, contains, not_contains, starts_with
Examples:
-f "country:is:US"
-f "page:contains:/blog"
-f "device:is:mobile"
-f "referrer:is:twitter.com"
-f "utm_source:is:newsletter"
-f "event:is:signup"
-f "event_property:is:plan:premium"
Output Formats
Human-readable (default): Formatted tables with colors
JSON (--json): Raw JSON for parsing - use this when you need to process the data programmatically:
supalytics stats --json | jq '.data[0].metrics.visitors'
supalytics query -d page -m visitors --json
Examples by Use Case
"How's my site doing?"
supalytics stats
"What are my top traffic sources?"
supalytics referrers
supalytics query -d referrer -m visitors,revenue
"Which pages generate the most revenue?"
supalytics query -d page -m revenue --sort revenue:desc
"How's my newsletter campaign performing?"
supalytics query -d utm_campaign -f "utm_source:is:newsletter" -m visitors,conversions,revenue
"Who's on my site right now?"
supalytics realtime
"Show me the visitor trend this week"
supalytics trend --period 7d
Troubleshooting
| Issue | Solution |
|---|
command not found: supalytics | Ensure Bun is installed and ~/.bun/bin is in PATH, or symlink to system path (see below) |
No site specified | Run supalytics default <domain> to set default site |
Unauthorized | Run supalytics login to re-authenticate |
| No data returned | Check site has tracking installed, try -t for test mode |
OpenClaw / Daemon Usage
Bun installs to ~/.bun/bin which isn't in PATH for daemon processes like OpenClaw. After installation, symlink to system path:
sudo ln -sf ~/.bun/bin/bun /usr/local/bin/bun
sudo ln -sf ~/.bun/bin/supalytics /usr/local/bin/supalytics