Google Analytics

{/* Generated by scripts/generate-integration-catalog.mjs. Do not edit by hand. */}

At a glance

  • Availability: Experimental (how to enable).
  • Authentication: OAuth 2.0.
  • Connection: A user authorizes the connection in the provider's consent screen.
  • Scopes: https://www.googleapis.com/auth/analytics.readonly.
  • Provider documentation: Authentication reference.

Credentials

Set these per environment. See Connect an integration.

These variables are required only when you supply your own OAuth app. If a managed app is available, you can connect without setting them. Provider permissions and consent still apply.

VariableRequiredDescription
GOOGLE_CLIENT_IDYesGoogle OAuth Client ID Docs.
GOOGLE_CLIENT_SECRETYesGoogle OAuth Client Secret Docs.

Setup

  1. 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.
  2. Enable the Analytics APIs: Enable both the Google Analytics Data API and the Google Analytics Admin API in the API Library.
  3. 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.
  4. 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).
  5. 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"}].

Provider notes

  • 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

Provider API reference.

Tools

ToolAccessDescription
List Account Summaries<br /><code className="reference-identifier">google-analytics__list_account_summaries</code>ReadList account summaries
Run Report<br /><code className="reference-identifier">google-analytics__run_report</code>ReadRun report
Run Realtime Report<br /><code className="reference-identifier">google-analytics__run_realtime_report</code>ReadRun realtime report (last 30 minutes)
Get Report Metadata<br /><code className="reference-identifier">google-analytics__get_metadata</code>ReadGet report metadata

Verify the connection

Call a read tool such as google-analytics__list_account_summaries with arguments for your account. Confirm that the result comes from the intended account or workspace before enabling write tools.