Skip to content

ga4-api

Use when working with Google Analytics 4 API - GA4 reporting, analytics data queries, property management, Measurement Protocol, or event tracking. Also use when querying GA4 dimensions, metrics, or setting up server-side analytics.

ModelSource
sonnetpack: google-apis
Full Reference

┏━ πŸ”§ ga4-api ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Use when working with Google Analytics 4 API -… ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

GA4 exposes three APIs: Data API v1beta (reporting queries), Admin API v1beta (property and configuration management), and Measurement Protocol (server-side event ingestion). All three are covered in the reference docs below. Data API v1beta and Admin API v1beta are production-stable; v1alpha variants are preview-only and may have breaking changes.

APIVersionBase URLAuth
Data APIv1beta (prod), v1alpha (preview)https://analyticsdata.googleapis.comService account or OAuth 2.0
Admin APIv1beta (prod), v1alpha (preview)https://analyticsadmin.googleapis.comService account or OAuth 2.0
Measurement ProtocolStablehttps://www.google-analytics.com/mp/collectapi_secret query param

Official docs: https://developers.google.com/analytics/devguides/reporting/data/v1

Load only the reference docs relevant to the current task.

I want to…File
Setting up service account or OAuth authenticationreference/auth.md
Running reports, filtering, date ranges, batch queriesreference/reporting.md
Looking up dimension/metric API namesreference/dimensions-metrics.md
Managing properties, streams, key events, custom dims/metricsreference/admin.md
BigQuery export setup and SQL query patternsreference/admin.md
Sending server-side events, validation, consent modereference/measurement-protocol.md
Token quotas, rate limits, quota monitoringreference/quotas.md
Recent API changes, migration from conversionEvents, stabilityreference/changelog.md

Usage: Read the reference file matching your current task from the index above. Each file is self-contained with code examples and inline gotchas.