At a glance
- Availability: Experimental (how to enable).
- Auth: OAuth 2.0.
- Connection: A user authorizes the connection in the provider’s consent screen.
- Scopes:
https://www.googleapis.com/auth/analytics.readonly. - Docs: https://developers.google.com/analytics/devguides/reporting/data/v1
Credentials
Set these per environment. See Connect an integration. With a managed OAuth app, Connect works without these variables; set them to use your own OAuth app instead.Setup
- Create or reuse a Google Cloud project: Go to https://console.cloud.google.com and select or create the project that holds your OAuth credentials.
- Enable the Analytics APIs: Enable both the Google Analytics Data API and the Google Analytics Admin API in the API Library.
- Configure OAuth credentials: Under APIs & Services → Credentials, create (or reuse) an OAuth 2.0 Client ID of type Web application and add your callback URL (e.g. https://your-app.example.com/api/auth/google-analytics/callback) to the authorized redirect URIs.
- Set environment variables: Add GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET to your .env. These are shared with the other Google connectors (Calendar, Gmail, Drive, Sheets).
- Verify access: Connect your Google account, run List Account Summaries to find a property ID, then run a report with metrics [{“name”:“activeUsers”}] and dateRanges [{“startDate”:“7daysAgo”,“endDate”:“today”}].
- This connector is read-only (analytics.readonly scope) and targets GA4 properties; Universal Analytics is sunset
- Property IDs are numeric (e.g. 123456789) - not the G-XXXX measurement ID
Tools
| Tool | Access | Description |
|---|---|---|
| List Account Summaries | Read | List GA4 accounts and their properties accessible to the connected user (use this to find property IDs) |
| Run Report | Read | Run a GA4 report for a property over one or more date ranges |
| Run Realtime Report | Read | Run a GA4 realtime report showing activity from the last 30 minutes |
| Get Report Metadata | Read | List the dimensions and metrics available for a GA4 property (use before building reports) |
Example prompts
- Show active users and sessions for my Google Analytics property over the last 7 days, broken down by country.
- Show the number of active users on my site right now using Google Analytics realtime data.