ga4_skill

This skill helps you retrieve GA4 analytics like top pages, traffic sources, and conversions from the Analytics Data API.
  • Python

2.5k

GitHub Stars

2

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill openclaw/skills --skill ga4

  • _meta.json623 B
  • SKILL.md2.8 KB

Overview

This skill queries Google Analytics 4 properties via the Analytics Data API to retrieve pageviews, sessions, users, conversions, traffic sources, and other GA4 metrics and dimensions. It supports custom date ranges, filtering, and multiple output formats (table, JSON, CSV) for easy integration into reports or automation. Use it to pull both standard and custom metric/dimension combinations for analysis or backups.

How this skill works

The skill authenticates using OAuth credentials and a refresh token, targets a GA4 property ID, and sends requests to the Analytics Data API to fetch metrics and dimensions. You specify metrics, dimensions, date ranges, limits, and filters; the tool returns tabular data or optional JSON/CSV exports for downstream use. Common queries include top pages, traffic sources, landing pages, and event/conversion counts.

When to use it

  • Pull top pages, sessions, users, or conversion counts for a property.
  • Generate date-range reports for weekly, monthly, or custom periods.
  • Filter analytics by page path, campaign, country, device, or other dimensions.
  • Export GA4 query results as JSON or CSV for BI tools or backups.
  • Automate periodic analytics snapshots for archival or auditing.

Best practices

  • Set environment variables for GA4_PROPERTY_ID, GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, and GOOGLE_REFRESH_TOKEN before running queries.
  • Limit the number of dimensions and metrics per request to avoid API quota and performance issues.
  • Use sensible date ranges and pagination (limit) when querying large datasets.
  • Apply filters to narrow results (e.g., pagePath=~/blog/) instead of pulling full property data.
  • Prefer JSON or CSV outputs for automated pipelines and table output for quick ad-hoc checks.

Example use cases

  • Get top 30 pages by pageviews: metric screenPageViews with dimension pagePath and limit 30.
  • Compare sessions and users for a landing page over a two-week range by specifying start and end dates.
  • List traffic sources by sessions to identify highest-performing referral sources.
  • Export a CSV of landing pages with session counts for campaign reporting.
  • Filter analytics to only blog pages using a regex filter on pagePath for content performance analysis.

FAQ

You need OAuth client ID/secret and a refresh token, plus the numeric GA4_PROPERTY_ID set as environment variables.

Can I request multiple metrics and dimensions at once?

Yes; you can combine metrics and dimensions, but keep requests concise to avoid API limits and improve performance.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational