Search specific term/phrase surrounded by double quotes. e.g. “deep linking”
Exclude records that contain a specific term prefixed with a minus. e.g. Android -Firebase

Google Analytics 4

1328

Overview

Send your referred Branch data to your Google Analytics Dashboard, helping you understand the power of Branch as an acquisition and re-engagement pathway. If you're interested in the segment of users coming into your apps through Branch and want to measure their events against your other cohorts, this guide can help.

How does it work?

Once the Branch SDK is integrated into an app, Branch can detect which Branch Links are leading to opens, installs, re-installs, and down funnel events. Enabling this integration and providing your Google Analytics Tracking Id will result in Branch automatically forwarding events to Google Analytics, in the exact format Google Analytics expects. This includes automatically setting various UTM tags that can be used to determine the source of new users.

Branch Events Sent to Google Analytics

Branch will send referred installs and opens, commerce, content, user lifecycle, as well as any custom events you track with Branch. Clicks, web session starts, and web pageviews will not be sent. Branch also sends over analytics data that is attached to the link, whether it's UTM tags or fields set on the Branch Dashboard (e.g. Campaign, Channel, Feature). This will allow you to analyze which campaigns, channels, etc. are helping you acquire and engage users. You can see the list of fields that we send to Google Analytics here.

App Events

Commerce Events

User Lifecycle Events

Content Events

Custom Events

  • Install
  • Open
  • Add to Cart
  • Add to Wishlist
  • View Cart
  • Initiate Purchase
  • Add Payment Info
  • View Ad
  • Click Ad
  • Purchase
  • Reserve
  • Spend Credits
  • Complete Registration
  • Login
  • Complete Tutorial
  • Achieve Level
  • Unlock Achievement
  • Invite
  • Start Trial
  • Subscribe
  • Opt In
  • Opt Out
  • Search
  • View Item
  • View Items
  • Rate
  • Share
  • Initiate Stream
  • Complete Stream
  • Custom

What does it look like?

Branch events will appear alongside your other tracked events in Google Analytics. Here is an example of the Events screen with sample data.

Prerequisites

In order to enable Google Analytics, you need to have completed the following:

  1. Admin access to your Branch Dashboard.
  2. Have the Advanced Data Feeds add-on enabled on your Branch account. Advanced Data Feeds can be included as an add-on to both the Engagement and Performance products.
  3. Implemented the Branch SDK into your mobile app (iOS | Android)
  4. Implement the Google Analytics SDK
  5. Admin access to your Firebase and Google Analytics accounts.

Enable Google Analytics 4

1. Retrieve IDs from Firebase & Google Analytics

Retrieve Firebase App ID

  • In the GA4 Admin UI, open Data Streams, there you should find your App Stream Details. Use this to find your Firebase App IDs.

👍

iOS & Android App IDs

Typically, you will have separate Firebase App IDs for the different platforms. Be sure to retrieve both of your iOS and Android Firebase App IDs.

Retrieve API Secret

If you do not have an API Secret already created, navigate in the Google Analytics Dashboard to:

  • In Admin, make sure that you have the desired account and property selected.
  • In the Property column, click Data Streams, then click your stream. Select Measurement Protocol API secrets. From here a new page will prompt you to create a new API secret. Click the Create button.

  • After you create an API secret, make sure to copy the Secret Value.

👍

API Secret

Note - You will need an API Secret for iOS and another API Secret for Android.

2. Connect Google Analytics in Branch

In the Branch Dashboard in Data Feeds → Data Integrations tab, find or search for Google Analytics 4.

Enter the IDs from the previous step. Enter them into the corresponding fields and click Save.

3. Pass Metadata to the Branch SDK

👍

Developer Required

Developers on your mobile app are required for this step

For a given app session, these unique Google Analytics identifiers needs to be passed to the Branch SDK (before the Branch SDK initializes) in order for Branch to properly send events to Google Analytics.

Compatible IDs

OriginIdentifierBranch Metadata KeyRequired
FirebaseApp Instance ID$firebase_app_instance_idYes
FirebaseUser ID$firebase_user_idNo

Specify the Branch metadata key for your Google Analytics tracking identifier

