{"skill":{"slug":"ga4-connector","displayName":"GA4 Connector","summary":"Query Google Analytics 4 (GA4) data through the Google Analytics Data API for trends, countries, sources, pages, and conversion analysis. Use when a user wan...","description":"---\nname: ga4-connector\ndescription: 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.\n---\n\n# GA4 Data API\n\nUse this skill to set up and query GA4 through OAuth user authorization.\n\n## Default approach\n\nPrefer **OAuth user authorization first**.\n\nUse `scripts/install_ga4_openclaw.sh` + `scripts/ga4_query.py` for the normal path.\n\nOnly suggest **service accounts** later, when there is a clear need for headless/server-side access.\n\n## Hard rules\n\n1. **Check account + permission before setup**\n   - Ask which Google account can actually log into GA and has property/account access.\n   - Do not start with service-account setup by default for enterprise/internal data.\n\n2. **Be honest about blockers**\n   - If the user cannot add users, say it is a permission blocker.\n   - If the OAuth app is still in Testing, say the account must be added to test users.\n   - If the user can see the property but lacks admin controls, say it is an access-level issue instead of pretending the button is hidden.\n\n## Setup flow\n\n### Step 1 — Verify access model\n\nAsk/confirm:\n- Which Google account has GA access?\n- Can the user log into that account?\n- What is the GA4 Property ID?\n- Is Google Analytics Data API already enabled?\n- Is there already a Desktop OAuth client JSON?\n\n### Step 2 — Install and wire credentials\n\nRun:\n\n```bash\nbash ~/.openclaw/workspace/skills/ga4-data-api/scripts/install_ga4_openclaw.sh <GA4_PROPERTY_ID> <PATH_TO_CLIENT_SECRET_JSON>\n```\n\nThis installs Python deps, copies the OAuth client JSON into `~/.config/openclaw/ga4-client.json`, and writes `GA4_PROPERTY_ID` into shell config.\n\n### Step 3 — First authorization\n\nRun:\n\n```bash\npython3 ~/.openclaw/workspace/skills/ga4-data-api/scripts/ga4_query.py \\\n  --metrics activeUsers,sessions \\\n  --dimensions date \\\n  --start 7daysAgo \\\n  --end today \\\n  --pretty\n```\n\nThe browser will open. The user must choose the **same Google account that actually has GA access**.\n\nSuccessful authorization creates:\n- `~/.config/openclaw/ga4-token.json`\n\n### Step 4 — Query examples\n\nRecent trend:\n\n```bash\npython3 ~/.openclaw/workspace/skills/ga4-data-api/scripts/ga4_query.py \\\n  --metrics activeUsers,sessions \\\n  --dimensions date \\\n  --start 7daysAgo \\\n  --end yesterday \\\n  --pretty\n```\n\nCountry split:\n\n```bash\npython3 ~/.openclaw/workspace/skills/ga4-data-api/scripts/ga4_query.py \\\n  --metrics activeUsers \\\n  --dimensions country \\\n  --start 7daysAgo \\\n  --end yesterday \\\n  --limit 50 \\\n  --pretty\n```\n\nSource split:\n\n```bash\npython3 ~/.openclaw/workspace/skills/ga4-data-api/scripts/ga4_query.py \\\n  --metrics sessions \\\n  --dimensions sessionSourceMedium \\\n  --start 7daysAgo \\\n  --end yesterday \\\n  --limit 50 \\\n  --pretty\n```\n\n## Analysis guidance\n\nFor trend questions:\n- Prefer full days (`end=yesterday`) unless the user explicitly wants intraday.\n- Call out whether a same-day drop is just partial-day data.\n\nFor conversion questions:\n- Separate **traffic events** from **true conversion events**.\n- If key events look too broad, recommend narrowing the event set before drawing product conclusions.\n\n## References\n\n- Read `references/setup.md` when the user needs the shareable setup process.\n- Use `scripts/ga4_query.py` instead of hand-writing fresh GA SDK samples each time.\n","topics":["Permission"],"tags":{"latest":"0.1.1"},"stats":{"comments":0,"downloads":572,"installsAllTime":21,"installsCurrent":0,"stars":1,"versions":1},"createdAt":1773310892971,"updatedAt":1778491852854},"latestVersion":{"version":"0.1.1","createdAt":1773310892971,"changelog":"- Renamed the skill from \"ga4-data-api\" to \"ga4-connector\".\n- No changes to functionality, documentation, or setup instructions.","license":"MIT-0"},"metadata":null,"owner":{"handle":"nanaco666","userId":"s175t7az46bh7p5ptfn1s04tks83grcv","displayName":"nanaco","image":"https://avatars.githubusercontent.com/u/105962962?v=4"},"moderation":null}