ga4-auth-setup
Installation
SKILL.md
GA4 Auth Setup
Overview
GA4 has two production-grade auth paths. Pick before you start; mixing them mid-flight is the most common failure mode.
| Path | When | Credential file |
|---|---|---|
| Service account | Automation, CI, server-side scripts. Token is long-lived, scoped, revocable. | ~/.config/gcloud/sa-ga4.json (or any path you choose) |
| OAuth user creds | Interactive use, multiple GA4 properties, ad-hoc analyst work. Token refreshes from a ~/.config/gcloud/application_default_credentials.json file. |
ADC |
Recommendation: service account for any pipeline / report-runner / agent use. OAuth for a human poking around. Don't share OAuth user creds across machines — that's an audit-trail mess.
Prerequisites
- A Google Cloud project where you can create a service account and enable APIs, or a Google account with access to the target GA4 property.
- The GA4 property ID (digits only, not the
G-...measurement ID). gcloudauthenticated to the GCP project; the Python verification also needs the Google Analytics Data API client library installed.