← Back to Skills Marketplace
jdrhyne

GA4 Analytics

by Jonathan Rhyne · GitHub ↗ · v1.2.2
cross-platform ✓ Security Clean
3812
Downloads
1
Stars
24
Active Installs
5
Versions
Install in OpenClaw
/install ga4
Description
Query Google Analytics 4 (GA4) data via the Analytics Data API. Use when you need to pull website analytics like top pages, traffic sources, user counts, ses...
README (SKILL.md)

GA4 - Google Analytics 4 Data API

Query GA4 properties for analytics data: page views, sessions, users, traffic sources, conversions, and more.

Setup (one-time)

  1. Enable Google Analytics Data API: https://console.cloud.google.com/apis/library/analyticsdata.googleapis.com
  2. Create OAuth credentials or use existing Google Cloud project
  3. Set environment variables:
    • GA4_PROPERTY_ID - Your GA4 property ID (numeric, e.g., "123456789")
    • GOOGLE_CLIENT_ID - OAuth client ID
    • GOOGLE_CLIENT_SECRET - OAuth client secret
    • GOOGLE_REFRESH_TOKEN - OAuth refresh token (from initial auth flow)

Safety Boundaries

  • This skill only connects to Google Analytics Data API endpoints.
  • It does NOT write to or modify your GA4 property — read-only queries only.
  • It does NOT store or transmit credentials beyond the current session.
  • It requires OAuth credentials (client ID, secret, refresh token) set as environment variables.

Common Queries

Top Pages (by pageviews)

python3 scripts/ga4_query.py --metric screenPageViews --dimension pagePath --limit 30

Top Pages with Sessions & Users

python3 scripts/ga4_query.py --metrics screenPageViews,sessions,totalUsers --dimension pagePath --limit 20

Traffic Sources

python3 scripts/ga4_query.py --metric sessions --dimension sessionSource --limit 20

Landing Pages

python3 scripts/ga4_query.py --metric sessions --dimension landingPage --limit 30

Custom Date Range

python3 scripts/ga4_query.py --metric sessions --dimension pagePath --start 2026-01-01 --end 2026-01-15

Filter by Page Path

python3 scripts/ga4_query.py --metric screenPageViews --dimension pagePath --filter "pagePath=~/blog/"

Available Metrics

Common metrics: screenPageViews, sessions, totalUsers, newUsers, activeUsers, bounceRate, averageSessionDuration, conversions, eventCount

Available Dimensions

Common dimensions: pagePath, pageTitle, landingPage, sessionSource, sessionMedium, sessionCampaignName, country, city, deviceCategory, browser, date

Output Formats

Default: Table format Add --json for JSON output Add --csv for CSV output

Usage Guidance
This skill appears to do only what it says: run read-only GA4 queries. Before installing or running: (1) review the provided scripts locally (they're small and readable); (2) only use OAuth credentials that you trust and scope to read-only Analytics access; (3) be aware the auth script prints tokens to your terminal — avoid running in shared environments or pasting tokens where others can see them; (4) if you prefer not to use a client secret/refresh token, consider creating dedicated credentials or a least-privileged account for this purpose; and (5) run pip dependency installation in a virtual environment to avoid affecting global packages. If you need higher assurance, ask the publisher for source provenance (the registry owner ID is included) before adding sensitive credentials.
Capability Analysis
Type: OpenClaw Skill Name: ga4 Version: 1.2.2 The OpenClaw AgentSkills bundle for GA4 is benign. It provides Python scripts (`ga4_auth.py`, `ga4_query.py`) to authenticate with and query the Google Analytics Data API. The `SKILL.md` clearly outlines its purpose and required environment variables for Google OAuth credentials. Crucially, the `ga4_query.py` script safely parses user input for filtering (e.g., `--filter 'pagePath=~/blog/'`) by constructing Google API `FilterExpression` objects, preventing shell injection. There is no evidence of data exfiltration to unauthorized endpoints, malicious execution, persistence mechanisms, or prompt injection attempts against the agent in the `SKILL.md`.
Capability Assessment
Purpose & Capability
The name/description (GA4 Data API queries) matches the requested environment variables (GA4_PROPERTY_ID, GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GOOGLE_REFRESH_TOKEN) and the included Python scripts. OAuth client credentials and a refresh token are reasonable and expected for offline read-only access to GA4.
Instruction Scope
SKILL.md and the scripts limit activity to the Google OAuth endpoints and the Analytics Data API. ga4_auth.py prints tokens to stdout and instructs the user to export the refresh token into their environment; the skill does not persist credentials to disk itself. Users should be aware that following the auth flow will surface tokens in the terminal, which they then may store in their environment (outside the skill).
Install Mechanism
There is no automated install downloader; the skill is instruction-only and the Python scripts simply require standard pip packages (google-analytics-data, google-auth-oauthlib). The scripts themselves do not fetch arbitrary code from unknown URLs.
Credentials
Requested environment variables are limited to what the GA4 read-only flow needs (property ID + OAuth client ID/secret/refresh token). No unrelated credentials, system config paths, or secret-named variables are requested.
Persistence & Privilege
The skill is not always-enabled, does not alter other skills or system configuration, and does not create persistent background services. It only runs as invoked and uses provided credentials for API calls.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install ga4
  3. After installation, invoke the skill by name or use /ga4
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.2.2
Scanner hardening: align _meta version with release and keep explicit openclaw env/bin requirements
v1.2.1
Hardening correction: publish explicit openclaw env/bin requirements and metadata coherence fixes
v1.2.0
Hardening pass: normalize openclaw metadata with explicit env/bin requirements and homepage for scanner coherence
v1.1.0
Fix suspicious flag: declare required env vars (GA4_PROPERTY_ID, GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GOOGLE_REFRESH_TOKEN), add Safety Boundaries section
v1.0.0
Initial release: Query GA4 Data API for pageviews, sessions, traffic sources, and more
Metadata
Slug ga4
Version 1.2.2
License
All-time Installs 28
Active Installs 24
Total Versions 5
Frequently Asked Questions

What is GA4 Analytics?

Query Google Analytics 4 (GA4) data via the Analytics Data API. Use when you need to pull website analytics like top pages, traffic sources, user counts, ses... It is an AI Agent Skill for Claude Code / OpenClaw, with 3812 downloads so far.

How do I install GA4 Analytics?

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

Is GA4 Analytics free?

Yes, GA4 Analytics is completely free (open-source). You can download, install and use it at no cost.

Which platforms does GA4 Analytics support?

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

Who created GA4 Analytics?

It is built and maintained by Jonathan Rhyne (@jdrhyne); the current version is v1.2.2.

💬 Comments