GA4 Analytics
/install ga4
GA4 - Google Analytics 4 Data API
Query GA4 properties for analytics data: page views, sessions, users, traffic sources, conversions, and more.
Setup (one-time)
- Enable Google Analytics Data API: https://console.cloud.google.com/apis/library/analyticsdata.googleapis.com
- Create OAuth credentials or use existing Google Cloud project
- Set environment variables:
GA4_PROPERTY_ID- Your GA4 property ID (numeric, e.g., "123456789")GOOGLE_CLIENT_ID- OAuth client IDGOOGLE_CLIENT_SECRET- OAuth client secretGOOGLE_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
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install ga4 - 安装完成后,直接呼叫该 Skill 的名称或使用
/ga4触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
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。