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", "destination_configuration": { "virtual_warehouse": "virtual_warehouse" }, "destination_schema_names": "SOURCE_NAMING", "config": { "sync_mode": "ALL_ACCOUNTS | SPECIFIC_ACCOUNTS", "reports": [ { "rollback_window": 15, "filter_value": "string", "filter_type": "EXCLUDE | INCLUDE", "prebuilt_report": "USER_ACQUISITION_FIRST_USER_MEDIUM_REPORT", "filter_field_name": "browser", "metrics": [ "string" ], "filters": [ { "filter_value": "string", "filter_type": "EXCLUDE | INCLUDE", "filter_values": [ "string" ], "filter_dimension": "string", "match_type": "EXACT | CONTAINS" } ], "config_type": "CUSTOM | PREBUILT", "time_aggregation_granularity": "YEARLY | WEEKLY | DAILY | MONTHLY", "table": "table_2", "dimensions": [ "string" ] } ], "timeframe_months": "TWENTY_FOUR | SIX | ALL_TIME | TWELVE | THREE", "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].filters | The list of filters to apply to the report data. |
reports[0].filters[0].filter_value | The filter value. |
reports[0].filters[0].filter_type | Filter type for reports request. Possible values are INCLUDE and EXCLUDE |
reports[0].filters[0].filter_values | The filter values for EXACT match type. |
reports[0].filters[0].filter_dimension | The dimension name to filter on. |
reports[0].filters[0].match_type | The filter match type. |
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 (required) | 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_accessandrefresh_tokenparameters in theauthsection.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_tokenThe long-lived Refresh tokenalong with theclient_idandclient_secretparameters carry the information necessary to get a new access token for API resources.client_accessclient_access.client_secretClient Secretof your Google Analytics client application.client_access.client_idClient IDof your Google Analytics client application. By using the Connect Card or the Fivetran dashboard.