Skip to main content

Google Analytics - GA4 Component

Manage Google Analytics GA4 accounts and data

Component key: google-analytics-ga4

Changelog ↓

Description

Google Analytics is Google's platform of analytics tooling. This component allows you to manage Analytics GA4 data.

Connections

Google Analytics OAuth 2.0

The Google Analytics component authenticates requests through Google's OAuth 2.0 service.

To create a Google Analytics developer account and authenticate, follow their Configure OAuth Consent guide

Now, you will have to configure OAuth 2.0 settings. Create a new Google Analytics connection of type OAuth 2.0.

  • For Client ID and Client Secret enter the values that you got from the Google Cloud Platform auth settings.
  • For Scopes choose from the list found on Google's service scopes documentation
InputNotesExample
Authorize URL

The OAuth 2.0 Authorization URL for Google Calendar

https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&prompt=consent
Client ID

Provide a string value for the client Id of your OAuth 2.0 application.

Client Secret

Provide a string value for the client secret of your OAuth 2.0 application.

Scopes

A space-delimited set of one or more scopes to get the user's permission to access.

https://www.googleapis.com/auth/analytics https://www.googleapis.com/auth/analytics.manage.users https://www.googleapis.com/auth/analytics.edit https://www.googleapis.com/auth/analytics.readonly
Token URL

The OAuth 2.0 Token URL for Google Analytics

https://oauth2.googleapis.com/token

Data Sources

List Accounts

Return a list of accounts accessible by the caller | key: listAccounts | type: picklist

InputNotesExample
Connection

{
"result": [
{
"key": "accounts/000000000",
"label": "My Account 1"
},
{
"key": "accounts/000000001",
"label": "My Account 2"
}
]
}

List Properties

List Google Analytics GA4 properties for an account | key: listProperties | type: picklist

InputNotesExample
Account ID

The Google Analytics Account ID.

accounts/000000000
Connection

Actions

Get Property

Get property by ID | key: getProperty

InputNotesExample
Account ID

The Google Analytics Account ID.

accounts/000000000
Connection
Property ID

The Google Analytics GA4 Property ID.

properties/111111111

{
"data": {
"name": "properties/111111111",
"parent": "accounts/000000000",
"createTime": "2022-02-02T04:40:59.611Z",
"updateTime": "2022-02-02T04:40:59.611Z",
"displayName": "www.example.com",
"industryCategory": "OTHER",
"timeZone": "America/Chicago",
"currencyCode": "USD",
"serviceLevel": "GOOGLE_ANALYTICS_STANDARD",
"account": "accounts/000000000",
"propertyType": "PROPERTY_TYPE_ORDINARY"
}
}

List Accounts

Return a list of accounts accessible by the caller | key: listAccounts

InputNotesExample
Connection
Fetch All

When true, retrieves all pages of results.

false
Page Size

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to return. If unspecified, the default is 50; the maximum is 200.

100
Page Token

If a previous response was truncated, the response includes a nextPageToken. To retrieve the next page of results, set this parameter to the value of nextPageToken from the previous response.

CjwKCAjwpdqkBhB-EiwA4Kk0u3bXgYx5mXo3nZl6e7jYz1hA0r8D6Gq2b8g7fX9WlX1Jf4bJpQ8YhoCjvsQAvD_BwE

{
"data": {
"accounts": [
{
"name": "accounts/000000000",
"createTime": "2012-11-20T15:12:07.864Z",
"updateTime": "2015-08-11T21:08:55.416Z",
"displayName": "Example Account",
"regionCode": "US"
}
]
}
}

List Properties

List Google Analytics GA4 properties for an account | key: listProperties

InputNotesExample
Account ID

The Google Analytics Account ID.

accounts/000000000
Connection
Fetch All

When true, retrieves all pages of results.

false
Page Size

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to return. If unspecified, the default is 50; the maximum is 200.

100
Page Token

If a previous response was truncated, the response includes a nextPageToken. To retrieve the next page of results, set this parameter to the value of nextPageToken from the previous response.

