10 MINUTE READ | January 30, 2023
How to Import Data Into Google Analytics 4
Neil Barnes has written this article. More details coming soon.
Google Analytics 4 offers data import functionality, allowing you flexibility to upload additional data attributes into Google Analytics 4 from external sources.
Data import allows you to join external data, with the data you collect in Google Analytics 4, to enrich your data and identify new and valuable insights to feed into your marketing and audience optimisation.
Examples of external data you can import into Google Analytics 4 are:
Cost data from non-Google marketing platforms
Item data, to enrich your eCommerce dataset with additional item attributes
User data, for example importing user data that is stored within a CRM
Event data, for example where data cannot be imported or supported by other methods (e.g. measurement protocol).
You can find data import within the admin menu of Google Analytics 4 and under the property subsection as below.
From here, you can create data sources to import data into your Google Analytics 4 configuration.
By clicking the data import option within the admin area of Google Analytics 4, it will bring up the list of data sources that you currently have configured for data import.
If you have not created a data source before, this table will be blank.
Click the create data source button to create a new data source for your import, and reach the screen below.
Enter a name for your data source in the ‘Data source name’ text box.
You are presented with five different data type templates for importing data into Google Analytics 4.
If you are unsure which option is most relevant for your use case, more information about each data type can be found below.
Use the cost data import for cost, clicks and impressions data from non Google platforms into Google Analytics 4.
For example you may wish to import cost data into Google Analytics 4, for marketing activity you are running through the Meta platform.
Google Analytics 4 will join your cost data with revenue and conversion data to understand ROI at a source, medium and campaign level for non Google marketing platforms.
Because cost data continually changes as campaigns run, you can use data import to upload data periodically to refresh your cost data with most recent values.
The schema keys for cost data import (i.e. the dimensions that are used to join your imported data to Google Analytics 4 data) are:
Campaign id (utm_id)
Campaign source (utm_source)
Campaign medium (utm_medium)
Campaign name (utm_campaign)
Date
These data points must be included within your imported data set to enable the data join. It is critical that the source, medium, campaign and campaign id data matches what you used in utm parameters in your destination URL to increase match rates.
The metrics that you can include in your cost data import are listed below:
Cost
Clicks
Impressions
We recommend including all three metrics to fully utilise the capabilities of cost data import, and to maximise your data enrichment opportunities.
An example cost import dataset can be found below:
Important note: You can only have one data source when you import cost data. Therefore you need to ensure that cost data for all marketing platforms is contained within a single import file, similar to the example above.
Use the item data import to import item dimension attributes into Google Analytics 4.
This can be a useful solution if you are sending limited item data with your eCommerce events. For example, you may only be sending an item ID when collecting eCommerce events such as add_to_cart or purchase, and you want to enrich this data with item attributes such as colour or size.
Important note: Item data import is designed to import item dimension data only. You cannot import item metrics (e.g. quantity) using this method.
You must be collecting recommended events for online sales to be eligible to use the item data import.
The schema key for item data import (i.e. the dimension used to join your imported data to Google Analytics 4 data) is item ID.
The item dimensions you can import into Google Analytics 4 are listed below:
Item Name
Item Category 1
Item Category 2
Item Category 3
Item Category 4
Item Category 5
Item Brand
Item Variant
An example item import dataset can be found below:
Use the user data import to import user metadata that may sit outside of Google Analytics 4. For example, you may wish to import user information from your CRM system such as lifetime value.
Where a user metric or dimension you are importing is not available in the Google Analytics 4 schema, you will need to create a custom dimension or metric to store your imported data.
Important note: It is strictly forbidden to upload personally identifiable information (PII) into Google Analytics 4.
You have two templates available in Google Analytics 4, a user import by user id and a user import by client id.
If you have user id configured in your Google Analytics 4 configuration, then you can use the user id as your schema key (i.e. user id is the dimension used to join your imported data to Google Analytics 4) and utilise the user import by user id template.
An example user data by user id dataset can be found below.
If you do not have user id configured you should only use the user data by client id import template. In the absence of a user id, the schema keys used to join your imported data to Google Analytics 4 data will be the client id and stream id.
Important note: Ensure that your client id is stored as a string and not a number. If stored as a number, the client id could end up being truncated which will then result in a low match rate when your imported data is joined with Google Analytics 4.
An example user data by client id dataset can be found below.
Use the offline event data import to import data from data sources that do not have an internet connection or cannot be supported by other methods in Google Analytics 4 such as SDKs or measurement protocol.
This data import type is flexible, as it supports import on:
Events that are collected automatically by Google Analytics 4
Recommended events that you have configured for your set-up
User properties
Important note: Where a user metric or dimension you are importing is not available in the Google Analytics 4 schema, you will need to create a custom dimension or metric to store your imported data.
The schema keys differ depending on whether you are importing web or app based data.
For web based data, the schema keys will be the measurement id and client id.
For app based data, the schema keys will be app instance id and firebase app id.
An example offline data import dataset can be found below:
Once you have selected the data import type, you next need to decide on the data import source. Here, you have two import source options available
CSV. The most common method is to import your data into Google Analytics 4 is via a csv file. This is a manual upload and cannot be scheduled.
SFTP (Secure File Transfer Protocol). SFTP import is more complex to set-up, but provides more options around automating the data import process. Input the server name and url and define your upload frequency and time. A public key will be generated for you to authorise on your SFTP server.
Once you have selected your data import method, and uploaded your data import file either via CSV or SFTP, you will need to map the fields in your data import to dimensions and metrics in the Google Analytics 4 dataset.
You will see three columns in the data source mapping window:
The analytics field is the Google Analytics field your data will be imported into. Use the tick box to select and deselect based on your import scenario. Note you will not be able to deselect fields that are needed for joining purposes.
The import field allows you to select the field in your imported dataset that corresponds to the analytics field you are importing into.
The import data samples will show you example output based on your dataset and the mapping you have defined. This is extremely useful to validate that you have mapped the data correctly.
Important note: Mappings cannot be edited once the data source has been created. Please ensure you take time, care and attention at this stage of the import set-up to ensure your mappings are correct.
Once you are happy with your import mappings, click on import to complete the data import process.
Repeat the process for the different data sources you need to configure.
Need more information on data import in Google Analytics 4? Commonly asked questions about the Google Analytics 4 data import are shown below.
The data from your data import is joined to the Google Analytics 4 dataset in two different ways.
reporting/query time. Your imported data is joined when you open a report and Google Analytics 4 issues a query for the report data. This type of join is temporary.
Important note: data joined using reporting/query time is not available when creating audiences in Google Analytics 4, or creating segments within Google Analytics 4 explorations.
Cost and item data imports use the reporting/query time join method.
collection/processing time. Your imported data is joined as data is collected and processed, mirroring how it would have been collected if the data were associated with an event. The joined data is written to aggregate tables in Google Analytics 4.
Important note: historical data cannot be joined using collection/processing time, as the data has already been processed.
User and event data imports use the collection/processing time join method.
Data import in Google Analytics 4 does have some limits to be aware of.
Total storage for data import is 10GB. In other words, you can upload up to 10GB of data using data import.
Each individual data source is limited to a maximum of 1GB of data storage.
You can import data a maximum of 24 times in a day.
Personally identifiable data (PII) is strictly forbidden, and you must not import any data into Google Analytics 4 that could uniquely identify an individual.
Google Analytics 4 takes 24 hours to process your data import. Please check back in Google Analytics 4 24 hours after import configuration to view your imported data in Google Analytics 4 reports.
Yes, you can delete data imports that have been configured. How the deletion is handled depends on the import and join type.
For cost and item data imports, which use the reporting/query time join method, when you delete a data import the joined data is no longer available in Google Analytics 4. This is because the join is temporary and not written to aggregate tables in Google Analytics 4.
For user and event data imports, which use the collection/processing time join method, when you delete a data import no further future joins take place. Joins made on existing/historical data will remain as the joined data has been written to aggregate tables in Google Analytics 4.
For user and event data imports, which use the collection/processing time join method, deleting the data import will not delete data that has already been joined, as that information has already been written to aggregate tables in Google Analytics 4.
To delete data that has already been joined will require a data deletion request to be initiated.
No, you cannot import data with duplicate keys into Google Analytics 4. For example, an import file containing two columns for item id would not be accepted for an item data import.
Within the data sources section, select the data source you are wanting to upload data to and click import now, to import data to an existing data source. From here you can select the file that you require to import
Google Analytics 4 has several reserved names which cannot be used in data import files. Please see this list and ensure you avoid using these terms in your data import files.
Stay in touch
Subscribe to our newsletter
By clicking and subscribing, you agree to our Terms of Service and Privacy Policy
A version of this article was originally published on RocketMill's website.