Google analytics

Learn how to use Google analytics with Composio

Overview

SLUG: GOOGLE_ANALYTICS

Description

Google Analytics tracks and reports website traffic, user behavior, and conversion data, enabling marketers to optimize online performance and customer journeys

Authentication Details

client_id
stringRequired
client_secret
stringRequired
full
stringDefaults to https://analyticsdata.googleapis.comRequired
oauth_redirect_uri
stringDefaults to https://backend.composio.dev/api/v1/auth-apps/add
scopes
stringDefaults to https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/analytics,https://www.googleapis.com/auth/userinfo.profile

Connecting to Google analytics

Create an auth config

Use the dashboard to create an auth config for the Google analytics toolkit. This allows you to connect multiple Google analytics accounts to Composio for agents to use.

1

Select App

Navigate to [Google analytics](https://platform.composio.dev?next_page=/marketplace/Google analytics).

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Google analytics Auth Config”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using OAuth2

1from composio import Composio
2
3# Replace these with your actual values
4google_analytics_auth_config_id = "ac_YOUR_GOOGLE_ANALYTICS_CONFIG_ID" # Auth config ID created above
5user_id = "0000-0000-0000" # UUID from database/application
6
7composio = Composio()
8
9
10def authenticate_toolkit(user_id: str, auth_config_id: str):
11 connection_request = composio.connected_accounts.initiate(
12 user_id=user_id,
13 auth_config_id=auth_config_id,
14 )
15
16 print(
17 f"Visit this URL to authenticate Google analytics: {connection_request.redirect_url}"
18 )
19
20 # This will wait for the auth flow to be completed
21 connection_request.wait_for_connection(timeout=15)
22 return connection_request.id
23
24
25connection_id = authenticate_toolkit(user_id, google_analytics_auth_config_id)
26
27# You can also verify the connection status using:
28connected_account = composio.connected_accounts.get(connection_id)
29print(f"Connected account: {connected_account}")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the [Google analytics toolkit’s playground](https://app.composio.dev/app/Google analytics)

For code examples, see the Tool calling guide and Provider examples.

Tool List

Tool Name: List Audiences

Description

Tool to list Audiences on a property. Use when you need to retrieve audience configurations for a Google Analytics property. Audiences created before 2020 may not be supported.

Action Parameters

pageSize
integer
pageToken
string
parent
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Channel Groups

Description

Tool to list ChannelGroups on a property. Use when you need to retrieve channel groups that categorize traffic sources in Analytics reports.

Action Parameters

pageSize
integer
pageToken
string
parent
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Conversion Events

Description

Tool to list conversion events on a property. Use when you need to retrieve conversion events configured for a given property.

Action Parameters

pageSize
integer
pageToken
string
parent
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Custom Dimensions

Description

Tool to list CustomDimensions on a property. Use when you need to retrieve custom dimensions configured for a given property.

Action Parameters

pageSize
integer
pageToken
string
parent
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List DataStreams

Description

Tool to list DataStreams on a property. Use when you need to retrieve data stream configurations for a Google Analytics property.

Action Parameters

pageSize
integer
pageToken
string
parent
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Measurement Protocol Secrets

Description

Tool to list MeasurementProtocolSecrets under a data stream. Use when you need to retrieve measurement protocol secrets for server-side event tracking.

Action Parameters

pageSize
integer
pageToken
string
parent
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Expanded Data Sets

Description

Tool to list ExpandedDataSets on a property. Use when you need to retrieve expanded data set configurations for a Google Analytics 360 property.

Action Parameters

pageSize
integer
pageToken
string
parent
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Batch Run Pivot Reports

Description

Tool to return multiple pivot reports in a batch for a GA4 property. Use when you need to fetch multiple pivot table reports with multi-dimensional analysis in a single request.

Action Parameters

property
stringRequired
requests
arrayRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Batch Run Reports

Description

Tool to return multiple analytics data reports in a batch. Use when you need to fetch multiple reports for one GA4 property in a single request.

Action Parameters

property
stringRequired
requests
arrayRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Check Compatibility

Description

Tool to list dimensions and metrics compatible with a GA4 report request. Use when you need to validate compatibility of chosen dimensions or metrics before running a report.

Action Parameters

compatibilityFilter
string
dimensionFilter
object
dimensions
array
metricFilter
object
metrics
array
property
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Audience Export

Description

Tool to create an audience export. Use after configuring the audience and dimensions to produce a long-running Operation.

Action Parameters

audience
stringRequired
dimensions
arrayRequired
parent
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Audience List

Description

Tool to create an audience list. Use when you need to define and asynchronously populate a new AudienceList resource under a GA4 property.

Action Parameters

audience
stringRequired
dimensions
arrayRequired
parent
stringRequired
webhookNotification
object

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Expanded Data Set

Description

Tool to create an expanded data set for a property. Use when you need to combine specific dimensions and metrics into a custom dataset after property creation.

Action Parameters

expandedDataSet
objectRequired
parent
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Recurring Audience List

Description

Tool to create a recurring audience list that automatically generates new audience lists daily based on the latest data. Use when you need to automate audience list creation and reduce quota token consumption.

Action Parameters

activeDaysRemaining
integer
audience
stringRequired
dimensions
arrayRequired
parent
stringRequired
webhookNotification
object

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Rollup Property

Description

Tool to create a GA4 Roll-up Property and optionally initial source links.

Action Parameters

account
stringRequired
displayName
stringRequired
sourceProperties
array
timeZone
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Account

Description

Tool to retrieve a single Account by its resource name. Use when you need detailed account info after confirming the account resource name (e.g., accounts/100).

Action Parameters

name
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Attribution Settings

Description

Tool to retrieve attribution configuration for a Google Analytics property. Use when you need to check attribution models, lookback windows, and conversion export settings.

Action Parameters

name
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Audience

Description

Tool to retrieve a single Audience configuration from a Google Analytics property. Use when you need detailed audience information including membership criteria and filter clauses.

Action Parameters

audienceId
stringRequired
propertyId
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Audience Export

Description

Tool to get configuration metadata for an Audience Export. Use after creating an Audience Export to retrieve its status and details.

Action Parameters

name
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Audience List

Description

Tool to get configuration metadata about a specific audience list. Use after confirming the audience list resource name.

Action Parameters

name
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Conversion Event

Description

Tool to retrieve a conversion event (deprecated, use Key Events instead). Use after confirming the conversion event resource name.

Action Parameters

name
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Data Retention Settings

Description

Tool to retrieve data retention configuration for a Google Analytics property. Use when you need to check event-level and user-level data retention durations and reset settings.

Action Parameters

name
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Data Sharing Settings

Description

Tool to retrieve data sharing configuration for a Google Analytics account. Use when you need to check which data sharing settings are enabled for an account, including sharing with Google support, sales teams, products, and benchmarking.

Action Parameters

name
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Google Signals Settings

Description

Tool to retrieve Google Signals configuration settings for a GA4 property. Use when you need to check whether Google Signals is enabled and the consent status for a property.

Action Parameters

name
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Key Event

Description

Tool to retrieve a Key Event. Use after confirming the key event resource name.

Action Parameters

name
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Metadata

Description

Tool to get metadata for dimensions, metrics, and comparisons for a GA4 property. Use when you need to discover available fields before building a report.

Action Parameters

name
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Property

Description

Tool to retrieve a single GA4 Property by its resource name. Use when you need detailed property configuration including display name, time zone, currency, and other settings.

Action Parameters

name
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Property Quotas Snapshot

Description

Tool to retrieve all property quotas organized by category for a given property. Use when you need to check current quota usage for a GA4 property.

Action Parameters

property
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Accounts

Description

Tool to list all Accounts accessible by the caller. Use when you need to enumerate all Google Analytics accounts your credentials can access.

Action Parameters

pageSize
integer
pageToken
string
showDeleted
boolean

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Audience Exports

Description

Tool to list all audience exports for a GA4 property. Use when you need to fetch its export history after initiating exports.

Action Parameters

pageSize
integer
pageToken
string
parent
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Audience Lists

Description

Tool to list all audience lists for a specified property to help find and reuse existing lists. Use when you need to retrieve a property's configured audience lists after confirming the property ID.

Action Parameters

pageSize
integer
pageToken
string
parent
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Audiences

Description

Tool to list all audiences on a property. Use when you need to fetch all audiences for a GA4 property after confirming its existence.

Action Parameters

pageSize
integer
pageToken
string
parent
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Key Events

Description

Tool to list Key Events. Use when you need to retrieve all key event definitions for a given property.

Action Parameters

pageSize
integer
pageToken
string
parent
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Properties

Description

Tool to list GA4 properties under a specific account. Use after obtaining an account ID; supports pagination and including soft-deleted properties.

Action Parameters

account
stringRequired
pageSize
integer
pageToken
string
showDeleted
boolean

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Recurring Audience Lists

Description

Tool to list all recurring audience lists for a GA4 property. Use when you need to find and reuse existing recurring audience lists.

Action Parameters

pageSize
integer
pageToken
string
parent
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Reporting Data Annotations

Description

Tool to list all Reporting Data Annotations on a property. Use when you need to retrieve or inspect annotations for a GA4 property.

Action Parameters

filter
string
pageSize
integer
pageToken
string
parent
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Rollup Properties

Description

Tool to list roll-up GA4 properties accessible to the caller. Use when you need to identify roll-up properties across all accessible accounts.

Action Parameters

pageSize
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List SKAdNetwork Conversion Value Schemas

Description

Tool to list SKAdNetworkConversionValueSchema configurations for an iOS data stream. Use when you need to retrieve conversion value schemas for iOS app tracking. Maximum one schema per property is supported.

Action Parameters

pageSize
integer
pageToken
string
parent
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Audience Export

Description

Tool to create an audience export for Google Analytics. Use when you need to export a snapshot of users in an audience at a specific point in time. This initiates a long-running asynchronous request that returns an operation resource name immediately.

Action Parameters

audience
stringRequired
dimensions
array
parent
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Audience Exports

Description

Tool to list all audience exports for a property. Use when you need to find and reuse existing audience exports rather than creating new ones.

Action Parameters

pageSize
integer
pageToken
string
parent
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Audience List

Description

Tool to create an audience list for later retrieval by initiating a long running asynchronous request. Use when you need to create a snapshot of users currently in an audience. The method returns quickly with an Operation resource while processing occurs in the background.

Action Parameters

audience
stringRequired
dimensions
arrayRequired
parent
stringRequired
webhookNotification
object

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Calculated Metrics

Description

Tool to list CalculatedMetrics on a property. Use when you need to retrieve all calculated metrics configured for a given property.

Action Parameters

pageSize
integer
pageToken
string
parent
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Event Create Rules

Description

Tool to list EventCreateRules configured on a web data stream. Use when you need to retrieve event create rules for a specific GA4 property data stream.

Action Parameters

pageSize
integer
pageToken
string
parent
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Reporting Data Annotations

Description

Tool to list all Reporting Data Annotations for a specific property. Use when you need to retrieve annotations that document important events or periods in GA4 reporting data.

Action Parameters

filter
string
pageSize
integer
pageToken
string
parent
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Report Task

Description

Tool to create a report task as a long-running asynchronous request for customized Google Analytics event data reports. Use when you need to generate large or complex reports that process asynchronously.

Action Parameters

parent
stringRequired
reportDefinition
object

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Report Tasks

Description

Tool to list all report tasks for a Google Analytics property. Use when you need to retrieve report task definitions and their execution status.

Action Parameters

pageSize
integer
pageToken
string
parent
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Subproperty Event Filters

Description

Tool to list all subproperty event filters on a property. Use when you need to retrieve event filters that route events to subproperties.

Action Parameters

pageSize
integer
pageToken
string
parent
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Subproperty Sync Configs

Description

Tool to list SubpropertySyncConfig resources for managing subproperty synchronization configurations. Use when you need to fetch subproperty sync configs for a GA4 property.

Action Parameters

pageSize
integer
pageToken
string
parent
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Query Audience Export

Description

Tool to query a completed audience export. Use when you need to fetch user rows with pagination.

Action Parameters

limit
integer
name
stringRequired
offset
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Query Audience List

Description

Tool to query an audience list. Use when you need to retrieve user rows from a GA4 audience list with pagination.

Action Parameters

limit
integer
name
stringRequired
offset
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Run Funnel Report

Description

Tool to run a GA4 funnel report. Use when you need a customized funnel analysis report for a given property.

Action Parameters

dateRanges
array
dimensionFilter
object
funnel
objectRequired
funnelBreakdown
object
funnelNextAction
object
funnelVisualizationType
string
limit
integer
property
stringRequired
returnPropertyQuota
boolean
segments
array

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Run Pivot Report

Description

Tool to run a customized pivot report of Google Analytics event data. Use when you need a pivot table view with advanced segmentation and multi-dimensional analysis of GA4 data.

Action Parameters

cohortSpec
object
comparisons
array
currencyCode
string
dateRanges
array
dimensionFilter
object
dimensions
array
keepEmptyRows
boolean
metricFilter
object
metrics
arrayRequired
pivots
array
property
stringRequired
returnPropertyQuota
boolean

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Run Realtime Report

Description

Tool to run a customized realtime report of Google Analytics event data. Use when you need realtime data (last 30-60 minutes) with dimensions and metrics for a GA4 property.

Action Parameters

dimensionFilter
object
dimensions
array
limit
integer
metricAggregations
array
metricFilter
object
metrics
array
minuteRanges
array
orderBys
array
property
stringRequired
returnPropertyQuota
boolean

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Run Report

Description

Tool to run a customized GA4 data report. Use when you need event data after specifying dimensions, metrics, and date ranges.

Action Parameters

cohortSpec
object
comparisons
array
currencyCode
string
dateRanges
array
dimensionFilter
object
dimensions
array
keepEmptyRows
boolean
limit
integer
metricAggregations
array
metricFilter
object
metrics
array
offset
integer
orderBys
array
property
stringRequired
returnPropertyQuota
boolean

Action Response

data
objectRequired
error
string
successful
booleanRequired