Google Analytics 4 API Configuration
Request
POST https://api.fivetran.com/v1/connections
{
"group_id": "group_id",
"service": "google_analytics_4",
"trust_certificates": true,
"trust_fingerprints": true,
"run_setup_tests": true,
"paused": false,
"pause_after_trial": false,
"sync_frequency": 1440,
"data_delay_sensitivity": "NORMAL",
"data_delay_threshold": 0,
"daily_sync_time": "14:00",
"schedule_type": "auto",
"connect_card_config": {
"redirect_uri": "https://your.site/path",
"hide_setup_guide": true
},
"proxy_agent_id": "proxy_agent_id",
"private_link_id": "private_link_id",
"networking_method": "Directly",
"hybrid_deployment_agent_id": "hybrid_deployment_agent_id",
"config": {
"sync_mode": "ALL_ACCOUNTS | SPECIFIC_ACCOUNTS",
"reports": [
{
"rollback_window": 15,
"filter_value": "string",
"filter_type": "INCLUDE | EXCLUDE",
"prebuilt_report": "USER_ACQUISITION_FIRST_USER_MEDIUM_REPORT | USER_ACQUISITION_FIRST_USER_SOURCE_REPORT | USER_ACQUISITION_FIRST_USER_SOURCE_MEDIUM_REPORT | USER_ACQUISITION_FIRST_USER_SOURCE_PLATFORM_REPORT | USER_ACQUISITION_FIRST_USER_CAMPAIGN_REPORT | USER_ACQUISITION_FIRST_USER_GOOGLE_ADS_NETWORK_TYPE_REPORT | USER_ACQUISITION_FIRST_USER_GOOGLE_ADS_AD_GROUP_NAME_REPORT | TRAFFIC_ACQUISITION_SESSION_SOURCE_MEDIUM_REPORT | TRAFFIC_ACQUISITION_SESSION_MEDIUM_REPORT | TRAFFIC_ACQUISITION_SESSION_SOURCE_REPORT | TRAFFIC_ACQUISITION_SESSION_CAMPAIGN_REPORT | TRAFFIC_ACQUISITION_SESSION_DEFAULT_CHANNEL_GROUPING_REPORT | TRAFFIC_ACQUISITION_SESSION_SOURCE_PLATFORM_REPORT | EVENTS_REPORT | CONVERSIONS_REPORT | PAGES_TITLE_AND_SCREEN_CLASS_REPORT | PAGES_PATH_REPORT | PAGES_TITLE_AND_SCREEN_NAME_REPORT | CONTENT_GROUP_REPORT | ECOMMERCE_PURCHASES_ITEM_NAME_REPORT | ECOMMERCE_PURCHASES_ITEM_ID_REPORT | ECOMMERCE_PURCHASES_ITEM_CATEGORY_REPORT_COMBINED | ECOMMERCE_PURCHASES_ITEM_CATEGORY_REPORT | ECOMMERCE_PURCHASES_ITEM_CATEGORY_2_REPORT | ECOMMERCE_PURCHASES_ITEM_CATEGORY_3_REPORT | ECOMMERCE_PURCHASES_ITEM_CATEGORY_4_REPORT | ECOMMERCE_PURCHASES_ITEM_CATEGORY_5_REPORT | ECOMMERCE_PURCHASES_ITEM_BRAND_REPORT | PUBLISHER_ADS_AD_UNIT_REPORT | PUBLISHER_ADS_PAGE_PATH_REPORT | PUBLISHER_ADS_AD_FORMAT_REPORT | PUBLISHER_ADS_AD_SOURCE_REPORT | DEMOGRAPHIC_COUNTRY_REPORT | DEMOGRAPHIC_REGION_REPORT | DEMOGRAPHIC_CITY_REPORT | DEMOGRAPHIC_LANGUAGE_REPORT | DEMOGRAPHIC_AGE_REPORT | DEMOGRAPHIC_GENDER_REPORT | DEMOGRAPHIC_INTERESTS_REPORT | TECH_BROWSER_REPORT | TECH_DEVICE_CATEGORY_REPORT | TECH_DEVICE_MODEL_REPORT | TECH_SCREEN_RESOLUTION_REPORT | TECH_APP_VERSION_REPORT | TECH_PLATFORM_REPORT | TECH_OS_VERSION_REPORT | TECH_PLATFORM_DEVICE_CATEGORY_REPORT | TECH_OPERATING_SYSTEM_REPORT | TECH_OS_WITH_VERSION_REPORT | AUDIENCES_REPORT",
"filter_field_name": "browser",
"metrics": [
"string"
],
"config_type": "PREBUILT | CUSTOM",
"time_aggregation_granularity": "DAILY | WEEKLY | MONTHLY | YEARLY",
"table": "table_2",
"dimensions": [
"string"
]
}
],
"timeframe_months": "THREE | SIX | TWELVE | TWENTY_FOUR | ALL_TIME",
"accounts": [
"string"
],
"properties": [
"string"
],
"schema": "schema_name"
},
"auth": {
"refresh_token": "my_refresh_token",
"client_access": {
"client_secret": "my_client_secret",
"client_id": "my_client_id"
}
}
}
Config parameters
Name | Description |
---|---|
sync_mode | Whether to sync all accounts or specific accounts. |
reports | The list of reports. Each report corresponds to a table within the schema to which connector will sync the data. |
reports[0].rollback_window | The custom window size for rollback syncs. |
reports[0].filter_value | |
reports[0].filter_type | Filter type for reports request. Possible values are INCLUDE and EXCLUDE |
reports[0].prebuilt_report | The name of the Prebuilt Report from which the connector will sync the data. |
reports[0].filter_field_name | The dimension name to filter on. |
reports[0].metrics | The report metrics to include into a sync. |
reports[0].config_type | Whether to use the Prebuilt Reports or Custom Reports. |
reports[0].time_aggregation_granularity | The report data aggregation time granularity. |
reports[0].table | The table name within the schema to which connector will sync the data of the specific report. |
reports[0].dimensions | The report dimensions to include into a sync. |
timeframe_months | The number of months' worth of reporting data you'd like to include in your initial sync. A change of this value will trigger a re-sync for enabled reports during the next connector sync. The default value: TWELVE . |
accounts | The list of specific Account IDs to sync. Must be populated if sync_mode is set to SPECIFIC_ACCOUNTS . |
properties | The array of strings in the properties/{id} format where id is a Google Analytics 4 property identifier. Must be populated if sync_mode is set to SPECIFIC_ACCOUNTS . |
schema | Destination schema name. Schema name is permanent and cannot be changed after connection creation |
Authorization
There are two ways to authorize this connector type:
By specifying the values for the
client_access
andrefresh_token
parameters in theauth
section.POST https://api.fivetran.com/v1/connections
{ "service": "google_analytics_4", "group_id": "group_id", "auth": { "client_access": { "client_secret": "my_client_secret", "client_id": "my_client_id" }, "refresh_token": "my_refresh_token" } }
Auth Parameters
Name Description refresh_token
The long-lived Refresh token
along with theclient_id
andclient_secret
parameters carry the information necessary to get a new access token for API resources.client_access
client_access.client_secret
Client Secret
of your Google Analytics client application.client_access.client_id
Client ID
of your Google Analytics client application.By using the Connect Card or the Fivetran dashboard.