← Back to Skills Marketplace
nanaco666

GA4 Connector

by nanaco · GitHub ↗ · v0.1.1 · MIT-0
cross-platform ✓ Security Clean
234
Downloads
1
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install ga4-connector
Description
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...
README (SKILL.md)

GA4 Data API

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

  1. Check account + permission before setup

    • Ask which Google account can actually log into GA and has property/account access.
    • Do not start with service-account setup by default for enterprise/internal data.
  2. Be honest about blockers

    • If the user cannot add users, say it is a permission blocker.
    • If the OAuth app is still in Testing, say the account must be added to test users.
    • 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.

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 \x3CGA4_PROPERTY_ID> \x3CPATH_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.

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.md when the user needs the shareable setup process.
  • Use scripts/ga4_query.py instead of hand-writing fresh GA SDK samples each time.
Usage Guidance
This skill appears to do what it says (connect to GA4 via the Google Analytics Data API). Before installing, review and consider: 1) The installer will copy your Desktop OAuth client JSON into ~/.config/openclaw and create an OAuth token at ~/.config/openclaw/ga4-token.json — both grant access to GA data and should be kept private. 2) The installer will add an export GA4_PROPERTY_ID line to your shell rc (~/.bashrc or ~/.zshrc); back up that file first and inspect the change if you don't want environment modifications. 3) The script runs `python3 -m pip install --user google-analytics-data google-auth-oauthlib google-auth-httplib2` — this installs Python packages into your user environment and requires network access; inspect or run these commands manually if you prefer. 4) The OAuth flow opens a browser; ensure you authorize the correct Google account that has GA4 property access. 5) Minor path inconsistency in some echo messages (the README/install prompts reference slightly different paths) — double-check the actual script locations before running commands. If you or your organization handle enterprise GA data, follow the hard rules in SKILL.md (verify account/permissions first and prefer OAuth user auth over service accounts).
Capability Analysis
Type: OpenClaw Skill Name: ga4-connector Version: 0.1.1 The ga4-connector skill is a standard integration for querying Google Analytics 4 data using official Google libraries. It includes a setup script (install_ga4_openclaw.sh) that manages local configuration and environment variables in shell RC files, and a query script (ga4_query.py) that implements a standard OAuth2 flow to retrieve metrics. No evidence of data exfiltration, malicious execution, or prompt injection was found.
Capability Assessment
Purpose & Capability
Name/description claim GA4 Data API access; included scripts implement OAuth InstalledAppFlow, call the google.analytics.data client, and provide query examples. Required behaviors (client secret, token cache, property ID) are all appropriate for the stated purpose.
Instruction Scope
SKILL.md and scripts are focused on GA4 setup and queries. They instruct installing Python packages, copying the OAuth client JSON to ~/.config/openclaw, running an OAuth browser flow, and storing the token at ~/.config/openclaw/ga4-token.json. Those actions are within the expected scope but are persistent filesystem and shell-config changes (see persistence).
Install Mechanism
No external arbitrary downloads; install script uses `python3 -m pip install --user` for well-known google-auth and analytics packages. No archives or remote executables are fetched from untrusted URLs. This is a typical, low-risk install path for a Python-based connector.
Credentials
The repository metadata lists no required env vars, but the code accepts GA4_PROPERTY_ID via env/argument and the installer writes `export GA4_PROPERTY_ID=...` into the user's shell rc. The skill requires and persists the client secret JSON and OAuth token locally — these are sensitive and should be treated like credentials. This request is proportional to its function, but users must protect those files.
Persistence & Privilege
The skill is not always-enabled and does not request elevated system privileges. It does modify the user's shell rc to export GA4_PROPERTY_ID and writes files to ~/.config/openclaw (client secret and token) and installs Python packages to the user site. Those are expected for this connector but are persistent changes the user should review before running.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install ga4-connector
  3. After installation, invoke the skill by name or use /ga4-connector
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v0.1.1
- Renamed the skill from "ga4-data-api" to "ga4-connector". - No changes to functionality, documentation, or setup instructions.
Metadata
Slug ga4-connector
Version 0.1.1
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is GA4 Connector?

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... It is an AI Agent Skill for Claude Code / OpenClaw, with 234 downloads so far.

How do I install GA4 Connector?

Run "/install ga4-connector" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is GA4 Connector free?

Yes, GA4 Connector is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does GA4 Connector support?

GA4 Connector is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created GA4 Connector?

It is built and maintained by nanaco (@nanaco666); the current version is v0.1.1.

💬 Comments