google-analytics
Google Analytics (GA4)Official API (no first-party CLI) · GA4 Data API
- Reads
- users, sessions, pageviews, events, conversions, retention.
- Locators
- GA4 property id plus a page path, event name, or serialized report query.
- Evidence for a linked target
- GA4 Data API report result for the property.
Usage
Agent command: superdense reward docs connectors --connector google-analytics
# google-analytics — usage
GA4 has no first-party CLI; call the official **GA4 Data API** with a service account.
This is the canonical meter for website traffic and funnel/onboarding conversions.
```bash
# runReport against a property (POST with an OAuth/service-account token)
curl -X POST \
"https://analyticsdata.googleapis.com/v1beta/properties/<id>:runReport" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"dateRanges":[{"startDate":"28daysAgo","endDate":"today"}],"metrics":[{"name":"activeUsers"},{"name":"conversions"}]}'
```
**Reward dimensions:** users, sessions, pageviews, events, conversions.
**Locators:** GA4 property id + page path / event / report query.Install
Agent command: superdense reward docs connectors --connector google-analytics --section install
Google Analytics (GA4) has **no first-party CLI**. Call the official API directly with credentials you control. You need a Google Cloud project, the Analytics Data API enabled, and a service account with viewer access on the GA4 property. Set up access via the provider's official docs (credentials, scopes, and quotas live there): - https://developers.google.com/analytics/devguides/reporting/data/v1/quickstart-client-libraries
Troubleshoot
Agent command: superdense reward docs connectors --connector google-analytics --section troubleshoot
GA4 Data API failures are almost always credential, scope, or quota issues. Check, in order: 1. **Token validity** — refresh/rotate the access token. 2. **Scopes** — confirm the token grants the metric you are reading. 3. **Quota** — confirm you are within the daily/per-minute limits. Reference the official docs for error codes and limits: - https://developers.google.com/analytics/devguides/reporting/data/v1/errors