Google Analytics 4 (Web) Event Streaming
Amplitude Data's Google Analytics 4 (Web) integration enables you to stream your Amplitude event data straight to Google Analytics with just a few clicks.
Choose the right Google Analytics 4 destination
The Google Analytics 4 (Web) destination works with a web application instrumented with Google Tag (gtag.js). If you are working with an iOS or Android mobile application using Firebase, set up a Google Analytics 4 (iOS/Android) destination instead.
- Amplitude sets
truefor all sent events.
- Google Analytics 4 property names are composed of alphanumeric characters and underscores. Amplitude replaces white spaces in property names with a single underscore and strips all other non-alphanumeric characters from the names.
- Amplitude sends custom events using Amplitude
event_typeas event name.
To set up event streaming to GA4, you need the following:
Measurement Protocol API secret
To find these values:
- Open the Google Analytics home page.
- Click the gear icon to open Admin, then select Data Streams.
- Pick the data stream to stream the Amplitude events to.
Measurement IDis available on the top right corner.
Measurement Protocol API secretis available under the
Additional Settingssection, by opening
Measurement Protocol API secrets. You can create a new API secret that's specific to this use case, that you can manage and remove independently the others. Copy the value in the
Secret valuecolumn of the appropriate row.
- In Amplitude, navigate to Data.
- On the sidebar, under Connections, select Catalog.
- Select the Destinations tab.
- Select Event Streaming.
- Click Google Analytics 4 (Web).
- Enter a sync name, then click Create Sync.
After you create the destination, you must configure the settings.
- On the Settings tab, click Edit.
- Enter your Measurement Protocol API secret.
- Enter your Measurement ID.
- Create & Update Users creates users in Google Analytics 4 and update the properties of existing users when an Amplitude Identify API call is made. You can select up to 25 user properties to send. Google Analytics 4 doesn't accept more than 25 user properties.
- To create and update users, toggle Create & Update Users to Enabled.
- To select user properties to send, expand the Specify user properties to send panel, and select up to 25 properties. If you don't select any properties here, Amplitude doesn't include any.
- Send Events sends events ingested by Amplitude to Google Analytics 4. You can select up to 25 event properties to send. Google Analytics 4 doesn't accept more than 25 event properties.
- To send event, toggle Send Events to Enabled.
- Expand the Select and filter events panel, and select which events to send. Amplitude recommends that you only send the events you need in Google Analytics 4, rather than selecting All Events.
- To select event properties to send, expand the Specify event properties to send panel, and select up to 25 properties. If you don't select any properties here, Amplitude doesn't include any.
- Save when finished.
After you configure your settings, configure your mappings.
Configure mappings (optional)¶
For newer versions of the Google Analytics 4 (Web) destination, you can map Amplitude properties fields in Google Analytics 4. If you don't configure mappings, or are using an older version that doesn't support mapping, the default values described below are used instead.
- Click the Mappings tab, then click Edit.
- Select a User ID. This is a unique identifier for users in Google Analytics 4. Defaults to Amplitude User ID (
- Select a Client ID. This is a unique identifier for a web client, a user's instance of your web application. Defaults to Amplitude Device ID (device_id).
- Save when finished.
After you configure mappings, enable the destination.
The final step is enabling the destination. You must enable the destination to start streaming events.
- Navigate back to the Settings tab.
- Click Edit.
- Toggle Status from Disabled to Enabled.
- Click Save.
Still have questions? Ask them in the Community.