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.

Google Analytics - GA4 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
InputDefaultNotes
Input
Authorize URL
string
/ Required
Hidden Field
Default
https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&prompt=consent
Notes
The OAuth 2.0 Authorization URL for Google Calendar
Input
Client ID
string
/ Required
Default
Notes
Provide a string value for the client Id of your OAuth 2.0 application.
Input
Client Secret
password
/ Required
Default
Notes
Provide a string value for the client secret of your OAuth 2.0 application.
Input
Scopes
string
/ Required
Default
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
Notes
A space-delimited set of one or more scopes to get the user's permission to access.
Input
Token URL
string
/ Required
Hidden Field
Default
https://oauth2.googleapis.com/token
Notes
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

InputNotes
Input
Connection
connection
/ Required
Notes
 

Data Source Payload#

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

InputNotesExample
Input
Account ID
string
/ Required
Notes
 
Example
accounts/000000000
Input
Connection
connection
/ Required
Notes
 
Example
 

Actions#

Get Property#

Get property by ID | key: getProperty

InputNotesExample
Input
Connection
connection
/ Required
Notes
 
Example
 
Input
Property ID
string
/ Required
Notes
 
Example
properties/111111111

Output Example Payload#

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

InputNotes
Input
Connection
connection
/ Required
Notes
 

Output Example Payload#

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

InputNotesExample
Input
Account ID
string
/ Required
Notes
 
Example
accounts/000000000
Input
Connection
connection
/ Required
Notes
 
Example
 

Output Example Payload#

{  "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 Request to Google Analytics GA4 | key: rawRequest

InputDefaultNotesExample
Input
Base URL
string
/ Required
Default
Notes
 
Example
 
Input
Connection
connection
/ Required
Default
 
Notes
 
Example
 
Input
Data
string
Default
Notes
The HTTP body payload to send to the URL.
Example
{"exampleKey": "Example Data"}
Input
Debug Request
boolean
Default
false
Notes
Enabling this flag will log out the current request.
Example
 
Input
File Data
string
Key Value List
Default
Notes
File Data to be sent as a multipart form upload.
Example
[{key: "example.txt", value: "My File Contents"}]
Input
Form Data
string
Key Value List
Default
Notes
The Form Data to be sent as a multipart form upload.
Example
[{"key": "Example Key", "value": new Buffer("Hello World")}]
Input
Header
string
Key Value List
Default
Notes
A list of headers to send with the request.
Example
User-Agent: curl/7.64.1
Input
Max Retry Count
string
Default
0
Notes
The maximum number of retries to attempt.
Example
 
Input
Method
string
/ Required
Default
Notes
The HTTP method to use.
Example
 
Input
Query Parameter
string
Key Value List
Default
Notes
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.
Example
 
Input
Response Type
string
/ Required
Default
json
Notes
The type of data you expect in the response. You can request json, text, or binary data.
Example
 
Input
Retry On All Errors
boolean
Default
false
Notes
If true, retries on all erroneous responses regardless of type.
Example
 
Input
Retry Delay (ms)
string
Default
0
Notes
The delay in milliseconds between retries.
Example
 
Input
Timeout
string
Default
Notes
The maximum time that a client will await a response to its request
Example
2000
Input
URL
string
/ Required
Default
Notes
This is the URL to call.
Example
/accounts
Input
Use Exponential Backoff
boolean
Default
false
Notes
Specifies whether to use a pre-defined exponential backoff strategy for retries.
Example
 

Run Report#

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

InputDefaultNotesExample
Input
Connection
connection
/ Required
Default
 
Notes
 
Example
 
Input
Property ID
string
/ Required
Default
Notes
 
Example
properties/111111111
Input
Request Body
code
/ Required
Default
{  "dimensions": [    {      "name": "pageTitle"    }  ],  "metrics": [    {      "name": "sessions"    }  ],  "dateRanges": [    {      "startDate": "7daysAgo",      "endDate": "yesterday"    }  ],  "dimensionFilter": {    "notExpression": {      "filter": {        "fieldName": "pageTitle",        "stringFilter": {          "value": "My Homepage"        }      }    }  }}
Notes
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
 

Output Example Payload#

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