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
Input | Default | Notes |
---|---|---|
Authorize URL string / Required Hidden Field authorizeUrl | https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&prompt=consent | The OAuth 2.0 Authorization URL for Google Calendar |
Client ID string / Required clientId | Provide a string value for the client Id of your OAuth 2.0 application. | |
Client Secret password / Required clientSecret | Provide a string value for the client secret of your OAuth 2.0 application. | |
Scopes string / Required scopes | 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 | A space-delimited set of one or more scopes to get the user's permission to access. |
Token URL string / Required Hidden Field tokenUrl | https://oauth2.googleapis.com/token | The OAuth 2.0 Token URL for Google Analytics |
Data Sources
List Accounts
Return a list of accounts accessible by the caller | key: listAccounts | type: picklist
Input | Notes |
---|---|
Connection connection / Required connection |
Example Payload for List Accounts
{
"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
Input | Notes | Example |
---|---|---|
Account ID string / Required accountId | accounts/000000000 | |
Connection connection / Required connection |
Actions
Get Property
Get property by ID | key: getProperty
Input | Notes | Example |
---|---|---|
Connection connection / Required connection | ||
Property ID string / Required propertyId | properties/111111111 |
Example Payload for Get Property
{
"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
Input | Notes |
---|---|
Connection connection / Required connection |
Example Payload for List Accounts
{
"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
Input | Notes | Example |
---|---|---|
Account ID string / Required accountId | accounts/000000000 | |
Connection connection / Required connection |
Example Payload for List Properties
{
"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
Input | Default | Notes | Example |
---|---|---|---|
Base URL string / Required baseUrl | |||
Connection connection / Required connection | |||
Data string data | The HTTP body payload to send to the URL. | {"exampleKey": "Example Data"} | |
Debug Request boolean debugRequest | false | Enabling this flag will log out the current request. | |
File Data string Key Value List fileData | File Data to be sent as a multipart form upload. | [{key: "example.txt", value: "My File Contents"}] | |
Form Data string Key Value List formData | The Form Data to be sent as a multipart form upload. | [{"key": "Example Key", "value": new Buffer("Hello World")}] | |
Header string Key Value List headers | A list of headers to send with the request. | User-Agent: curl/7.64.1 | |
Max Retry Count string maxRetries | 0 | The maximum number of retries to attempt. | |
Method string / Required method | The HTTP method to use. | ||
Query Parameter string Key Value List queryParams | 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 string / Required responseType | json | The type of data you expect in the response. You can request json, text, or binary data. | |
Retry On All Errors boolean retryAllErrors | false | If true, retries on all erroneous responses regardless of type. | |
Retry Delay (ms) string retryDelayMS | 0 | The delay in milliseconds between retries. | |
Timeout string timeout | The maximum time that a client will await a response to its request | 2000 | |
URL string / Required 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 boolean useExponentialBackoff | false | Specifies whether to use a pre-defined exponential backoff strategy for retries. |
Run Report
Run a customized report on your Google Analytics event data | key: runReport
Input | Default | Notes | Example |
---|---|---|---|
Connection connection / Required connection | |||
Property ID string / Required propertyId | properties/111111111 | ||
Request Body code / Required requestBody | See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport for details on what dimensions, metrics, etc., you can specify. |
Example Payload for Run Report
{
"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
Input | Notes | Example |
---|---|---|
API Secret password / Required apiSecret | The API secret for your Google Analytics G4. Generated in the Google Analytics UI | Str5ahciR5SJtWClz1mkRA |
App Instance ID string / Required appInstanceId | Your App's instance ID. | 12345678901234567890123456789012 |
Events To Send code / Required events | The events to send to Google Analytics | |
Firebase App ID string / Required firebaseAppId | The Firebase App ID, found in the Firebase console under Project Settings > General > Your Apps > App ID | 1:123456789012:web:1234567890123456789012 |
Example Payload for Send Measurement Protocol Events
{
"data": {
"message": "Event Sent Successfully"
}
}