> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Pull GA4 Reports Into AI Agents

> Let reporting agents query GA4 traffic, metrics, and audience data through the Google Analytics API. The gateway injects OAuth tokens on every request.

> [!WARNING]
>
> **Per-app Google setup is deprecated.** All Google apps now share one Google OAuth client and one Redirect URI. To use your own client, follow the [Google setup guide](/docs/integrations/google.md). Credentials saved for one Google app apply to all of them.

## Overview

Buckle connects AI agents to Google Analytics through Google's OAuth flow. Agents can query reports, read metrics and dimensions, and pull traffic data from your GA4 properties. The gateway injects OAuth credentials into requests to the Google Analytics Data API automatically.

This is useful for reporting agents that generate traffic summaries, marketing agents that monitor campaign performance, or any agent that needs web analytics data.

## What you will set up

* A Google OAuth client shared by every Google app in Buckle
* A Google Analytics connection for your GA4 properties
* Per-agent, per-tool access to reporting data

## Connect Google Analytics

> [!NOTE]
>
> This applies on Buckle Cloud and self-hosted alike. One Google client serves every Google app in Buckle, so you set it up once. If you already did it for another Google app, skip to step 2.

> [accordion] 1. Set up your Google client
>
> Follow the [Google setup guide](/docs/integrations/google.md). It enables the Google APIs, sets up the consent screen, creates the OAuth client, and adds the Redirect URI.

> [accordion] 2. Connect Google Analytics
>
> Open **Settings** > **Apps** > **Google Analytics**, select **Connect Google Analytics**, pick your Google account, and click **Allow**.
>
> ![Buckle connect window for Google Analytics showing Configuration required, the setup guide link, and the Configure credentials button.](https://mintcdn.com/onecli-17d3f772/hJP3XqgFsBDnXHKy/images/integrations/google-analytics/buckle-connect-google-analytics.png?fit=max\&auto=format\&n=hJP3XqgFsBDnXHKy\&q=85\&s=91a807ae14f2c3f2aec88f9b4d5fb395)
>
> The Google Analytics connect window before a Google client is set up.

## What agents can do

* Run reports with custom date ranges, metrics, and dimensions
* Query core metrics (sessions, users, page views, bounce rate, conversions)
* Break down data by dimensions (source, medium, country, page path, device)
* Read real-time active user data
* List GA4 properties and data streams on your account
* Query audience and demographic data
* Read event-level data and custom event parameters
* Compare date ranges for trend analysis
* Query e-commerce metrics (revenue, transactions, items purchased)

## Controlling access

Access is per agent: [grant](/docs/guides/agent-access.md) the connection to each agent that needs it, choosing per tool what runs freely, what needs human approval, and what stays blocked — a read-only agent is a single grant. Organization [rules](/docs/guides/rules.md) add guardrails on top, like rate limits and blanket blocks. Everything is checked before credential injection, so a blocked request never reaches Google Analytics.

## FAQ

> [accordion] Do I need my own Google client for Google Analytics?
>
> Yes. Follow the [Google setup guide](/docs/integrations/google.md) once. One client serves every Google app in Buckle.

> [accordion] Does the agent see my Google token?
>
> No. The token stays in Buckle, and the gateway adds it at the proxy. See [How it works](/docs/how-it-works.md).

> [accordion] How do I reconnect Google Analytics?
>
> Open **Settings** > **Apps** > **Google Analytics** and connect again. Agents with access use the new connection automatically.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.