Branch.io is an industry leader in cross-platform attribution, mobile app measurement, and deep linking. Many top-ranking apps use Branch to increase their performance and revenue through better performance and engagement.

RudderStack supports Branch as a destination where you can seamlessly send your customer data.

Find the open source transformer code for this destination in the GitHub repository.

Getting started

Before configuring Branch as a destination in RudderStack, verify if the source platform is supported by Branch by referring to the table below:

Connection ModeWebMobileServer
Device mode-Supported-
Cloud mode-Supported-
To learn more about the difference between cloud mode and device mode in RudderStack, refer to the RudderStack Connection Modes guide.

Once you have confirmed that the source platform supports sending events to Branch, follow these steps:

  1. From your RudderStack dashboard, add a source. Then, from the list of destinations, select Branch Metrics.
  2. Assign a name to the destination and click Continue.

Connection settings

To successfully configure Branch as a destination, you will need to configure the following settings:

Branch connection settings
  • Branch key: Enter your Branch key from the Settings section in the Branch dashboard.
  • Client-side Events Filtering: This setting lets you specify which events should be blocked or allowed to flow through to Branch.
For more information on this setting, refer to the Client-side Events Filtering guide.

Adding device mode integration

Depending on your platform of integration, follow the below steps below to integrate Branch with your app.

  1. Open the Podfile of your project and add the following line
    pod 'Rudder-Branch', '0.1.3'

    followed by

    $ pod install
  2. Finally change the SDK initialization with the following
    RudderConfigBuilder *builder = [[RudderConfigBuilder alloc] init];
    [builder withDataPlaneUrl:<DATA_PLANE_URL>];
    [builder withFactory:[RudderBranchFactory instance]];
    [builder withLoglevel:RudderLogLevelDebug];
    [RudderClient getInstance:<WRITE_KEY> config:[builder build]];
This device mode integration is supported for Branch v1.41.0 and above.
Follow these steps to add Branch to your iOS project:
  1. Install RudderBranch (available through CocoaPods) by adding the following line to your Podfile:
    pod 'RudderBranch', '~> 1.0.0'
  2. Run the pod install command.
  3. Then, import the SDK depending on your preferred platform:
    import RudderBranch
    @import RudderBranch;
  4. Next, add the imports to your AppDelegate file under the didFinishLaunchingWithOptions method, as shown:

    let config: RSConfig = RSConfig(writeKey: WRITE_KEY)
    .dataPlaneURL(DATA_PLANE_URL)
    RSClient.sharedInstance().configure(with: config)
    RSClient.sharedInstance().addDestination(RudderBranchDestination())
    RSConfig *config = [[RSConfig alloc] initWithWriteKey:WRITE_KEY];
    [config dataPlaneURL:DATA_PLANE_URL];
    [[RSClient sharedInstance] configureWith:config];
    [[RSClient sharedInstance] addDestination:[[RudderBranchDestination alloc] init]];
Your Android project must be on version 5.0 (API level 21) or higher for RudderStack to be able to send events to Branch.

Once confirmed, follow these steps to add Branch to your Android project:

  1. Open your app/build.gradle (Module: app) file, add the following
    repositories {
    mavenCentral()
    }
  2. Add the following under dependencies section
    implementation 'com.rudderstack.android.sdk:core:1.0.1'
    implementation 'com.rudderstack.android.integration:branch:0.1.3'
    // branch SDK requirements
    implementation 'io.branch.sdk.android:library:4.3.2'
    implementation'com.android.installreferrer:installreferrer:1.1.2'
    implementation 'com.google.firebase:firebase-appindexing:19.1.0'
    implementation 'com.google.android.gms:play-services-ads:16+'
  3. Finally change the initialization of the SDK with the following
    val rudderClient: RudderClient = RudderClient.getInstance(
    this,
    <WRITE_KEY>,
    RudderConfig.Builder()
    .withDataPlaneUrl(<DATA_PLANE_URL>)
    .withLogLevel(RudderLogger.RudderLogLevel.DEBUG)
    .withFactory(BranchIntegrationFactory.FACTORY)
    .build()
    )

Identify

The identify call associates a user to their actions and also captures the traits associated with that user.

A sample identify call captured from the RudderStack iOS SDK is as shown:

[[RudderClient sharedInstance] identify:@"developer_user_id"
traits:@{@"foo": @"bar", @"foo1": @"bar1"}];
You can call identify when the user registers to the app for the first time, logs into the app, or updates their information.

Track

The track call lets you record the customer events along with any properties associated with them.

A sample track call is shown below:

[[RudderClient sharedInstance] track:@"test_event"
properties:@{@"key":@"value", @"foo": @"bar"}]

All the events tracked by RudderStack are divided into three major Branch event categories:

Commerce event mapping

The following table lists the mapping between the RudderStack ecommerce events and the Branch events:

RudderStack eventBranch event
Product AddedADD_TO_CART
Product Added to WishlistADD_TO_WISHLIST
Cart ViewedVIEW_CART
Checkout StartedINITIATE_PURCHASE
Payment Info EnteredADD_PAYMENT_INFO
Order CompletedADD_PAYMENT_INFO
Spend CreditsSPEND_CREDITS
Promotion ViewedVIEW_AD
Promotion ClickedCLICK_AD
Checkout StartedPURCHASE
Order CompletedPURCHASE
ReserveRESERVE
RudderStack also maps the Spend Credits event to Branch's SPEND_CREDITS, although it is not directly a part of the ecommerce events.

Content event mapping

The following table lists the mapping between the RudderStack events and the Branch Content events:

RudderStack eventBranch event
Products SearchedSEARCH
Product ViewedVIEW_ITEM
Product List ViewedVIEW_ITEMS
Product ReviewedRATE
Product SharedSHARE
Initiate StreamINITIATE_STREAM
Complete StreamCOMPLETE_STREAM
The above mentioned events are a part of the RudderStack ecommerce events but are mapped to Branch's Content events.

Lifecycle event mapping

RudderStack supports mapping the following Branch lifecycle events:

RudderStack eventBranch event
Complete RegistrationCOMPLETE_REGISTRATION
Complete TutorialCOMPLETE_TUTORIAL
Achieve LevelACHIEVE_LEVEL
Unlock AchievementUNLOCK_ACHIEVEMENT
InviteINVITE
LoginLOGIN
Start TrialSTART_TRIAL
SubscribeSUBSCRIBE

Property mappings

The following table lists the mapping of the accepted RudderStack properties common to all the events:

RudderStack propertyBranch property
title$og_title
description$og_description
image_url$og_image_url
canonical_identifier$canonical_identifier
publicly_indexable$publicly_indexable
price$price
locally_indexable$locally_indexable
quantity$quantity
sku$sku
name$product_name
brand$product_brand
category$product_category
variant$product_variant
rating_average$rating_average
rating_count$rating_count
rating_max$rating_max
creating_timestamp$creation_timestamp
exp_date$exp_date
keywords$keywords
address_street$address_street
address_city$address_city
address_region$address_region
address_country$address_country
address_postal_code$address_postal_code
latitude$latitude
longitude$longitude
image_captions$image_captions
condition$condition

FAQ

Where can I find the Branch key?

To retrieve your Branch key, follow these steps:

  1. Log into your Branch dashboard.
  2. Go to Account Settings > Profile.
  3. You can find the Branch Key under Branch Key and Secret section, as shown:
Branch key

Contact us

For more information on the topics covered on this page, email us or start a conversation in our Slack community.

On this page