Plausible Analytics API for querying website statistics and managing sites. Use this skill to get visitor counts, pageviews, traffic sources, and manage analytics sites.
/plugin marketplace add vm0-ai/api0/plugin install api0@api0This skill inherits all available tools. When active, it can use any tool Claude has access to.
Query website analytics and manage sites with Plausible's privacy-friendly analytics platform.
export PLAUSIBLE_API_KEY=your-api-key
export PLAUSIBLE_SITE_ID=example.com
Important: When using
$VARin a command that pipes to another command, wrap the command containing$VARinbash -c '...'. Due to a Claude Code bug, environment variables are silently cleared when pipes are used directly.bash -c 'curl -s "https://api.example.com" -H "Authorization: Bearer $API_KEY"' | jq .
bash -c 'curl -s -X POST "https://plausible.io/api/v2/query" -H "Authorization: Bearer $PLAUSIBLE_API_KEY" -H "Content-Type: application/json" -d "{\"site_id\":\"$PLAUSIBLE_SITE_ID\",\"metrics\":[\"visitors\",\"pageviews\"],\"date_range\":\"7d\"}"' | jq .
Docs: https://plausible.io/docs/stats-api
bash -c 'curl -s -X POST "https://plausible.io/api/v2/query" -H "Authorization: Bearer $PLAUSIBLE_API_KEY" -H "Content-Type: application/json" -d "{\"site_id\":\"$PLAUSIBLE_SITE_ID\",\"metrics\":[\"visitors\",\"pageviews\",\"bounce_rate\"],\"date_range\":\"30d\",\"dimensions\":[\"visit:source\"]}"' | jq .
bash -c 'curl -s -X POST "https://plausible.io/api/v2/query" -H "Authorization: Bearer $PLAUSIBLE_API_KEY" -H "Content-Type: application/json" -d "{\"site_id\":\"$PLAUSIBLE_SITE_ID\",\"metrics\":[\"visitors\",\"pageviews\"],\"date_range\":\"7d\",\"dimensions\":[\"event:page\"],\"order_by\":[[\"pageviews\",\"desc\"]],\"pagination\":{\"limit\":10}}"' | jq .
bash -c 'curl -s -X POST "https://plausible.io/api/v2/query" -H "Authorization: Bearer $PLAUSIBLE_API_KEY" -H "Content-Type: application/json" -d "{\"site_id\":\"$PLAUSIBLE_SITE_ID\",\"metrics\":[\"visitors\"],\"date_range\":\"30d\",\"dimensions\":[\"visit:country_name\",\"visit:city_name\"]}"' | jq .
bash -c 'curl -s -X POST "https://plausible.io/api/v2/query" -H "Authorization: Bearer $PLAUSIBLE_API_KEY" -H "Content-Type: application/json" -d "{\"site_id\":\"$PLAUSIBLE_SITE_ID\",\"metrics\":[\"visitors\"],\"date_range\":\"7d\",\"dimensions\":[\"visit:device\"]}"' | jq .
bash -c 'curl -s -X POST "https://plausible.io/api/v2/query" -H "Authorization: Bearer $PLAUSIBLE_API_KEY" -H "Content-Type: application/json" -d "{\"site_id\":\"$PLAUSIBLE_SITE_ID\",\"metrics\":[\"visitors\",\"pageviews\"],\"date_range\":\"30d\",\"dimensions\":[\"time:day\"]}"' | jq .
bash -c 'curl -s -X POST "https://plausible.io/api/v2/query" -H "Authorization: Bearer $PLAUSIBLE_API_KEY" -H "Content-Type: application/json" -d "{\"site_id\":\"$PLAUSIBLE_SITE_ID\",\"metrics\":[\"visitors\",\"pageviews\"],\"date_range\":\"7d\",\"filters\":[[\"contains\",\"event:page\",[\"/blog\"]]]}"' | jq .
bash -c 'curl -s -X POST "https://plausible.io/api/v2/query" -H "Authorization: Bearer $PLAUSIBLE_API_KEY" -H "Content-Type: application/json" -d "{\"site_id\":\"$PLAUSIBLE_SITE_ID\",\"metrics\":[\"visitors\",\"conversion_rate\"],\"date_range\":\"30d\",\"dimensions\":[\"visit:utm_source\",\"visit:utm_campaign\"]}"' | jq .
bash -c 'curl -s -X POST "https://plausible.io/api/v2/query" -H "Authorization: Bearer $PLAUSIBLE_API_KEY" -H "Content-Type: application/json" -d "{\"site_id\":\"$PLAUSIBLE_SITE_ID\",\"metrics\":[\"visitors\",\"pageviews\"],\"date_range\":[\"2024-01-01\",\"2024-01-31\"]}"' | jq .
bash -c 'curl -s -H "Authorization: Bearer $PLAUSIBLE_API_KEY" '"'"'https://plausible.io/api/v1/sites'"'"'' | jq '.sites[] | {domain, timezone}
Docs: https://plausible.io/docs/sites-api
curl -s -X POST 'https://plausible.io/api/v1/sites' -H "Authorization: Bearer $PLAUSIBLE_API_KEY" -H 'Content-Type: application/json' -d @- << 'EOF'
{"domain":"newsite.com","timezone":"America/New_York"}
EOF
bash -c 'curl -s -H "Authorization: Bearer $PLAUSIBLE_API_KEY" "https://plausible.io/api/v1/sites/$PLAUSIBLE_SITE_ID"' | jq .
Warning: This will permanently delete the site and all its data.
bash -c 'curl -s -X DELETE -H "Authorization: Bearer $PLAUSIBLE_API_KEY" "https://plausible.io/api/v1/sites/$PLAUSIBLE_SITE_ID"'
bash -c 'curl -s -X PUT "https://plausible.io/api/v1/sites/goals" -H "Authorization: Bearer $PLAUSIBLE_API_KEY" -H "Content-Type: application/json" -d "{\"site_id\":\"$PLAUSIBLE_SITE_ID\",\"goal_type\":\"event\",\"event_name\":\"Signup\"}"' | jq .
bash -c 'curl -s -X PUT "https://plausible.io/api/v1/sites/goals" -H "Authorization: Bearer $PLAUSIBLE_API_KEY" -H "Content-Type: application/json" -d "{\"site_id\":\"$PLAUSIBLE_SITE_ID\",\"goal_type\":\"page\",\"page_path\":\"/thank-you\"}"' | jq .
bash -c 'curl -s -H "Authorization: Bearer $PLAUSIBLE_API_KEY" "https://plausible.io/api/v1/sites/goals?site_id=$PLAUSIBLE_SITE_ID"' | jq .
bash -c 'curl -s -X PUT "https://plausible.io/api/v1/sites/shared-links" -H "Authorization: Bearer $PLAUSIBLE_API_KEY" -H "Content-Type: application/json" -d "{\"site_id\":\"$PLAUSIBLE_SITE_ID\",\"name\":\"Public Dashboard\"}"' | jq .
| Metric | Type | Description |
|---|---|---|
visitors | int | Unique visitors |
visits | int | Total sessions |
pageviews | int | Page views |
bounce_rate | float | Bounce rate (%) |
visit_duration | int | Avg duration (seconds) |
views_per_visit | float | Pages per session |
conversion_rate | float | Goal conversion rate (requires goal to be configured) |
events | int | Total events |
Note: The
conversion_ratemetric requires at least one goal to be configured for your site. Create a goal first using the "Create Goal" or "Create Page Goal" endpoints before querying conversion rates.
event:goal - Custom goalsevent:page - Page pathevent:hostname - Hostnamevisit:source - Traffic sourcevisit:referrer - Full referrer URLvisit:utm_source - UTM sourcevisit:utm_medium - UTM mediumvisit:utm_campaign - UTM campaignvisit:country_name - Countryvisit:region_name - Region/Statevisit:city_name - Cityvisit:device - Device typevisit:browser - Browser namevisit:browser_version - Browser versionvisit:os - Operating systemvisit:os_version - OS versiontime - Auto granularitytime:hour - Hourlytime:day - Dailytime:week - Weeklytime:month - Monthly| Operator | Description |
|---|---|
is | Equals any value |
is_not | Not equals |
contains | Contains substring |
matches | Regex match |
["and", [
["is", "visit:country_name", ["United States"]],
["contains", "event:page", ["/blog"]]
]]
| Value | Description |
|---|---|
day | Today |
7d | Last 7 days |
28d | Last 28 days |
30d | Last 30 days |
month | Current month |
6mo | Last 6 months |
12mo | Last 12 months |
year | Current year |
all | All time |
["2024-01-01", "2024-12-31"] | Custom range |