可信分析(Plausible Analytics)
v1.0.1查询 and analyze 网页site 分析 from Plausible 分析. Use when you need to 检查 real-time visitors, 获取 page views and visitor statistics for a time period, analyze traffic sources or top pages, examine geographic distribution, or 生成 分析 报告s and insights for 网页sites 追踪ed with Plausible 分析.
运行时依赖
安装命令
点击复制技能文档
Plausible Analytics 概述 从 Plausible Analytics API 检索和分析网站分析数据。支持实时访客跟踪、历史统计、流量来源分析和按页面、来源或国家的详细分解。 快速开始 所有脚本都需要 PLAUSIBLE_API_KEY 环境变量。站点 ID 可以通过 PLAUSIBLE_SITE_ID 环境变量或作为脚本参数提供。 # 设置 API 密钥 export PLAUSIBLE_API_KEY="your-api-key" # 快速示例:获取今日统计数据 node scripts/stats.mjs example.com --period day 实时访客 检查当前有多少人正在查看您的网站: node scripts/realtime.mjs 示例输出: { "visitors": 42 } 统计数据 获取页面浏览量、访客、跳出率和访问时长的统计数据: node scripts/stats.mjs [--period day|7d|30d|month|6mo|12mo] [--date YYYY-MM-DD] 参数: period - 查询的时间段(默认:day) date - 特定日期(默认:今日) 示例: # 获取今日统计数据 node scripts/stats.mjs example.com # 获取最近 7 天的统计数据 node scripts/stats.mjs example.com --period 7d # 获取特定月份的统计数据 node scripts/stats.mjs example.com --period month --date 2026-02-01 示例输出: { "results": { "visitors": { "value": 1234 }, "pageviews": { "value": 5678 }, "bounce_rate": { "value": 45 }, "visit_duration": { "value": 180 } } } 详细分解 按特定维度(页面、来源、国家等)分析流量: node scripts/breakdown.mjs [--period day|7d|30d] [--limit N] 属性: visit:source - 流量来源(Google、Twitter、直接等) visit:referrer - 引用 URL visit:utm_medium / visit:utm_source / visit:utm_campaign - UTM 参数 visit:device - 桌面设备 vs 移动设备 visit:browser - 浏览器分解 visit:os - 操作系统 visit:country - 国家 event:page - 热门页面 示例: # 最近 7 天的前 10 个页面 node scripts/breakdown.mjs example.com event:page --period 7d --limit 10 # 今日流量来源 node scripts/breakdown.mjs example.com visit:source # 最近 30 天的国家流量 node scripts/breakdown.mjs example.com visit:country --period 30d 示例输出: { "results": [ { "page": "/", "visitors": 542, "pageviews": 1024 }, { "page": "/about", "visitors": 123, "pageviews": 145 } ] } 环境变量 PLAUSIBLE_API_KEY(必需)-您的 Plausible API 密钥 PLAUSIBLE_SITE_ID(可选)-默认站点 ID 资源 scripts/ stats.mjs - 聚合统计数据 realtime.mjs - 当前访客数量 breakdown.mjs - 按维度的详细分解