CLI
Clics skills help AI agents use the CLI to manage projects, goals, funnels, sessions, and query privacy-friendly analytics from the terminal.
Clics skills are an easy way for AI agents such as Claude Code, Antigravity, and OpenCode to use Clics through the CLI.
Query analytics, manage projects, goals, funnels, and sessions directly from the terminal. The Clics CLI works standalone or with the Agent Skills that coding agents can discover and use automatically.
Prefer MCP when your agent already has the clics MCP server connected. Use the CLI when MCP is unavailable, for scripts and CI, or for manual verification.
Installation
For AI agents, install the Clics skill first:
npx skills add P-Essonam/clicsdev --skill clics
You can also install the Clics CLI globally with npm:
npm install -g @clicsdev/cli
Or run without a global install:
npx @clicsdev/cli --help
Authentication
Before using the CLI, authenticate with a Clics API key from Settings → API keys in the dashboard.
Login
# Save your API key locally (stored in ~/.config/clics/)
clics init --api-key YOUR_API_KEY
Re-run clics init anytime to rotate the key.
Logout
# Clear stored credentials
clics logout
Commands
All successful commands print a single JSON document on stdout. Errors go to stderr with a non-zero exit code.
Projects
Manage Clics projects from the terminal.
# List projects
clics projects list
clics projects list --limit 20
clics projects list --cursor "<cursor>"
# Get a project
clics projects get <project-id>
# Create a project
clics projects create --name "My site" --website-url https://example.com
clics projects create --name "My site" --website-url https://example.com --allow-localhost
# Update a project
clics projects update <project-id> --name "New name"
clics projects update <project-id> --website-url https://new.example.com
clics projects update <project-id> --allow-localhost
# Delete a project
clics projects delete <project-id>
Available options:
| Command | Option | Description |
|---|---|---|
projects list |
--cursor <cursor> |
Pagination cursor |
projects list |
--limit <n> |
Page size (1–100) |
projects create |
--name <name> |
Project name (required) |
projects create |
--website-url <url> |
Website URL (required) |
projects create |
--allow-localhost |
Allow localhost tracking |
projects update |
--name <name> |
New project name |
projects update |
--website-url <url> |
New website URL |
projects update |
--allow-localhost |
Allow localhost tracking |
Goals
Create page or event goals for a project. env_id is production or development (default: production).
# List goals
clics goals list <project-id>
clics goals list <project-id> --env-id development
# Create a page goal
clics goals create <project-id> \
--goal-type page \
--display-name "Signup page" \
--page-path /signup
# Create an event goal
clics goals create <project-id> \
--goal-type event \
--display-name "Purchase" \
--event-name purchase
# Update a goal
clics goals update <goal-id> \
--goal-type page \
--display-name "Signup" \
--page-path /signup
# Delete a goal
clics goals delete <goal-id>
Available options:
| Command | Option | Description |
|---|---|---|
goals list |
--env-id <id> |
production or development |
goals create |
--goal-type <type> |
page or event (required) |
goals create |
--display-name <name> |
Display name (required) |
goals create |
--page-path <path> |
Page path (page goals) |
goals create |
--event-name <name> |
Event name (event goals) |
goals create |
--env-id <id> |
production or development |
goals update |
--goal-type <type> |
page or event (required) |
goals update |
--display-name <name> |
Display name (required) |
goals update |
--page-path <path> |
Page path |
goals update |
--event-name <name> |
Event name |
Funnels
List, get, and delete use flags. Create and update take a JSON body because funnel steps are structured.
# List funnels
clics funnels list <project-id>
clics funnels list <project-id> --env-id production --limit 20
clics funnels list <project-id> --cursor "<cursor>"
# Get a funnel
clics funnels get <funnel-id>
# Create a funnel from a JSON file
clics funnels create <project-id> --body @funnel.json
# Update a funnel
clics funnels update <funnel-id> --body @funnel-update.json
# Delete a funnel
clics funnels delete <funnel-id>
Example funnel.json:
{
"name": "Signup funnel",
"conversion_window": { "value": 7, "unit": "days" },
"steps": [
{
"name": "Landing",
"filters": [{ "filter_type": "page", "operator": "is", "values": ["/"] }]
},
{
"name": "Signup",
"filters": [
{ "filter_type": "page", "operator": "is", "values": ["/signup"] }
]
}
]
}
Optional env_id in the create body: production or development. Update bodies omit env_id.
Available options:
| Command | Option | Description |
|---|---|---|
funnels list |
--env-id <id> |
production or development |
funnels list |
--cursor <cursor> |
Pagination cursor |
funnels list |
--limit <n> |
Page size (1–100) |
funnels create |
--body <json> |
Funnel JSON or @path/to/file.json (required) |
funnels update |
--body <json> |
Funnel JSON without env_id, or @file (required) |
Sessions
List visitor sessions, fetch session details, and read the event timeline.
# List sessions
clics sessions list <project-id>
clics sessions list <project-id> --date-range last7days --limit 20
clics sessions list <project-id> --domain example.com --date-range last30days
clics sessions list <project-id> --start 2026-07-01 --end 2026-07-15
clics sessions list <project-id> --cursor "<cursor>"
# Get session details
clics sessions get <project-id> <session-id>
clics sessions get <project-id> <session-id> --date-range last30days
# List session events
clics sessions events <project-id> <session-id>
clics sessions events <project-id> <session-id> --domain localhost
Period presets match clics query (last24h, last7days, …, allTime). Detail and events default to allTime when no range is set. Use --domain localhost for development traffic only.
Available options:
| Command | Option | Description |
|---|---|---|
sessions list |
--domain <domain> |
Optional domain filter |
sessions list |
--date-range <preset> |
Period preset (default last7days) |
sessions list |
--start <start> |
Custom range start (with --end) |
sessions list |
--end <end> |
Custom range end (with --start) |
sessions list |
--cursor <cursor> |
Pagination cursor |
sessions list |
--limit <n> |
Page size (1–100) |
sessions get |
--domain, --date-range, --start, --end |
Same scoping as list (default range allTime) |
sessions events |
--domain, --date-range, --start, --end |
Same scoping as get |
Query
Query analytics stats for a project. --metrics and --date-range are required unless you pass --file.
# Basic KPI query
clics query <project-id> \
--metrics visitors pageviews bounce_rate \
--date-range last30days
# With previous period comparison and totals
clics query <project-id> \
--metrics visitors pageviews bounce_rate \
--date-range last30days \
--previous-period \
--total-rows
# Domain filter
clics query <project-id> \
--metrics visitors \
--date-range last7days \
--domain example.com
# Breakdown by dimension
clics query <project-id> \
--metrics visitors pageviews \
--date-range last30days \
--dimensions visit:country
# Pagination
clics query <project-id> \
--metrics visitors \
--date-range last30days \
--dimensions visit:country \
--limit 50 \
--offset 0
# Advanced query from a JSON file
clics query <project-id> --file query.json
Example query.json:
{
"metrics": ["visitors", "pageviews", "bounce_rate"],
"date_range": "last30days",
"dimensions": ["visit:country"],
"filters": [["is", "visit:country", ["US", "FR"]]],
"order_by": [["visitors", "desc"]],
"include": {
"previous_period": true,
"total_rows": true
},
"pagination": {
"limit": 50,
"offset": 0
}
}
project_id in the file is overwritten by the CLI argument.
Available options:
| Option | Description |
|---|---|
--metrics <metrics...> |
Metrics (space or comma separated) |
--date-range <preset> |
Period preset (see below) |
--domain <domain> |
Optional domain filter (localhost for dev traffic) |
--dimensions <dims...> |
Breakdown dimensions |
--previous-period |
Include previous period comparison |
--total-rows |
Include total row count in meta |
--limit <n> |
Pagination limit |
--offset <n> |
Pagination offset |
--file <path> |
Full query JSON file (overrides other query flags except project ID) |
Allowed metrics: visitors · visits · pageviews · bounce_rate · visit_duration · views_per_visit · conversion_rate · events
Allowed date ranges: last24h · last7days · last30days · last3months · last12months · monthToDate · quarterToDate · yearToDate · allTime
Custom ISO start/end pairs are supported via --file.
Allowed dimensions: event:page · event:hostname · event:name · event:outbound_url · visit:country · visit:device · visit:browser · visit:os · visit:referrer · referrer:ai_provider · visit:utm_source · visit:utm_medium · visit:utm_campaign · visit:utm_term · visit:utm_content · time · time:hour · time:day
Global options
These options are available for all commands:
| Option | Description |
|---|---|
--help / -h |
Show help for a command |
--version / -V |
Show CLI version |
clics --help
clics --version
clics help <command>
Output handling
The CLI outputs JSON to stdout by default, so you can pipe or redirect:
# Extract project IDs
clics projects list | jq '.projects[].id'
# Save query results
clics query <project-id> --metrics visitors --date-range last7days > visitors.json
# Pretty-print with jq
clics projects get <project-id> | jq .
Examples
Quick project check
clics projects list
clics projects get <project-id>
Create a signup goal
clics goals create <project-id> \
--goal-type page \
--display-name "Signup" \
--page-path /signup
Weekly traffic snapshot
clics query <project-id> \
--metrics visitors pageviews bounce_rate \
--date-range last7days \
--previous-period \
--total-rows
Top countries
clics query <project-id> \
--metrics visitors \
--date-range last30days \
--dimensions visit:country \
--limit 20
Research workflow with an agent
With the Clics skill installed, ask your agent:
“Use Clics to list my projects, then show visitors for the last 7 days on the main site.”
The agent prefers MCP tools when connected, and falls back to the CLI when needed.
Skills and MCP
| Approach | Best for |
|---|---|
| Agent Skills + CLI | Agents without MCP, scripts, CI, manual terminal work |
| MCP | Cursor, Claude Code, Codex, and other MCP clients with tools connected |
The Clics skill teaches agents when to choose MCP vs CLI, how to authenticate, and the command/tool reference for projects, goals, funnels, sessions, and stats.
Troubleshooting
| Problem | Fix |
|---|---|
API key is required. Run clics init. |
Run clics init --api-key "..." |
401 / invalid key |
Recreate the key in the dashboard, then re-run init |
403 / UPGRADE_REQUIRED |
A paid plan is required for the API |
| Invalid metrics / date range | Use values from the lists above |
| Funnel or query JSON errors | Prefer --body @file.json / --file file.json over inline JSON |