Install
openclaw skills install ga4-data-apiQuery Google Analytics 4 (GA4) data through the Google Analytics Data API for trends, countries, sources, pages, and conversion analysis. Use when a user wan...
openclaw skills install ga4-data-apiUse this skill to set up and query GA4 through OAuth user authorization.
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.
Check account + permission before setup
Be honest about blockers
Ask/confirm:
Run:
bash ~/.openclaw/workspace/skills/ga4-data-api/scripts/install_ga4_openclaw.sh <GA4_PROPERTY_ID> <PATH_TO_CLIENT_SECRET_JSON>
This installs Python deps, copies the OAuth client JSON into ~/.config/openclaw/ga4-client.json, and writes GA4_PROPERTY_ID into shell config.
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.jsonRecent 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
For trend questions:
end=yesterday) unless the user explicitly wants intraday.For conversion questions:
references/setup.md when the user needs the shareable setup process.scripts/ga4_query.py instead of hand-writing fresh GA SDK samples each time.