- 8 Minutes to read
Google Analytics 4
- 8 Minutes to read
Google Analytics 4 (GA4) is a web analytics platform that provides businesses with advanced tracking and measurement capabilities, focusing on a user-centric data model that enables tracking of user interactions across multiple devices and platforms, allowing for a more comprehensive understanding of customer behavior and journey. GA4 also incorporates machine learning features to provide actionable insights and predictions for businesses to optimize their marketing strategies.
Refer to Google's official documentation to see all available endpoints from the GA4 API.
If you have multiple GA4 accounts and would like to extract the same data from all of them, it's possible through multi-account extraction (MAE). Contact our Solutions team to enable this feature.
If you want to use MAE, make sure your Include property ID option is turned on. to be able to identify which records belong to each account when doing your data analysis.
Authorize Connection to Google Analytics 4
To authorize this service, use OAuth 2.0 to share specific data with an application while keeping usernames, passwords, and other information private.
- On the Authorizers page, click on Authorize New Service and select your service.
- Follow the prompts to grant Dataddo the necessary permissions to access and retrieve your data.
- [Optional] Once your authorizer is created, click on it to change the label for easier identification.
Ensure that the account you're granting access to holds at least admin-level permissions.
For more information, see our article on authorizers.
How to Create a Google Analytics 4 Data Source
- On the Sources page, click on the Create Source button and select the connector from the list.
- From the drop-down menu, choose your account.Didn't find your account?
Click on Add new Account at the bottom of the drop-down and follow the on-screen prompts. You can also go to the Authorizers tab and click on Add New Service.
- Name your data source and select your metrics and attributes.
- [Optional] Configure your advanced settings (for more information please refer to the section on Advanced Settings). If you are unsure about how to proceed, we recommend skipping this step.
- Configure your snapshotting preferences. Choose your sync frequency or the exact synchronization time under Show advanced settings.DATADDO TIP
If you need to load historical data, please refer to the Data Backfilling article.
- Preview your data by clicking on the Test Data button in the top right corner. You can adjust the date range for a more specific time frame.
- Click on Save and congratulations, your new data source is ready!
Metrics and Dimensions Combinations
Not all GA4 metrics and dimensions combinations will work, even though they might be available to select. For available combinations, refer to the official GA4 website.
Rows Limit per Batch
The GA4 API allows the extraction of up to 10,000 rows at a time. In case you need need to extract more rows, load data in multiple batches using manual data load.
Historical Data Limitation
The GA4 API allows you to extract up to 1 year of historical data.
Fresh Data Unavailable
Google takes between 24 – 72 hours to process data which is why it’s possible to get data only from 3 days ago or older.
You can extract last 3 days of GA4 data but keep in mind that this data will most likely change.
Send fresh GA4 data to a
Fresh GA4 Data to a Data Warehouse
First, make sure that deduplication is possible in your case. Then set
- Snapshot keeping policy to replace
- Date range expression to 3d1 or 3d0 (to extract last 3 days worth of data every day)
- Write mode to upsert
- Click on your data source.
- In the Snapshotting tab, select Replace.
- In the Advanced tab, change the date range expression to 3d1 or 3d0.
- Save your configuration.
- When creating a data flow, select upsert (limited to 4 unique columns) as your write mode.
In case upsert is not possible (e.g. you need more than 4 unique columns), you can deduplicate in your own storage using the
Fresh GA4 Data to a Dashboarding App
Create two data sources, one for historical data, the second for fresh data.
[Data Source 1: Historical Data]
This data source will add data from 4 days ago to your table every day. Click on your data source and set the following:
- Snapshot keeping policy to append
- Date range expression (in the Advanced Settings tab) to 4d4 or older
[Data Source 2: Fresh Data]
This data source will be a running window of the last three days (it will always contain the last 3 days' fresh data without duplicates). Click on your data source and set the following:
As both of these sources have the same schema, they can be added into the same flow. For more information, see the article on data union.
Data Preview Unavailable
If there is no data preview after clicking on Test Data, there might be a problem with your source configuration. The most common causes are:
- Date range: Try a smaller date range. You can load the rest of your data afterward through our manual data load function.
- Insufficient permissions: Please make sure your authorized account has at least admin-level permissions.
- Invalid metrics, attributes, or breakdowns: You may not have any data for the selected metrics, attributes, or breakdowns.
- Incompatible combination of metrics, attributes, or breakdowns: The combination you have selected cannot be queried together. Please refer to the service's documentation to view a full list of metrics that can be included in the same source.
Duplicates may be the result of selecting too many dimensions during data source configuration. Choose fewer dimensions or make sure they are compatible.
Example: We want to get the total daily number of sessions.
|Date||Number of Sessions|
|Jan 1 2022||2|
|Total number of sessions: 2|
pagepath dimension (what pages are visited by every user) is added, we get the following numbers:
|Date||Number of Sessions||Page|
|Jan 1 2022||2||Page 1|
|Jan 1 2022||1||Page 2|
Total number of sessions: 3
The issue: One user visited both Page 1 and Page 2 during the same session. The same session appeared twice in combination with each page and resulted in a duplicate.
Missing Data Error
Missing data occurs when the total values was broken down into subcategories and the sum of the two subcategories differs. When working with your data, you need to keep this difference in mind.
When Google is unable to retrieve the subcategory information on all of its users, this value is left blank. These blank values are then disregarded instead of being put into their own category. This error happens most often with
Example: We want to find out how many men and how many women visited the website last week.
gender dimension is added, the table will look like this:
|Total Female Users||200|
|Total Male Users||200|
The issue: 100 from the total is missing as Google was not able to retrieve information on 100 users’ genders and the undetermined values were not put into a separate row.
No Data Error
If you have no data in your source, it may lead to a broken data source and issues with synchronization. Check the Allow Empty box in the source's settings, to send empty data to your destination.
Too Much Data Error
Please note that when you repeatedly attempt to extract unavailable GA4 data, you may encounter a
5xx error. After several tries, data extraction will be blocked for 16 hours. This error often shows up when there's a too much data in your GA4.
Failed to Save Extracted Data to Storage Error
When it GA4 hasn't received any information for a dimension, it will return (not set) as a value which is a
string. This may cause your data source to break if the expected data type is
- To fix this issue, change the data type of the field to
string. Click on the data source and navigate to the Schema tab.
- If your data source is connected to a data destination, don't forget to change the data type in the destination as well.
Now that you have successfully created a data source, see how you can connect your data to a dashboarding app or a data storage.