Steps to setup Branch io for UTM Tracking in React Native

  • npm i react-native-branch
  • Pod install for iOS
  • Create an account in branch io for tracking the UTM source.
  • Go to the configure section in that ,Go to the configuration section create default url , android redirects, iOS redirects and also enable the Enable NativeLink™ after that save the data.
  • User can also change the default domain according to the requirement.
  • To generate the quick link for iOS in that user has to enter the name you link, analytics tags, redirects, link data & social media tags for preview after that one link will be generated that will track your click,install ,open etc.
  • After the above steps let’s start configuring the Android and iOS platform.

For iOS Setup:

  • In Xcode open the Signing and Capabilities tab, and click on Add Capability. Then choose Associated Domains
  • add your domain link from branch io link domain section
  • Open Info.plist add below code:

Initialise branch :

Open AppDelegate.m and add the following code:

Let’s setup for Android App:

Open Android manifest file add the android:launchMode=”singleTask” to .MainActivity activity.

Open Mainactivity.java file

Open mainApplication.java file

Let Implement the code to listen the Deep Links in the App.

  1. Example for Android:
    1.  After implementation of code let create the android link which will contain the domain name & the UTM source.
    2. Create the link (https://domain_name.aap.link/?utm_source=facebook)

 On Click , it will redirect to the play store if the app is not installed. After that if we run the build release of the app then it will show the UTM source value in installParams value. It can be used in the SignUp api to track the UTM source.

  1. Example for iOS:
  •  To Track the UTM source in the iOS app we had to use the quick link(https://domain_name.aap.link/aliaspath) on click of link it will redirect to the browser then user will see to option get the app and get the app without copying.
  •  Get the app option:
    • If the user clicks on the get the app option it will copy the alternate link of branch io in the clipboard and will redirect it to the app-store and after that we made the release build from Xcode and signUp through the app we will pass the UTM source to db.
  • Get the app without copying:
    • If the user clicks on the app without copying then also it will work the same as the above only but the alternate link will not get copied in the clipboard.

Please find the below links for more information:

You may also like

Leave a Reply