Google Analytics 4 (GA4)
Connectors · Updated May 22, 2025
This page provides a setup guide and reference information for the Google Analytics 4 (GA4) source connector in Reactor.
Google Analytics 4 (GA4) is the latest iteration of Google Analytics, launched in 2020. It features an updated data model focused on events and user properties, shifting away from traditional pageviews and sessions. This model offers greater flexibility and customization for reporting, enabling more precise measurement of user behavior across various devices and platforms.
Overview
The Reactor Google Analytics 4 (GA4) connector allows you to extract your GA4 data, including preconfigured and custom reports, for analysis and integration with your data warehouse.
Prerequisites
To set up the GA4 connector, you need:
- A Google Analytics account with access to the GA4 Property (Property IDs) you intend to sync.
Setup Guide
Step 1: Set up Google Analytics 4 (GA4) API
Create a Service Account for Authentication
- Sign in to the Google Account associated with your Google Analytics as an admin.
- Navigate to the Service Accounts page in the Google Developers console.
- Select your desired project or create a new one, then click Continue.
- Click + Create Service Account at the top of the page.
- Provide a name for the service account and an optional description. Click Create and Continue.
- Choose the role for the service account. The Viewer role (Read & Analyze permissions) is recommended. Click Continue.
- Select your newly created service account from the list, open the Keys tab, and click Add Key > Create New Key.
- Choose JSON as the Key type. This action will generate and download the JSON key file required for authentication. Click Continue.
Enable the Google Analytics APIs
Before using the service account to access Google Analytics data, you must enable the necessary APIs:
- Go to the Google Analytics Reporting API dashboard. Ensure the associated project for your service account is selected and enable the API.
- Go to the Google Analytics API dashboard. Ensure the associated project for your service account is selected and enable the API.
- Go to the Google Analytics Data API dashboard. Ensure the associated project for your service account is selected and enable the API.
Step 2: Configure the GA4 Connector in Reactor
Reactor supports two authentication methods for GA4: OAuth and Service Account Key.
For Reactor Cloud (OAuth Authentication)
-
Log into your Reactor Cloud account.
-
Navigate to Sources and click + New Source.
-
Select Google Analytics 4 (GA4) from the Source type dropdown.
-
Enter a descriptive name for your Google Analytics 4 (GA4) connector.
-
Choose Authenticate via Google (OAuth) from the dropdown menu and click Authenticate your Google Analytics 4 (GA4) account. A pop-up window will appear, prompting you to log in to your Google account and grant Reactor access.
-
Enter the Property ID for the GA4 property you want to track. This is a numeric value (e.g.,
123456789). Refer to Google's documentation if you need help finding it.- Note: If your Property Settings display a "Tracking Id" like "UA-123...-1", it indicates a Universal Analytics property, which cannot be reported on using this connector. You'll need to create a new Google Analytics 4 property if this is the case.
-
(Optional) In the Start Date field, use the date picker or enter a date in
YYYY-MM-DDformat. Data from this date onward will be replicated. This setting does not apply to custom Cohort reports. -
(Optional) In the Custom Reports field, you can define any custom reports you wish to sync from Google Analytics. See the "Custom Reports" section below for details on how to formulate these reports.
-
(Optional) In the Data Request Interval (Days) field, specify the interval in days (from 1 to 364) for data requests to the Google Analytics API. A larger interval speeds up the sync but increases the likelihood of data sampling, potentially leading to inaccuracies. A value of 1 is recommended unless faster syncs are prioritized over accuracy. This field does not apply to custom Cohort reports.
-
Caution: Be mindful of how dimensions like
monthoryearMonthare specified, as they influence data organization. A very specific date range (e.g., a single day with Data Request Interval (Days) set to one) can lead to duplicated entries. To mitigate this, consider adjusting the Data Request Interval (Days) to 364 for more precise results and to avoid duplication.
-
Caution: Be mindful of how dimensions like
-
Click Set up source and wait for the connection tests to complete.
For Reactor Self-Managed (Service Account Key Authentication)
-
Navigate to your Reactor Self-Managed dashboard.
-
In the left navigation bar, click Sources. In the top-right corner, click + New source.
-
Find and select Google Analytics 4 (GA4) from the list of available sources.
-
Select Service Account Key Authentication from the dropdown list and paste the Service Account JSON Key obtained in Step 1.
-
Enter the Property ID whose events are tracked. This ID should be a numeric value, such as
123456789. If you are unsure where to find this value, refer to Google's documentation.- Note: If the Property Settings shows a "Tracking Id" such as "UA-123...-1", this denotes that the property is a Universal Analytics property, and the Analytics data for that property cannot be reported on in the Data API. You can create a new Google Analytics 4 property by following these instructions.
-
(Optional) In the Start Date field, use the provided datepicker or enter a date programmatically in the format
YYYY-MM-DD. All data added from this date onward will be replicated. Note that this setting is not applied to custom Cohort reports.- Note: If no start date is provided, the default value will be two years from the initial sync.
- Caution: Many analyses require 24-48 hours for data processing. To ensure accuracy, Reactor subtracts two days from the starting date for data fetching. For more details, refer to Google's documentation.
-
(Optional) Toggle the switch Keep Empty Rows if you want each row with all metrics equal to 0 to be returned.
-
(Optional) In the Custom Reports field, you may optionally describe any custom reports you want to sync from Google Analytics. See the Custom Reports section below for more information on formulating these reports.
-
(Optional) In the Data Request Interval (Days) field, you can specify the interval in days (ranging from 1 to 364) used when requesting data from the Google Analytics API. The bigger this value is, the faster the sync will be, but the more likely that sampling will be applied to your data, potentially causing inaccuracies in the returned results. We recommend setting this to 1 unless you have a hard requirement to make the sync faster at the expense of accuracy. This field does not apply to custom Cohort reports. See the Data Sampling section below for more context on this field.
-
(Optional) In the Lookback window (Days) field, you can specify how many days in the past we should refresh the data in every run. Since attribution changes after the event date, and Google Analytics has a data processing latency this is key to keep up with consistent information. If you set it at 5 days, in every sync it will fetch the last bookmark date minus 5 days.
-
Caution: It's important to consider how dimensions like
monthoryearMonthare specified. These dimensions organize the data according to your preferences. However, keep in mind that the data presentation is also influenced by the chosen date range for the report. In cases where a very specific date range is selected, such as a single day (Data Request Interval (Days) set to one day), duplicated data entries for each day might appear. To mitigate this, we recommend adjusting the Data Request Interval (Days) value to 364. By doing so, you can obtain more precise results and prevent the occurrence of duplicated data.
-
Caution: It's important to consider how dimensions like
-
Click Set up source and wait for the tests to complete.
Supported Endpoints
This connector outputs the following incremental streams:
We could add in the fields for each of these based on the spreadsheet I created
-
Preconfigured Endpoints based on Google Analytics Reports:
daily_active_usersdevicesfour_weekly_active_userslocationspagestraffic_sourceswebsite_overviewweekly_active_usersuser_acquisition_first_user_medium_reportuser_acquisition_first_user_source_reportuser_acquisition_first_user_source_medium_reportuser_acquisition_first_user_source_platform_reportuser_acquisition_first_user_campaign_reportuser_acquisition_first_user_google_ads_ad_network_type_reportuser_acquisition_first_user_google_ads_ad_group_name_reporttraffic_acquisition_session_source_medium_reporttraffic_acquisition_session_medium_reporttraffic_acquisition_session_source_reporttraffic_acquisition_session_campaign_reporttraffic_acquisition_session_default_channel_grouping_reporttraffic_acquisition_session_source_platform_reportevents_reportweekly_events_reportconversions_reportpages_title_and_screen_class_reportpages_path_reportpages_title_and_screen_name_reportcontent_group_reportecommerce_purchases_item_name_reportecommerce_purchases_item_id_reportecommerce_purchases_item_category_report_combinedecommerce_purchases_item_category_reportecommerce_purchases_item_category_2_reportecommerce_purchases_item_category_3_reportecommerce_purchases_item_category_4_reportecommerce_purchases_item_category_5_reportecommerce_purchases_item_brand_reportpublisher_ads_ad_unit_reportpublisher_ads_page_path_reportpublisher_ads_ad_format_reportpublisher_ads_ad_source_reportdemographic_country_reportdemographic_region_reportdemographic_city_reportdemographic_language_reportdemographic_age_reportdemographic_gender_reportdemographic_interest_reporttech_browser_reporttech_device_category_reporttech_device_model_reporttech_screen_resolution_reporttech_app_version_reporttech_platform_reporttech_platform_device_category_reporttech_operating_system_reporttech_os_with_version_report
- Custom stream(s)
Connector-Specific Features
Custom Reports - do we want to support this?
Custom reports in Google Analytics provide flexibility for querying specific data tailored to your requirements. You can define the following components:
- Name: The name of the custom report.
- Dimensions: An array of data categories, such as city or user type.
- Metrics: An array of quantitative measurements, such as active users or page views.
- CohortSpec: (Optional) An object containing specific cohort analysis settings, including cohort size and date range. More information is available in the GA4 documentation on CohortSpec.
- Pivots: (Optional) An array of pivot tables for data, such as page views by city. Additional information on pivots can be found in the GA4 documentation on Pivots.
A comprehensive list of supported dimensions and metrics can be found in the GA4 Data API Schema. To verify compatibility for your GA4 property, use the GA4 Dimensions & Metrics Explorer.
Here is an example of a basic User Engagement report to track sessions and bounce rate, segmented by city:
[
{
"name": "User Engagement Report",
"dimensions": ["city"],
"metrics": ["sessions", "bounceRate"]
}
]
You can further tailor the report by specifying a cohort with a 7-day range and pivoting on the city dimension, providing a detailed view of engagement trends within the top 50 cities for the specified date range:
[
{
"name": "User Engagement Report",
"dimensions": ["city"],
"metrics": ["sessions", "bounceRate"],
"cohortSpec": {
"cohorts": [
{
"name": "Last 7 Days",
"dateRange": {
"startDate": "2023-07-27",
"endDate": "2023-08-03"
}
}
],
"cohortReportSettings": {
"accumulate": true
}
},
"pivots": [
{
"fieldNames": ["city"],
"limit": 50,
"metricAggregations": ["TOTAL"]
}
]
}
]
Data Sampling and Data Request Intervals
Data sampling in Google Analytics 4 occurs when the volume of data in an account surpasses Google's predefined processing thresholds. To reduce the likelihood of data sampling, the Data Request Interval field allows you to specify the interval used when requesting data from the Google Analytics API.
Setting the interval to 1 day minimizes the data processed per request, thereby reducing the chance of sampling and improving data accuracy. While larger intervals (up to 364 days) can expedite the sync, it's generally recommended to choose a smaller value to prioritize data accuracy, unless a faster synchronization is a critical requirement, even at the expense of potential inaccuracies. This field does not apply to custom Cohort reports.
For more information on data sampling, refer to the Google Analytics documentation.
Performance Considerations
The Google Analytics connector operates within the constraints of Google Analytics Data API quotas. For a detailed breakdown of these quotas, please consult Google's documentation.
Data Type Map
| Integration Type | Reactor Type |
string |
string |
number |
number |
array |
array |
object |
object |
Reference
Config Fields Reference
| Field | Type | Property Name |
| Property IDs | array<string> |
property_ids |
| Credentials | object |
credentials |
| Start Date | string |
date_ranges_start_date |
| End Date | string |
date_ranges_end_date |
| Custom Reports | array<object> |
custom_reports_array |
| Data Request Interval (Days) | integer |
window_in_days |
| Lookback window (Days) | integer |
lookback_window |
| Keep Empty Rows | boolean |
keep_empty_rows |
Convert conversions:* Metrics to Float |
boolean |
convert_conversions_event |