← 返回 Skills 市场
jdrhyne

GA4 Analytics

作者 Jonathan Rhyne · GitHub ↗ · v1.2.2
cross-platform ✓ 安全检测通过
3812
总下载
1
收藏
24
当前安装
5
版本数
在 OpenClaw 中安装
/install ga4
功能描述
Query Google Analytics 4 (GA4) data via the Analytics Data API. Use when you need to pull website analytics like top pages, traffic sources, user counts, ses...
使用说明 (SKILL.md)

GA4 - Google Analytics 4 Data API

Query GA4 properties for analytics data: page views, sessions, users, traffic sources, conversions, and more.

Setup (one-time)

  1. Enable Google Analytics Data API: https://console.cloud.google.com/apis/library/analyticsdata.googleapis.com
  2. Create OAuth credentials or use existing Google Cloud project
  3. Set environment variables:
    • GA4_PROPERTY_ID - Your GA4 property ID (numeric, e.g., "123456789")
    • GOOGLE_CLIENT_ID - OAuth client ID
    • GOOGLE_CLIENT_SECRET - OAuth client secret
    • GOOGLE_REFRESH_TOKEN - OAuth refresh token (from initial auth flow)

Safety Boundaries

  • This skill only connects to Google Analytics Data API endpoints.
  • It does NOT write to or modify your GA4 property — read-only queries only.
  • It does NOT store or transmit credentials beyond the current session.
  • It requires OAuth credentials (client ID, secret, refresh token) set as environment variables.

Common Queries

Top Pages (by pageviews)

python3 scripts/ga4_query.py --metric screenPageViews --dimension pagePath --limit 30

Top Pages with Sessions & Users

python3 scripts/ga4_query.py --metrics screenPageViews,sessions,totalUsers --dimension pagePath --limit 20

Traffic Sources

python3 scripts/ga4_query.py --metric sessions --dimension sessionSource --limit 20

Landing Pages

python3 scripts/ga4_query.py --metric sessions --dimension landingPage --limit 30

Custom Date Range

python3 scripts/ga4_query.py --metric sessions --dimension pagePath --start 2026-01-01 --end 2026-01-15

Filter by Page Path

python3 scripts/ga4_query.py --metric screenPageViews --dimension pagePath --filter "pagePath=~/blog/"

Available Metrics

Common metrics: screenPageViews, sessions, totalUsers, newUsers, activeUsers, bounceRate, averageSessionDuration, conversions, eventCount

Available Dimensions

Common dimensions: pagePath, pageTitle, landingPage, sessionSource, sessionMedium, sessionCampaignName, country, city, deviceCategory, browser, date

Output Formats

Default: Table format Add --json for JSON output Add --csv for CSV output

安全使用建议
This skill appears to do only what it says: run read-only GA4 queries. Before installing or running: (1) review the provided scripts locally (they're small and readable); (2) only use OAuth credentials that you trust and scope to read-only Analytics access; (3) be aware the auth script prints tokens to your terminal — avoid running in shared environments or pasting tokens where others can see them; (4) if you prefer not to use a client secret/refresh token, consider creating dedicated credentials or a least-privileged account for this purpose; and (5) run pip dependency installation in a virtual environment to avoid affecting global packages. If you need higher assurance, ask the publisher for source provenance (the registry owner ID is included) before adding sensitive credentials.
功能分析
Type: OpenClaw Skill Name: ga4 Version: 1.2.2 The OpenClaw AgentSkills bundle for GA4 is benign. It provides Python scripts (`ga4_auth.py`, `ga4_query.py`) to authenticate with and query the Google Analytics Data API. The `SKILL.md` clearly outlines its purpose and required environment variables for Google OAuth credentials. Crucially, the `ga4_query.py` script safely parses user input for filtering (e.g., `--filter 'pagePath=~/blog/'`) by constructing Google API `FilterExpression` objects, preventing shell injection. There is no evidence of data exfiltration to unauthorized endpoints, malicious execution, persistence mechanisms, or prompt injection attempts against the agent in the `SKILL.md`.
能力评估
Purpose & Capability
The name/description (GA4 Data API queries) matches the requested environment variables (GA4_PROPERTY_ID, GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GOOGLE_REFRESH_TOKEN) and the included Python scripts. OAuth client credentials and a refresh token are reasonable and expected for offline read-only access to GA4.
Instruction Scope
SKILL.md and the scripts limit activity to the Google OAuth endpoints and the Analytics Data API. ga4_auth.py prints tokens to stdout and instructs the user to export the refresh token into their environment; the skill does not persist credentials to disk itself. Users should be aware that following the auth flow will surface tokens in the terminal, which they then may store in their environment (outside the skill).
Install Mechanism
There is no automated install downloader; the skill is instruction-only and the Python scripts simply require standard pip packages (google-analytics-data, google-auth-oauthlib). The scripts themselves do not fetch arbitrary code from unknown URLs.
Credentials
Requested environment variables are limited to what the GA4 read-only flow needs (property ID + OAuth client ID/secret/refresh token). No unrelated credentials, system config paths, or secret-named variables are requested.
Persistence & Privilege
The skill is not always-enabled, does not alter other skills or system configuration, and does not create persistent background services. It only runs as invoked and uses provided credentials for API calls.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install ga4
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /ga4 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.2.2
Scanner hardening: align _meta version with release and keep explicit openclaw env/bin requirements
v1.2.1
Hardening correction: publish explicit openclaw env/bin requirements and metadata coherence fixes
v1.2.0
Hardening pass: normalize openclaw metadata with explicit env/bin requirements and homepage for scanner coherence
v1.1.0
Fix suspicious flag: declare required env vars (GA4_PROPERTY_ID, GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GOOGLE_REFRESH_TOKEN), add Safety Boundaries section
v1.0.0
Initial release: Query GA4 Data API for pageviews, sessions, traffic sources, and more
元数据
Slug ga4
版本 1.2.2
许可证
累计安装 28
当前安装数 24
历史版本数 5
常见问题

GA4 Analytics 是什么?

Query Google Analytics 4 (GA4) data via the Analytics Data API. Use when you need to pull website analytics like top pages, traffic sources, user counts, ses... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 3812 次。

如何安装 GA4 Analytics?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install ga4」即可一键安装,无需额外配置。

GA4 Analytics 是免费的吗?

是的,GA4 Analytics 完全免费(开源免费),可自由下载、安装和使用。

GA4 Analytics 支持哪些平台?

GA4 Analytics 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 GA4 Analytics?

由 Jonathan Rhyne(@jdrhyne)开发并维护,当前版本 v1.2.2。

💬 留言讨论