Pass Firebase IDs to Branch

// Call before Branch SDK initialization
// App Instance ID - ID dedicated to the install; will change when app is uninstalled and reinstalled.
Branch.getInstance().setRequestMetadataKey("$firebase_app_instance_id", Analytics.appInstanceID())
// User ID
Branch.getInstance().setRequestMetadataKey("$firebase_user_id", "{user_id}")
// Call before Branch SDK initialization
// App Instance ID
[[Branch getInstance] setRequestMetadataKey:@"$firebase_app_instance_id" value: [Analytics appinstanceID]];
// User ID
[[Branch getInstance] setRequestMetadataKey:@"$firebase_user_id" value:@"{user_id}"];
// Call before Branch SDK initialization
// App Instance ID
Branch.getInstance().setRequestMetadata("\$firebase_app_instance_id", Analytics.getAppInstanceId());
// User ID
Branch.getInstance().setRequestMetadata("\$firebase_user_id", "{user_id}");
// Call before Branch SDK initialization
// App Instance ID
Branch.getInstance().setRequestMetadata("\$firebase_app_instance_id", Analytics.getAppInstanceId())
// User ID
Branch.getInstance().setRequestMetadata("\$firebase_user_id", "{user_id}")
// Call AFTER Branch SDK initialization
setRequestMetadataKey("$firebase_app_instance_id", Analytics.appInstanceID())
// App Instance ID
FlutterBranchSDK.setRequestMetadata(key: "\$firebase_app_instance_id", value: "<Firebase App Instance ID Here>");

// User ID
FlutterBranchSDK.setRequestMetadata(key: "\$firebase_user_id", value: "<Firebase User ID Here>");

4. Verify Data Sent

Once the above steps are complete, you are now ready to start launching campaigns. Branch-attributed conversions will be sent to Google Analytics. To verify data is being sent from Branch to Google Analytics, you can look at the Branch Dashboard's Liveview Webhook Records and apply the following filter:

FilterOperatorValue
webhook partner keyequalsdi_google_analytics_v4_firebase

📘

Wait Period

Please be patient as data may take some time to flow through Branch's attribution systems and onto Google Analytics. If data has not appeared in Google Analytics after 30 minutes of completing a test conversion, review the above steps to see if you may have missed something.

Properties Sent to Google Analytics

Google Property NameBranch Property NameExample Commerce Event
app_instance_idcustom_data.$firebase_app_instance_id1d4f3658fa5304dd42e9531187a4bf0e
namenamePURCHASE
descriptionevent_data_descriptionCustomer made a purchase
user_idcustom_data.$firebase_user_iduser1234
timestamp_microstimestamp * 10001679432023497000
utm_campaignlast_attributed_touch_data_tilde_campaignTest Campaign
utm_sourcelast_attributed_touch_data_tilde_channelTest Source
utm_mediumlast_attributed_touch_data_tilde_featureTest Medium
utm_keywordlast_attributed_touch_data_tilde_keywordTest Keyword
utm_contentlast_attributed_touch_data_tilde_tagsTest Content
currencyevent_data_currencyUSD
revenueevent_data_revenue1.5
revenue_in_usdevent_data_revenue_in_usd1.5
exchange_rateevent_data_exchange_rate1
shippingevent_data_shipping0
taxevent_data_tax9.75
couponevent_data_couponCoupon Code
affiliationevent_data_affiliationTest Affiliation
search_queryevent_data_search_queryTest Search Query
revenue_in_local_currencyevent_data_revenue_in_local_currency124.083532
local_currencyevent_data_local_currencyINR
local_currency_exchange_rateevent_data_local_currency_exchange_rate82.7222355

Troubleshooting

Data not appearing in Google Analytics

  1. Check your Measurement/Tracking/Firebase IDs in the Branch Dashboard matches the Measurement/Tracking/Firebase IDs in Google Analytics
  2. Ensure you are looking at the right part of the Google Analytics Dashboard with the right app selected.
  3. Check that your Google Analytics Reports don't have any comparisons on them. For example, if your report compares users in the United Kingdom, and your Branch opens are from users in the United Kingdom, you won't see this Branch data in your report.