Skip to main content

Setup

Put them in your environment or .env; Data APIs covers the other ways.

Notes

  • Own-account API: reads properties the signed-in Google user can access. GA4 only; Universal Analytics properties are gone.
  • Property ids are digits only; the path takes them as properties/{id} and this catalog adds the prefix.
  • Report requests are POSTs but only read data.
  • Row counts and offsets are strings (int64) in the JSON. Default limit 10,000, maximum 250,000 per request. Page with offset.
  • Properties have token-based quotas; set returnPropertyQuota: true to see what a call used.

Endpoints

Run a Google Analytics report

  • A read over POST: it only reports data.
  • Incompatible dimension and metric pairs are refused; check with the metadata endpoint.

Run a realtime Google Analytics report

  • A read over POST. Realtime supports a smaller set of dimensions and metrics than runReport.

List a property’s dimensions and metrics

  • Use property id 0 to list only what every property shares (no custom fields).