Agent skill · data analytics · jeremylongshore

ga4-data-api-query

Build a runReport request against the GA4 Data API v1 — pick valid metric/dimension combinations, set date ranges that respect data-freshness limits, apply filters, paginate large result sets, handle sampling thresholds. Trigger with "query GA4", "GA4 Data API", "runReport", "fetch GA4 metrics", "GA4 pageviews", "GA4 sessions".

Why this skill is useful

Provides specific GA4 Data API v1 query patterns and valid metric/dimension combinations that the AI wouldn't reliably generate on its own.

What it needs

Requires curl, python3 installed locally. Requires google-analytics account access. About 5k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.

What this skill does

GA4 Data API v1 — runReport Overview The Data API v1 is the canonical read path for GA4. One endpoint (runReport) covers most use cases. Two paths matter for picking the right query: dimensions describe rows (date, page, source), metrics describe values (sessions, users, events). Not every combination is valid — see "Compatibility" below. Prerequisite: auth working (see ga4-auth-setup). Prerequisites An authenticated GA4 Data API client with access to the target property; follow ga4-auth-setup first. Python and the google-analytics-data package. A numeric GA4 property ID and a bounded date range appropriate to the metric's freshness. Instructions Examples The minimum viable query That's the full skeleton. Everything below extends this shape. The 12 metrics worth knowing Metric What it counts Notes --- --- --- activeUsers Unique users with engagement in the window The "users" people mean by default newUsers First-seen users in the window totalUsers All users (engaged or not) — superset of activeUsers sessions Sessions started in the window Re-engages after 30min inactivity engagedSessions Sessions ≥10s OR ≥2 pageviews OR ≥1 conversion The "good" sessions screenPageViews Pageviews + app screenviews combined What people mean by "pageviews" eventCount Total event count (every event, not just pageview) Often misleadingly large bounceRate (sessions - engagedSessions) / sessions Lower is better averageSessionDuration Avg seconds per session Across sessions, not engagedSessions eventsPerSession eventCount / sessions conversions Events flagged as conversions in the property setup Property-specific totalRevenue Sum of purchase event revenue Currency = property default bounceRate and averageSessionDuration are ratios — don't SUM them across rows; they're already aggregated within each row's group. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills jeremylongshore/ga4-data-api-query

View the source on GitHub

Browse the @skills marketplace