# Google Analytics

Source: https://docs.autessa.com/docs/tools/google-analytics

> Tool types for the Google Analytics connector.

# Google Analytics

Read-only tool types over GA4: run standard and realtime reports, pull conversion and event breakdowns, list the properties an account can see, and look up which dimensions and metrics a property supports.

Every type on this page requires a [Google Analytics connector](/docs/guide/connectors.md); `connectorId` is the ID of that connector. All reporting tools target a GA4 `propertyId` in the `properties/123456789` form — use `GOOGLE_ANALYTICS_LIST_PROPERTIES` to discover it, and `GOOGLE_ANALYTICS_GET_METADATA` to find valid dimension and metric names before building a report.

## Run report **TOOL** `GOOGLE_ANALYTICS_RUN_REPORT`

Runs a standard GA4 report: any combination of dimensions and metrics over a date range, ordered and capped as you choose. Dimensions and metrics are comma-separated GA4 API names (`date,pagePath,sessionSource` / `activeUsers,sessions,screenPageViews`), and dates accept both `YYYY-MM-DD` and relative forms like `7daysAgo` or `yesterday`. This is the general-purpose tool — the conversions and events tools below are convenience wrappers over the same reporting API.

### Example

```json title="Tool config"
{
  "toolType": "GOOGLE_ANALYTICS_RUN_REPORT",
  "connectorId": "V1StGXR8Z5",
  "propertyId": "properties/123456789",
  "startDate": "30daysAgo",
  "endDate": "today",
  "dimensions": "date,sessionSource",
  "metrics": "activeUsers,sessions,screenPageViews",
  "limit": 1000,
  "orderBy": "sessions",
  "orderDirection": "DESCENDING"
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — The connector ID for the Google Analytics connection References a connector by ID.
- `propertyId` (string) — The GA4 property ID to query (e.g., "properties/123456789"). Get available properties from the connector's propertiesData.
- `startDate` (string) — Start date in YYYY-MM-DD format, or relative date like 'yesterday', '7daysAgo', '30daysAgo'
- `endDate` (string) — End date in YYYY-MM-DD format, or relative date like 'today', 'yesterday'
- `dimensions` (string) — Comma-separated dimensions to include. Examples: date,pagePath,sessionSource,deviceCategory,country
- `metrics` (string) — Comma-separated metrics to include. Examples: activeUsers,sessions,screenPageViews,bounceRate,averageSessionDuration
- `limit` (integer) — Maximum number of rows to return (default 10000)
- `orderBy` (string) — Field to order results by (must be a metric or dimension in the request)
- `orderDirection` (string) — Order direction: ASCENDING or DESCENDING

## Realtime report **TOOL** `GOOGLE_ANALYTICS_REALTIME_REPORT`

Reports on activity happening right now (roughly the last 30 minutes) — no date range, just realtime dimensions and metrics like `unifiedScreenName,country` and `activeUsers,screenPageViews`. Note that the realtime API supports a smaller dimension/metric set than standard reports, and the default row limit is 100.

### Example

```json title="Tool config"
{
  "toolType": "GOOGLE_ANALYTICS_REALTIME_REPORT",
  "connectorId": "V1StGXR8Z5",
  "propertyId": "properties/123456789",
  "dimensions": "unifiedScreenName,country",
  "metrics": "activeUsers",
  "limit": 100
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — The connector ID for the Google Analytics connection References a connector by ID.
- `propertyId` (string) — The GA4 property ID to query (e.g., "properties/123456789"). Get available properties from the connector's propertiesData.
- `dimensions` (string) — Comma-separated realtime dimensions. Examples: unifiedScreenName,country,city,deviceCategory,platform
- `metrics` (string) — Comma-separated realtime metrics. Examples: activeUsers,screenPageViews,conversions,eventCount
- `limit` (integer) — Maximum number of rows to return (default 100 for realtime)

## Get conversions **TOOL** `GOOGLE_ANALYTICS_GET_CONVERSIONS`

Reports on key (conversion) events — `purchase`, `sign_up`, `generate_lead`, and any custom events marked as conversions — broken down by the dimensions you choose. `conversionEvents` is a comma-separated filter of event names, so an agent can compare specific funnels side by side without pulling every event in the property.

### Example

```json title="Tool config"
{
  "toolType": "GOOGLE_ANALYTICS_GET_CONVERSIONS",
  "connectorId": "V1StGXR8Z5",
  "propertyId": "properties/123456789",
  "startDate": "7daysAgo",
  "endDate": "today",
  "conversionEvents": "purchase,sign_up",
  "dimensions": "date,sessionSource",
  "limit": 500
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — The connector ID for the Google Analytics connection References a connector by ID.
- `propertyId` (string) — The GA4 property ID to query (e.g., "properties/123456789"). Get available properties from the connector's propertiesData.
- `startDate` (string) — Start date in YYYY-MM-DD format, or relative date like '7daysAgo', '30daysAgo'
- `endDate` (string) — End date in YYYY-MM-DD format, or relative date like 'today', 'yesterday'
- `conversionEvents` (string) — Comma-separated conversion event names to filter by. Examples: purchase,sign_up,generate_lead,add_to_cart
- `dimensions` (string) — Comma-separated dimensions to break down conversions. Examples: date,sessionSource,deviceCategory,country
- `limit` (integer) — Maximum number of rows to return

## Get events **TOOL** `GOOGLE_ANALYTICS_GET_EVENTS`

Reports event counts over a date range, filtered to specific `eventNames` (comma-separated) or all events when the filter is empty. Break results down with dimensions like `date,pagePath,sessionSource` to see where and when events fire.

### Example

```json title="Tool config"
{
  "toolType": "GOOGLE_ANALYTICS_GET_EVENTS",
  "connectorId": "V1StGXR8Z5",
  "propertyId": "properties/123456789",
  "startDate": "30daysAgo",
  "endDate": "today",
  "eventNames": "page_view,video_start",
  "dimensions": "date,pagePath",
  "limit": 1000
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — The connector ID for the Google Analytics connection References a connector by ID.
- `propertyId` (string) — The GA4 property ID to query (e.g., "properties/123456789"). Get available properties from the connector's propertiesData.
- `startDate` (string) — Start date in YYYY-MM-DD format, or relative date like '7daysAgo', '30daysAgo'
- `endDate` (string) — End date in YYYY-MM-DD format, or relative date like 'today', 'yesterday'
- `eventNames` (string) — Comma-separated event names to filter by. If empty, returns all events. Examples: page_view,scroll,click,video_start
- `dimensions` (string) — Comma-separated dimensions to break down events. Examples: date,pagePath,sessionSource
- `limit` (integer) — Maximum number of rows to return

## List properties **TOOL** `GOOGLE_ANALYTICS_LIST_PROPERTIES`

Lists every GA4 property the connected account can access, grouped by Analytics account, with the `properties/...` IDs the reporting tools need. Takes no parameters beyond the connector — agents call it once at the start of an analytics conversation to resolve which property to query.

### Example

```json title="Tool config"
{
  "toolType": "GOOGLE_ANALYTICS_LIST_PROPERTIES",
  "connectorId": "V1StGXR8Z5"
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — The connector ID for the Google Analytics connection References a connector by ID.

## Get metadata **TOOL** `GOOGLE_ANALYTICS_GET_METADATA`

Returns the dimensions and metrics a property supports, including custom definitions when `includeCustomDefinitions` is true (the default). The optional `query` filters results case-insensitively across API names, UI names, and descriptions — e.g. `"page"` surfaces `pagePath`, `pageTitle`, and `screenPageViews`. Give this tool to any agent that builds reports dynamically, so it can verify field names instead of hallucinating them.

### Example

```json title="Tool config"
{
  "toolType": "GOOGLE_ANALYTICS_GET_METADATA",
  "connectorId": "V1StGXR8Z5",
  "propertyId": "properties/123456789",
  "includeCustomDefinitions": true,
  "query": "@@{searchTerm}"
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — The connector ID for the Google Analytics connection References a connector by ID.
- `propertyId` (string) — The GA4 property ID to get metadata for (e.g., "properties/123456789"). Required if includeCustomDefinitions is true.
- `includeCustomDefinitions` (boolean) — If true, includes custom dimensions and metrics specific to the property. If false, only returns universal dimensions and metrics common to all properties. Default: true
- `query` (string · optional) — Optional search query to filter dimensions and metrics. Matches against apiName, uiName, and description (case-insensitive). Example: "page" will return dimensions/metrics like pagePath, pageTitle, screenPageViews, etc.

## Related

- [Connectors](/docs/guide/connectors.md)
- [Tools guide](/docs/guide/agentic/tools.md)
- [BigQuery](/docs/tools/bigquery.md)
- [All tool types](/docs/tools.md)

