Google Analytics 4 Setup Guide
Follow our setup guide to connect Google Analytics 4 to Fivetran.
Prerequisites
Depending on the authentication method you choose, you need one of the following:
- OAuth authentication method: A Google user account with permissions to access Google Analytics accounts with Google Analytics 4 properties you'd like to sync.
- Fivetran-managed service account authentication method: A Google user account with the Administrator role for the Google Analytics accounts or Google Analytics 4 properties you'd like to sync, so you can grant access to the Fivetran-managed service account.
Setup instructions
Begin Fivetran configuration
- In the connection setup form, enter your chosen Destination schema name.
(Hybrid Deployment only) If your destination is configured for Hybrid Deployment, the Hybrid Deployment Agent associated with your destination is pre-selected for the connection. To assign a different agent, click Replace agent, select the agent you want to use, and click Use Agent.
- Choose your Authentication method:
OAuth (recommended): Allows Fivetran to access your Google Analytics account using your Google user account.
- Click Authorize with Google and log in to your Google Analytics account.
- Click Continue and then Allow to enable Fivetran access to your Google account.
Fivetran-managed service account: Allows Fivetran to access your Google Analytics account using a service account managed by Fivetran. To authenticate with a Fivetran-managed service account:
You must have the Administrator role for the Google Analytics accounts or properties you want to sync.
- Click Copy next to the Service account email field to copy the service account email displayed in the Fivetran connection setup form.
- In a new browser tab, log in to Google Analytics.
- Click Admin in the bottom-left corner.
- Depending on the level at which you want to grant access, go to one of the following:
- To grant access to all properties in an account, go to Account settings > Account access management.
- To grant access to a single property, go to Property settings > Property access management.
- Click + and then select Add users.
- In the Email addresses field, enter the service account email you copied from the Fivetran connection setup form.
- Clear the Notify new users by email checkbox.
- Under Direct roles and data restrictions, select the Viewer role.
- Click Add.
- Repeat the steps above for every Google Analytics account or property you want to sync.
- Return to the Fivetran connection setup form and click Test Fivetran-managed service account access to verify that Fivetran can access your Google Analytics data. Once the test is successful, the remaining configuration fields appear.
For more information, see Google Analytics documentation.
- In the Historical Sync Time Frame drop-down menu, select how many months' worth of reporting data you'd like to include in your initial sync.
- Choose your Accounts sync mode:
- Select Sync All Accounts to automatically sync all accounts you have access to.
- Select Sync Specific Accounts to sync specific accounts only. Use the + Accounts link to add accounts and properties you'd like to sync.
(Optional) Add Custom report
- Click + Custom report.
- Enter a Report name. It must be unique within this connection and must comply with Fivetran's naming conventions. Give the table a name you will find easy to identify with the report in the future. When you want to enable or disable the sync for a particular report once it is set up, you will do so by selecting its table in the connection's Schema tab.
- Select the Report template name to automatically populate dimensions and metrics with pre-defined values.
- To customize the set of fields populated from the selected template, do either of the following:
- Start typing the dimension's or metric's name in the search field to find it by name, and select it by checking the box.
- Click a category name on the left side of the panel to view its corresponding dimensions and metrics on the right. Then, select the desired items by checking their boxes.
To learn about the specific dimensions and metrics that are supported, see the Google Analytics 4 API documentation.
- Click Next.
- (optional) Select a time aggregation for the report. Each aggregation option requires the corresponding date dimension to be selected in the report dimensions:
- date for Daily
- yearWeek or isoYearIsoWeek for Weekly
- yearMonth for Monthly
- year or isoYear for Yearly
- (Optional): In the Rollback window field, enter a number between 2 and 90 to specify the number of days available for rollback. The default is 30 days if no value is provided.
To learn more, read our Google Analytics 4 Rollback Sync documentation.
- To filter the Custom report by dimension, do the following:
- Click + Add filter.
- From the Filter type drop-down menu, choose whether to include records by selecting Include records where or exclude records by selecting Exclude records where.
- In the Dimension field, select the dimension to filter on.
- In the Operator field, choose the matching condition, Equals or Contains.
- In the Value field, enter the desired value for the dimension.
- If you selected Equals as a matching condition, you can specify multiple values by clicking + Add.
- (Optional) To add additional filters, repeat substeps 1 - 5 for each added filter.
Filtering is only enabled when all filter parameters are specified.
- Click Save. Repeat the steps above if you want to add another Custom report.
- (Optional) Once you have finished adding custom reports, click Validate custom reports. The test verifies the reports' settings.
Finish Fivetran configuration
Click Save & Test. Fivetran will take it from here and sync your data from your Google Analytics account.