KosmoKrator

analytics

Plausible Analytics CLI for AI Agents

Use the Plausible Analytics CLI from KosmoKrator to call Plausible Analytics tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

8 functions 4 read 4 write API key auth

Plausible Analytics CLI Setup

Plausible Analytics can be configured headlessly with `kosmokrator integrations:configure plausible`.

# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure plausible --set api_key="$PLAUSIBLE_API_KEY" --enable --read allow --write ask --json
kosmokrator integrations:doctor plausible --json
kosmokrator integrations:status --json

Credentials

Authentication type: API key api_key. Configure credentials once, then use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
api_key PLAUSIBLE_API_KEY Secret secret yes API Key
url PLAUSIBLE_URL URL url no Plausible URL

Call Plausible Analytics Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

kosmo integrations:call plausible.plausible_query_stats '{
  "site_id": "example_site_id",
  "metrics": "example_metrics",
  "date_range": "example_date_range",
  "dimensions": "example_dimensions",
  "filters": "example_filters",
  "date_from": "example_date_from",
  "date_to": "example_date_to",
  "order_by": "example_order_by"
}' --json

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations:plausible plausible_query_stats '{
  "site_id": "example_site_id",
  "metrics": "example_metrics",
  "date_range": "example_date_range",
  "dimensions": "example_dimensions",
  "filters": "example_filters",
  "date_from": "example_date_from",
  "date_to": "example_date_to",
  "order_by": "example_order_by"
}' --json

Agent Discovery Commands

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

kosmo integrations:docs plausible --json
kosmo integrations:docs plausible.plausible_query_stats --json
kosmo integrations:schema plausible.plausible_query_stats --json
kosmo integrations:search "Plausible Analytics" --json
kosmo integrations:list --json

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to Plausible Analytics.

plausible.plausible_query_stats

Read read

Query website analytics from Plausible. Supports aggregate stats, timeseries, and breakdowns by dimension. Use dimensions to group results (e.g., by country, source, page). Omit dimensions for simple aggregate totals.

Parameters
site_id, metrics, date_range, dimensions, filters, date_from, date_to, order_by, limit

Generic CLI call

kosmo integrations:call plausible.plausible_query_stats '{"site_id":"example_site_id","metrics":"example_metrics","date_range":"example_date_range","dimensions":"example_dimensions","filters":"example_filters","date_from":"example_date_from","date_to":"example_date_to","order_by":"example_order_by"}' --json

Provider shortcut

kosmo integrations:plausible plausible_query_stats '{"site_id":"example_site_id","metrics":"example_metrics","date_range":"example_date_range","dimensions":"example_dimensions","filters":"example_filters","date_from":"example_date_from","date_to":"example_date_to","order_by":"example_order_by"}' --json

plausible.plausible_realtime_visitors

Read read

Get the current number of realtime visitors on a website (visitors in the last 5 minutes).

Parameters
site_id

Generic CLI call

kosmo integrations:call plausible.plausible_realtime_visitors '{"site_id":"example_site_id"}' --json

Provider shortcut

kosmo integrations:plausible plausible_realtime_visitors '{"site_id":"example_site_id"}' --json

plausible.plausible_list_sites

Read read

List websites tracked in Plausible Analytics. Returns site domains you can query for analytics data.

Parameters
limit, after

Generic CLI call

kosmo integrations:call plausible.plausible_list_sites '{"limit":1,"after":"example_after"}' --json

Provider shortcut

kosmo integrations:plausible plausible_list_sites '{"limit":1,"after":"example_after"}' --json

plausible.plausible_create_site

Write write

Register a new website for tracking in Plausible Analytics.

Parameters
domain, timezone

Generic CLI call

kosmo integrations:call plausible.plausible_create_site '{"domain":"example_domain","timezone":"example_timezone"}' --json

Provider shortcut

kosmo integrations:plausible plausible_create_site '{"domain":"example_domain","timezone":"example_timezone"}' --json

plausible.plausible_delete_site

Write write

Remove a website from Plausible Analytics tracking. This deletes all associated data.

Parameters
site_id

Generic CLI call

kosmo integrations:call plausible.plausible_delete_site '{"site_id":"example_site_id"}' --json

Provider shortcut

kosmo integrations:plausible plausible_delete_site '{"site_id":"example_site_id"}' --json

plausible.plausible_list_goals

Read read

List all goals (conversion tracking) configured for a website in Plausible.

Parameters
site_id

Generic CLI call

kosmo integrations:call plausible.plausible_list_goals '{"site_id":"example_site_id"}' --json

Provider shortcut

kosmo integrations:plausible plausible_list_goals '{"site_id":"example_site_id"}' --json

plausible.plausible_create_goal

Write write

