360 Secure SkillHub
360 安全技能中心

Plausible Analytics Agent

核心功能:通过bash脚本实现页面浏览、自定义事件的追踪,以及查询站点统计数据(含热门页面、实时访客等)。典型场景:为自托管或plausible.io站点上报分析事件、获取访问数据时使用。需先配置站点域名、API密钥等环境变量,输入为带参数的bash命令,输出为JSON或纯文本。

kryzl19
kryzl19
热度 43.56
最近更新 2026-05-11 17:36:26
分类:自动化依赖:代码执行 / 第三方 API应用场景:数据处理 / 自动化脚本 / 报告撰写

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add plausible-analytics-agent
Metadata
name
plausible-analytics
description
Track pageviews and custom events via the Plausible Events API, and query stats (top pages, top sources, countries, realtime visitors). Use when you need to send analytics events or fetch analytics data from a self-hosted or plausible.io site.
metadata
{"openclaw":{"emoji":"📊","requires":{"env":["PLAUSIBLE_SITE_DOMAIN","PLAUSIBLE_API_KEY"]}}}

Plausible Analytics

Track events and query stats from Plausible Analytics (self-hosted or plausible.io).

Configuration

Set these environment variables before use:

# Your site domain (e.g. example.com)
export PLAUSIBLE_SITE_DOMAIN="example.com"

# Your Plausible API key (for stats endpoints)
export PLAUSIBLE_API_KEY="your-api-key"

# Plausible base URL (default: https://plausible.io for hosted)
# For self-hosted, set to your instance URL
export PLAUSIBLE_BASE_URL="https://plausible.io"

Track Pageview

bash skills/plausible-analytics/scripts/track.sh \
  --domain "$PLAUSIBLE_SITE_DOMAIN" \
  --url "https://example.com/blog/post-1" \
  --referrer "https://google.com"

Options:

  • --domain — Site domain (default: $PLAUSIBLE_SITE_DOMAIN)
  • --url — Page URL being viewed (required)
  • --referrer — Referring URL (optional)
  • --base-url — Plausible base URL (default: $PLAUSIBLE_BASE_URL)

Track Custom Event

bash skills/plausible-analytics/scripts/track.sh \
  --domain "$PLAUSIBLE_SITE_DOMAIN" \
  --event "Signup" \
  --props "{\"plan\":\"pro\",\"source\":\"newsletter\"}"

Options:

  • --domain — Site domain
  • --event — Custom event name (e.g. "Signup", "Button Click")
  • --props — JSON object with event properties (optional)
  • --base-url — Plausible base URL

Get Stats Summary

bash skills/plausible-analytics/scripts/stats.sh \
  --domain "$PLAUSIBLE_SITE_DOMAIN" \
  --period "30d" \
  --compare "previous_period"

Options:

  • --domain — Site domain
  • --period — Time period: 6mo, 12mo, day, 7d, 30d, month (default: 30d)
  • --compare — Compare to previous period: previous_period (optional)
  • --base-url — Plausible base URL (default: $PLAUSIBLE_BASE_URL)

Returns: pageviews, unique visitors, bounce rate, visit duration, total pageviews

Get Top Pages

bash skills/plausible-analytics/scripts/top-pages.sh \
  --domain "$PLAUSIBLE_SITE_DOMAIN" \
  --period "30d" \
  --limit 10

Options:

  • --domain — Site domain
  • --period — Time period (default: 30d)
  • --limit — Number of pages to return (default: 10)
  • --base-url — Plausible base URL

Get Realtime Visitors

bash skills/plausible-analytics/scripts/realtime.sh \
  --domain "$PLAUSIBLE_SITE_DOMAIN"

Options:

  • --domain — Site domain
  • --base-url — Plausible base URL

Returns: current visitors on site, pageviews in last 30 min, top pages currently viewed

Notes

  • The Events API (/api/event) is used without authentication for tracking
  • The Stats API (/api/v1/stats) requires PLAUSIBLE_API_KEY set in the request header
  • For self-hosted Plausible, set PLAUSIBLE_BASE_URL to your instance
  • All scripts output JSON or plain text depending on the endpoint