Google Analytics 4 (iOS/Android) Event Streaming
Amplitude Data's Google Analytics 4 (iOS/Android) 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 (iOS/Android) destination works with an iOS or Android mobile application using Firebase. If you are working with a web application instrumented with Google Tag (gtag.js), set up a Google Analytics 4 (Web) destination instead.
Considerations¶
- Amplitude sets
non_personalized_ads
totrue
for 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_type
as event name.
Setup¶
Prerequisites¶
To set up event streaming to GA4, you need the following:
- A
Firebase App ID
- A
Measurement Protocol API secret
- A custom user property in Amplitude containing the Firebase app instance ID for each user
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 Protocol API secret
is available under theAdditional Settings
section, by openingMeasurement 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 theSecret value
column of the appropriate row.- Navigate to your Firebase console.
- Your
Firebase App ID
is underProjects Settings > General > Your Apps > App ID
.
Amplitude setup¶
- 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.
Configure settings¶
- On the Settings tab, click Edit.
- Enter your Measurement Protocol API secret.
- Enter your Firebase App 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 events, toggle Send Events to Enabled.
- Expand the Select and filter events panel, and select which events to send. Amplitude recommends that you send only 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, you can configure your mappings.
Configure mappings (optional)¶
For newer versions of the Google Analytics 4 (iOS/Android) destination, you can map Amplitude properties to 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 (
user_id
). - Select a Firebase Instance ID. This is a unique identifier for a user's instance of your mobile application. Defaults to the custom user property
firebase_instance_id
. - Save when finished.
After you configure mappings, enable the destination.
Enable integration¶
The final step is enabling the destination. You must enable the destination to start streaming events.
- Navigate back to the Settings tab and click Edit.
- Toggle Status from Disabled to Enabled.
- Save when finished.
Still have questions? Ask them in the Community.