Create a conversion goal for a website in Plausible. Goals can track pageviews to specific pages or custom events.

Parameters
site_id, event_name, page_path

Generic CLI call

kosmo integrations:call plausible.plausible_create_goal '{"site_id":"example_site_id","event_name":"example_event_name","page_path":"example_page_path"}' --json

Provider shortcut

kosmo integrations:plausible plausible_create_goal '{"site_id":"example_site_id","event_name":"example_event_name","page_path":"example_page_path"}' --json

plausible.plausible_delete_goal

Write write

Delete a conversion goal from a website in Plausible.

Parameters
site_id, goal_id

Generic CLI call

kosmo integrations:call plausible.plausible_delete_goal '{"site_id":"example_site_id","goal_id":1}' --json

Provider shortcut

kosmo integrations:plausible plausible_delete_goal '{"site_id":"example_site_id","goal_id":1}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

plausible.plausible_query_stats

Query website analytics from Plausible. Supports aggregate stats, timeseries, and breakdowns by dimension. Use dimensions to group results (e.g., by country, source, page). Omit dimensions for simple aggregate totals.

Operation
Read read
Schema command
kosmo integrations:schema plausible.plausible_query_stats --json
ParameterTypeRequiredDescription
site_id string yes The site domain (e.g., "example.com").
metrics array yes Metrics to retrieve: visitors, pageviews, visits, bounce_rate, visit_duration, views_per_visit, events, conversion_rate.
date_range string yes Time period: "7d", "28d", "30d", "month", "3mo", "6mo", "12mo", or "custom" (requires date_from/date_to).
dimensions array no Dimensions to group by: visit:source, visit:country, visit:city, visit:device, visit:browser, visit:os, event:page, event:name, time:day, time:month, etc.
filters string no JSON-encoded filter expressions, e.g., [["is", "visit:country", ["NL"]]]. Pass as a JSON string.
date_from string no Start date (ISO 8601, e.g., "2025-01-01") when date_range is "custom".
date_to string no End date (ISO 8601, e.g., "2025-01-31") when date_range is "custom".
order_by string no JSON-encoded order, e.g., [["visitors", "desc"]]. Pass as a JSON string.
limit integer no Maximum number of results to return. Sent as pagination.limit (default: 10000).

plausible.plausible_realtime_visitors

Get the current number of realtime visitors on a website (visitors in the last 5 minutes).

Operation
Read read
Schema command
kosmo integrations:schema plausible.plausible_realtime_visitors --json
ParameterTypeRequiredDescription
site_id string yes The site domain (e.g., "example.com").

plausible.plausible_list_sites

List websites tracked in Plausible Analytics. Returns site domains you can query for analytics data.

Operation
Read read
Schema command
kosmo integrations:schema plausible.plausible_list_sites --json
ParameterTypeRequiredDescription
limit integer no Maximum number of sites to return (default: 100).
after string no Cursor for pagination — pass the value from a previous response to get the next page.

plausible.plausible_create_site

Register a new website for tracking in Plausible Analytics.

Operation
Write write
Schema command
kosmo integrations:schema plausible.plausible_create_site --json
ParameterTypeRequiredDescription
domain string yes The domain to track (e.g., "example.com").
timezone string no Timezone for the site (e.g., "Europe/Amsterdam"). Defaults to "Etc/UTC".

plausible.plausible_delete_site

Remove a website from Plausible Analytics tracking. This deletes all associated data.

Operation
Write write
Schema command
kosmo integrations:schema plausible.plausible_delete_site --json
ParameterTypeRequiredDescription
site_id string yes The site domain to delete (e.g., "example.com").

plausible.plausible_list_goals

List all goals (conversion tracking) configured for a website in Plausible.

Operation
Read read
Schema command
kosmo integrations:schema plausible.plausible_list_goals --json
ParameterTypeRequiredDescription
site_id string yes The site domain (e.g., "example.com").

plausible.plausible_create_goal

Create a conversion goal for a website in Plausible. Goals can track pageviews to specific pages or custom events.

Operation
Write write
Schema command
kosmo integrations:schema plausible.plausible_create_goal --json
ParameterTypeRequiredDescription
site_id string yes The site domain (e.g., "example.com").
event_name string no Custom event name to track (e.g., "Signup"). Use this OR page_path, not both.
page_path string no Page path to track visits to (e.g., "/thank-you"). Use this OR event_name, not both.

plausible.plausible_delete_goal

Delete a conversion goal from a website in Plausible.

Operation
Write write
Schema command
kosmo integrations:schema plausible.plausible_delete_goal --json
ParameterTypeRequiredDescription
site_id string yes The site domain (e.g., "example.com").
goal_id integer yes The ID of the goal to delete.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.