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:
- See all available endpoints from the GA4 API.
- Use the interactive GA4 Dimensions and Metrics Explorer to check metrics and dimensions compatibility.
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, so you can identify which records belong to each account in your analysis.
Authentication Methods
Google Analytics 4 supports more than one way to connect. Pick one when you create the authorizer in Dataddo:
- Google account - sign in with Google and approve access (recommended).
- Google service account - connect with a Google service account key, without interactive sign-in.
- Your own Google app - use your own Google OAuth app credentials (for advanced setups).
Authorize Connection to Google Analytics 4
To authorize this service, use OAuth 2.0 to share specific data with Dataddo while keeping usernames, passwords, and other information private.
- On the Authorizers page, click on Authorize New Service and select your service.
- Follow the on-screen 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. If necessary, assign a team member with the required permissions with the authorizer role to authenticate the service for you.
For more information, see our article on authorizers.
Data Coverage
Google Analytics 4 uses a single flexible dataset. You choose the metrics and dimensions when you create the source; Google Analytics 4 also pulls custom metrics and dimensions defined in your property at runtime.
Example dimensions: Achievement ID, Ad Format, Ad Source Name, Ad Unit Name, App Version, Audience Id, Audience Name, Audience resource name (374 standard available).
Example metrics: Active 1 Day Users, Active 28 Day Users, Active 7 Day Users, Active Users, Ad Unit Exposure, Add To Carts, Ads clicks, Ads cost (184 standard available).
How Data Extraction Works
Every dataset for this connector uses a relative date range: the source reads a relative window (for example "last 7 days"), and that window slides forward with the current date. Every run re-reads the window, so a range of "1 day ago" always pulls the previous day (D-1). Each run replaces the window's data rather than adding older history. To load records from before the window, run a full data re-sync with a wider range. See Data Backfilling.
Set the relative date range when you create the source.
Metadata Columns
When you create a source, you can add these Dataddo metadata columns to the extracted data:
- dataddo_hash - a fingerprint built from each record's key fields. It works as a natural key, so it is ideal for upserts (updating existing rows in your destination instead of creating duplicates).
- dataddo_extraction_timestamp - the date and time the row was extracted. Use it to track how records change over time, for example to build slowly changing dimensions.
How to Create a Google Analytics 4 Data Source
Creating a data source takes you through five steps, shown in the progress bar at the top of the wizard. Each step is explained below.
1. Pick the connector
On the Sources page, click Create Source, then select the connector from the catalog. Use the search bar or the category tabs if you do not see it right away. You can rename the source at any time using the pencil icon next to its name.
2. Choose the account
This step selects what Dataddo reads from.
- Authorizer: Select an account you have already authorized from the drop-down. If you have none yet, choose Add new account and follow the prompts. If no authorizer is selected, Dataddo asks you to authorize before you continue.
- What to extract from: Select the exact entity you want to pull data from. Depending on the service this may be labelled an account, property, profile, workspace, or similar, sometimes with a sub-level to choose as well.
- Multiple accounts: To pull the same data from every entity you can access, turn on Automatically collect data from all .... This is multi-account extraction. Leave it off to choose them by hand.
3. Build the data model
Choose exactly what to extract. What you can pick depends on the connector, and the wizard may group the fields differently for each one.
- Values: the measures you want, often called metrics, such as sessions, clicks, or revenue.
- Breakdowns: the fields you group or split those values by, often called dimensions or attributes, such as date, country, or campaign.
- Context metadata (when available): identifier fields that Dataddo derives from your selection, such as the account or property ID. They let you tell rows apart when you combine several sources.
Some connectors limit which fields can be queried together; the wizard flags this where it applies. Click Test on Sample Data at any point to preview the result before you continue.
4. Add metadata columns (optional)
Two optional columns help your destination handle the data.
- Dataddo Hash (Include Row Hash): a fingerprint built from the columns you pick. It works as a natural key, so your destination can deduplicate rows and run upserts instead of creating duplicates. Turn it on, then select the columns that uniquely identify a row.
- Dataddo Extraction Timestamp: the time each row was extracted. Use it to watermark the data, for example to build slowly changing dimensions or to track when a value last changed.
5. Set the schedule
Decide how often Dataddo runs the extraction.
- Frequency: how often the pipeline runs, for example daily. Click Show advanced settings to also set the exact hour and minute (UTC).
- Date range: the relative window each run extracts, for example "Yesterday". The window moves forward on every run.
- Historical data: a new source starts from the current window. To load older data, run a full data re-sync after the source is created.
- Allow Empty Data Extractions: when on, a run that returns no data records zero rows instead of failing. Turn it on if the source can legitimately have periods with no data.
Click Save. Your data source is ready.
Limitations
Metrics and Dimensions Combinations
Not all GA4 metrics and dimensions combinations will work, even though they might be available to select. For available combinations, use the GA4 Dimensions and Metrics Explorer.
Historical Data Limitation
The GA4 API allows you to extract up to 1 year of historical data.
Fresh Data Unavailable
Google takes between 24 and 72 hours to process data, which is why you can only get data 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.
There are two recommended patterns for handling fresh GA4 data, depending on your destination. Both are described below:
- Fresh GA4 Data to a Data Warehouse
- Fresh GA4 Data to a Dashboarding App
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 thedataddo_extraction_timestamp field.
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:
- Snapshot keeping policy to replace
- Date range expression (in the Advanced Settings tab): 3d1 or 3d0
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.
Troubleshooting
Data Preview Unavailable
No data preview when you click on Test Data might be caused by an issue 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 using manual data load.
- 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: Your selected combination 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 data source.
Duplicates
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.
Original table
| Date | Number of Sessions |
|---|---|
| Jan 1 2022 | 2 |
Total number of sessions: 2
When the 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 gender or country dimensions.
Example: We want to find out how many men and how many women visited the website last week.
Original table
| Total | Number |
|---|---|
| Total Users | 500 |
When the gender dimension is added, the table will look like this:
| Total | Number |
|---|---|
| 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 integer.
- 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.
Related Articles
Now that you have successfully created a data source, see how you can connect your data to a dashboarding app or a data storage.
Sending Data to Dashboarding Apps
Sending Data to Data Storages
Other Resources