Skip to main content

Google Analytics - GA4 Component

Manage Google Analytics GA4 accounts and data

Component key: google-analytics-ga4

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 in Prismatic. 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

Data Sources

List Accounts

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

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

List Properties

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


Actions

Get Property

Get property by ID | key: getProperty

{
"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

{
"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 Analyatics GA4 properties for an account | key: listProperties

{
"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


Run Report

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

{
"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

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