CjwKCAjwpdqkBhB-EiwA4Kk0u3bXgYx5mXo3nZl6e7jYz1hA0r8D6Gq2b8g7fX9WlX1Jf4bJpQ8YhoCjvsQAvD_BwE

{
"data": {
"properties": [
{
"name": "properties/111111111",
"parent": "accounts/000000000",
"createTime": "2022-02-02T04:40:59.611Z",
"updateTime": "2022-02-02T04:40:59.611Z",
"displayName": "www.example.com",
"industryCategory": "OTHER",
"timeZone": "America/Chicago",
"currencyCode": "USD",
"serviceLevel": "GOOGLE_ANALYTICS_STANDARD",
"account": "accounts/000000000",
"propertyType": "PROPERTY_TYPE_ORDINARY"
}
]
}
}

Raw Request

Send raw HTTP request to Google Analytics GA4 | key: rawRequest

InputNotesExample
Base URL
Connection
Data

The HTTP body payload to send to the URL.

{"exampleKey": "Example Data"}
File Data

File Data to be sent as a multipart form upload.

[{key: "example.txt", value: "My File Contents"}]
File Data File Names

File names to apply to the file data inputs. Keys must match the file data keys above.

Form Data

The Form Data to be sent as a multipart form upload.

[{"key": "Example Key", "value": new Buffer("Hello World")}]
Header

A list of headers to send with the request.

User-Agent: curl/7.64.1
Max Retry Count

The maximum number of retries to attempt. Specify 0 for no retries.

0
Method

The HTTP method to use.

Query Parameter

A list of query parameters to send with the request. This is the portion at the end of the URL similar to ?key1=value1&key2=value2.

Response Type

The type of data you expect in the response. You can request json, text, or binary data.

json
Retry On All Errors

If true, retries on all erroneous responses regardless of type. This is helpful when retrying after HTTP 429 or other 3xx or 4xx errors. Otherwise, only retries on HTTP 5xx and network errors.

false
Retry Delay (ms)

The delay in milliseconds between retries. This is used when 'Use Exponential Backoff' is disabled.

0
Timeout

The maximum time that a client will await a response to its request

2000
URL

Input the path only (/accounts), the base URL comes from the Base URL input. For example, to connect to <INPUT_BASE_URL>/accounts, only /accounts is entered in this field.

/accounts
Use Exponential Backoff

Specifies whether to use a pre-defined exponential backoff strategy for retries. When enabled, 'Retry Delay (ms)' is ignored.

false

Run Report

Run a customized report on your Google Analytics event data | key: runReport

InputNotesExample
Connection
Property ID

The Google Analytics GA4 Property ID.

properties/111111111
Request Body

See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport for details on what dimensions, metrics, etc., you can specify.

{
"data": {
"dimensionHeaders": [
{
"name": "pageTitle"
}
],
"metricHeaders": [
{
"name": "sessions",
"type": "TYPE_INTEGER"
}
],
"rows": [
{
"dimensionValues": [
{
"value": "My Example Page | My Website"
}
],
"metricValues": [
{
"value": "9"
}
]
},
{
"dimensionValues": [
{
"value": "A blog post | My Blog"
}
],
"metricValues": [
{
"value": "3"
}
]
}
],
"rowCount": 2,
"metadata": {
"currencyCode": "USD",
"timeZone": "America/Chicago"
},
"kind": "analyticsData#runReport"
}
}

Send Measurement Protocol Events

Sends Measurement Protocol Events to your Google Analytics G4 Account | key: sendMeasurementProtocolEvents

InputNotesExample
API Secret

The API secret for your Google Analytics G4. Generated in the Google Analytics UI

Str5ahciR5SJtWClz1mkRA
App Instance ID

Your App's instance ID.

12345678901234567890123456789012
Events To Send

The events to send to Google Analytics

Firebase App ID

The Firebase App ID, found in the Firebase console under Project Settings > General > Your Apps > App ID

1:123456789012:web:1234567890123456789012

{
"data": {
"message": "Event Sent Successfully"
}
}

Changelog

2025-10-17

Added inline data sources for accounts and properties to enhance data selection capabilities.