Query Google Analytics 4 (GA4) data through the Google Analytics Data API for trends, countries, sources, pages, and conversion analysis. Use when a user wants GA/GA4 metrics inside OpenClaw, wants to set up GA4 access, or needs GA4 reports such as activeUsers, sessions, country/source breakdowns, page trends, or key event analysis. For enterprise/internal GA data, first verify which Google account actually has permission before proposing service accounts or extra cloud setup.
使用此技能通过OAuth用户授权设置和查询GA4。
优先使用OAuth用户授权。
常规路径使用 scripts/installga4openclaw.sh + scripts/ga4_query.py。
仅在明确需要无头/服务器端访问时,才建议使用服务账号。
询问/确认:
运行:
bash
bash ~/.openclaw/workspace/skills/ga4-data-api/scripts/installga4openclaw.sh
这会安装Python依赖,将OAuth客户端JSON复制到 ~/.config/openclaw/ga4-client.json,并将 GA4PROPERTYID 写入shell配置。
运行:
bash
python3 ~/.openclaw/workspace/skills/ga4-data-api/scripts/ga4_query.py \
--metrics activeUsers,sessions \
--dimensions date \
--start 7daysAgo \
--end today \
--pretty
浏览器将打开。用户必须选择实际拥有GA访问权限的同一个Google账号。
成功授权将创建:
近期趋势:
bash
python3 ~/.openclaw/workspace/skills/ga4-data-api/scripts/ga4_query.py \
--metrics activeUsers,sessions \
--dimensions date \
--start 7daysAgo \
--end yesterday \
--pretty
国家分布:
bash
python3 ~/.openclaw/workspace/skills/ga4-data-api/scripts/ga4_query.py \
--metrics activeUsers \
--dimensions country \
--start 7daysAgo \
--end yesterday \
--limit 50 \
--pretty
来源分布:
bash
python3 ~/.openclaw/workspace/skills/ga4-data-api/scripts/ga4_query.py \
--metrics sessions \
--dimensions sessionSourceMedium \
--start 7daysAgo \
--end yesterday \
--limit 50 \
--pretty
对于趋势问题:
对于转化问题:
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 ga4-connector-1776119356 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 ga4-connector-1776119356 技能
skillhub install ga4-connector-1776119356
文件大小: 5.39 KB | 发布时间: 2026-4-15 12:49