Send Custom Campaign Details to Google Analytics 4
Use Google Analytics 4 (GA4) to obtain metrics for your MobilePush apps.
- Implement the MobilePush SDK in your app.
- Implement the Firebase SDK in your app and configure it for your app platform:
- For iOS apps, see Add Firebase to your Apple project.
- For Android apps, see Add Firebase to your Android project.
To log the AnalyticsEventCampaignDetails
event:
- Extract these parameters from the MobilePush message payload received from Marketing Cloud Engagement:
sfmc_journey_id
sfmc_journey_name
sfmc_activity_id
sfmc_activity_name
sfmc_channel
sfmc_asset_id
sfmc_id
- Log an AnalyticsEventCampaignDetails event.
The campaign_details
event is the first event sent to Google Analytics after receiving the push notification from Engagement. Sending this event first ensures that all subsequent events sent to Google Analytics are associated with the campaign details.
This example demonstrates how to log the campaign details event in your iOS app using Swift, by extracting the necessary parameters from the userInfo
dictionary and logging the AnalyticsEventCampaignDetails
event.
- Salesforce Help: Manage Parameters
- Salesforce Help: Configure Google Analytics App Tracking