With Amplitude's Google Analytics 4 integration, you can ingest Google Analytics 4 data into your Amplitude project.
To get started with import from GA4, you need to take care of a few prerequisites.
Here’s a step-by-step breakdown of how Amplitude imports your GA4 data:
Export GA4 Data to BigQuery
First, Amplitude exports your GA4 data to your BigQuery project through BigQuery Linking. This process creates an automated flow of event data from GA4 to BigQuery.
Unload Data from BigQuery to Your GCS Bucket
To handle BigQuery’s export limitations (for example, export size restrictions), Amplitude unloads your data from BigQuery to the GCS bucket you provided. This ensures data readiness for ingestion into Amplitude.
Delay Handling:
To ensure your data is complete, Amplitude accounts for delays caused by GA4’s export process:
Catch-up Importing:
If there’s a backlog, Amplitude uses a catch-up strategy to process data in batches of 10 tables per day. For example:
During the unload process, Amplitude also transforms your data into the format it requires for seamless ingestion.
Import Data from GCS to Amplitude
Once data is ready in the GCS bucket, Amplitude imports the data on your behalf.
To add GA4 as a data source in your Amplitude project, follow these steps.
In Amplitude, click Data, Catalog and select the Sources tab.
In the Data Warehouse section, Click Google Analytics 4.
Add the service account key and specify a GCS bucket name.
After confirming your credentials, click Next to configure table selection. Follow these options:
Daily
.projectId.datasetName.tableName
.
After configuring your options, click Next. Amplitude executes a pre-defined SQL query to verify the data import from BigQuery. Amplitude transforms GA4 data into a compatible format. Refer to the Amplitude HTTP V2 API documentation for required fields.
If no errors occur, click Next. Enter a source name and click Save. A notification confirms that the GA4 source has been successfully enabled. The Sources listing page loads, where the newly created GA4 source appears in the list.
If you encounter any issues or have questions during the setup process, reach out to the Amplitude team for support: Contact Support
These tips and best practices to help you navigate BigQuery’s SQL queries, which differ from other SQL queries in some ways.
"Properties" fields, comprised of property keys and values, power many Amplitude features. The most common of these properties fields are event_properties
and user_properties
.
For Amplitude to correctly ingest these sets of keys and values, they must be exported from BigQuery as raw JSON, not as JSON strings. BigQuery doesn't have strong support for JSON, but the following describes how to make sure your data is exports from BigQuery and imports to Amplitude without errors.
The properties fields come from columns with a STRUCT type. The struct type is the field type that represents a key-value structure and is exported from BigQuery in raw JSON format.
If your source table doesn't have the event or user properties organized in a struct type column, you can create it in your select SQL. For example, if your event properties are all flattened into their own columns, you can compose your event_properties
into a struct like so:
1SELECT STRUCT(2 event_property_column_1 AS event_property_name_1,3 event_property_column_2 AS event_property_name_24) as event_properties5FROM your_table;
You can't have spaces in struct field names even if you enclose them in back ticks or single quotes.
If you have your event or user properties formatted as JSON as a string field, you still must reconstruct the properties field in the select SQL as a STRUCT. BigQuery exports String fields as String even if the contents are JSON. Amplitude's event validation rejects these.
You can extract values from your JSON String field, though, to use in your properties STRUCT. Use the JSON_EXTRACT_SCALAR function to access the values in your string as follows. If the EVENT_PROPERTIES
column in the table contains a JSON String like:
"{\"record count\":\"50\",\"region\":\"eu-central-1\"}"
which displays in the BigQuery UI as {"record count":"50","region":"eu-central-1"})
, then you can extract the values from the JSON String with the following SQL:
1SELECT STRUCT(2 JSON_EXTRACT_SCALAR(EVENT_PROPERTIES, "$.record count") AS record_count,3 JSON_EXTRACT_SCALAR(EVENT_PROPERTIES, "$.region") AS region4) as event_properties5FROM your_table;
Unlike other data warehouse products, BigQuery treats "double-quoted strings" as string literals. This means that you can't use them to quote identifiers like column names or table names, or the SQL fails to execute in BigQuery.
Thanks for your feedback!
January 30th, 2025
Need help? Contact Support
Visit Amplitude.com
Have a look at the Amplitude Blog
Learn more at Amplitude Academy
© 2025 Amplitude, Inc. All rights reserved. Amplitude is a registered trademark of Amplitude, Inc.