Ga4 Data Api
v0.1.0Query Google Analytics 4 (GA4) data through the Google Analytics Data API for trends, countries, sources, pages, and conversion analysis. Use when a user wan...
详细分析 ▾
运行时依赖
版本
- Initial release of the GA4 Data API skill for OpenClaw. - Enables querying Google Analytics 4 data using OAuth user authorization. - Guides users through access verification, credential setup, and example queries. - Emphasizes checking account permissions before setup and clarifies common access issues. - Provides ready-to-use command-line examples for analyzing trends, country/source breakdowns, and conversions. - Recommends best practices for analysis and directs to included setup and usage references.
安装命令 点击复制
技能文档
Use this skill to set up and query GA4 through OAuth user authorization.
Default approach
Prefer OAuth user authorization first.
Use scripts/install_ga4_openclaw.sh + scripts/ga4_query.py for the normal path.
Only suggest service accounts later, when there is a clear need for headless/server-side access.
Hard rules
- Check account + permission before setup
- Be honest about blockers
Setup flow
Step 1 — Verify access model
Ask/confirm:
- Which Google account has GA access?
- Can the user log into that account?
- What is the GA4 Property ID?
- Is Google Analytics Data API already enabled?
- Is there already a Desktop OAuth client JSON?
Step 2 — Install and wire credentials
Run:
bash ~/.openclaw/workspace/skills/ga4-data-api/scripts/install_ga4_openclaw.sh
This installs Python deps, copies the OAuth client JSON into ~/.config/openclaw/ga4-client.json, and writes GA4_PROPERTY_ID into shell config.
Step 3 — First authorization
Run:
python3 ~/.openclaw/workspace/skills/ga4-data-api/scripts/ga4_query.py \
--metrics activeUsers,sessions \
--dimensions date \
--start 7daysAgo \
--end today \
--pretty
The browser will open. The user must choose the same Google account that actually has GA access.
Successful authorization creates:
~/.config/openclaw/ga4-token.json
Step 4 — Query examples
Recent trend:
python3 ~/.openclaw/workspace/skills/ga4-data-api/scripts/ga4_query.py \
--metrics activeUsers,sessions \
--dimensions date \
--start 7daysAgo \
--end yesterday \
--pretty
Country split:
python3 ~/.openclaw/workspace/skills/ga4-data-api/scripts/ga4_query.py \
--metrics activeUsers \
--dimensions country \
--start 7daysAgo \
--end yesterday \
--limit 50 \
--pretty
Source split:
python3 ~/.openclaw/workspace/skills/ga4-data-api/scripts/ga4_query.py \
--metrics sessions \
--dimensions sessionSourceMedium \
--start 7daysAgo \
--end yesterday \
--limit 50 \
--pretty
Analysis guidance
For trend questions:
- Prefer full days (
end=yesterday) unless the user explicitly wants intraday. - Call out whether a same-day drop is just partial-day data.
For conversion questions:
- Separate traffic events from true conversion events.
- If key events look too broad, recommend narrowing the event set before drawing product conclusions.
References
- Read
references/setup.mdwhen the user needs the shareable setup process. - Use
scripts/ga4_query.pyinstead of hand-writing fresh GA SDK samples each time.
免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制