Social networks like Facebook and Twitter are notorious for being walled gardens - once you’re in those apps, they make it really hard to link out (especially on iOS). Instead of following standards like Universal Links (and even Facebook’s own App Links) that allow for deep linking, these apps force the user into an in-app webview. 


Luckily, Branch links ensure users have the best possible experience regardless of the limitations imposed by social networking apps. 


We first introduced Forced Redirection in this blog post. Using a parameter called $uri_redirect_mode in your Branch link data, you can tell Branch how aggressive to be in opening links out of social (and other) apps. 


Other than the difficulty of linking out of native social apps (which Branch handles for you), there’s nothing special about using Branch links in social posts. Once you’ve configured Forced Redirection, you can create and post Branch links in organic social posts just like you do in any other channels. They’ll intelligently route the user, do deferred deep linking, and track clicks like any other Branch link.


There are three levels of $uri_redirect_mode, depending on how aggressively you want Branch to try to open your app:


Key

Value

Description

Usage

$uri_redirect_mode

0

Conservative

This is the default value that yields the standard behavior where we don't try to open the app if the user can see an error.

$uri_redirect_mode

1

Intelligent

Smart redirect mode. Same behavior as 0 until we know the user has the app installed through Branch persona data. In that case, force URI schemes to open the app.

$uri_redirect_mode

2

Aggressive

Forceful redirect mode. Always try to force open the app, even if it risks showing an error message when the app is not installed.


As of 3/19/2018, the following apps are supported: 


  • Facebook newsfeed iOS

  • Instagram iOS

  • Twitter iOS

  • Safari iOS

  • Firefox iOS & Android


Benefits:

  1. It's the only way to directly deep link out of Facebook, Twitter, and many other platforms on iOS

  2. iOS 11.2 introduced a bug where new app downloads do NOT always activate Universal Links.  There is no timeline on when Apple will fix this, but $uri_redirect_mode allows users where UL failed to activate, to still open the app when UL is required (i.e., Safari)

  3. Enables Branch auto-open functionality out of Deepviews & Journeys


Caveats:

  1. User must have clicked a Branch link previously on the platform, though it doesn’t have to have been one of yours

  2. Branch must have seen the user open your app at least once before


Setup

There are two places you can set up Forced Redirection for your links. 


First, you can tell Branch how aggressively to try to open the app at the Account level in Link Settings. This will set the default value for all links you create which don’t have a link-level $uri_redirect_mode setting. 


We recommend setting this to Intelligent for the best user experience.


  1. Navigate to Link Settings in your Branch account. Make sure you’re an Admin of the account.

  1. We provide some guidance around what the options are.

  1. Click on the dropdown next to “URI Scheme Deep Link Mode” and choose the appropriate value for your setup

  1. Save your settings. 


Of course, we want you to be able to control this behavior at the link level too. To that end, you can override the account-level setting for any given link like this: 


  1. Add a key-value pair to your link data. The key should be $uri_redirect_mode, and the value should be one or 0, 1, or 2. 

  2. Here’s an example in Quick Links: 




Notes:

  1. The setting at the individual link level will override the account-level setting. For example, if you select “Conservative Mode” in Link Settings and add “$uri_redirect_mode: 2” to a particular Quick Link, the link will try to open the app aggressively. 


Testing

We generally recommend you change the URI Scheme mode to "Intelligent" where we will only launch the app via URI schemes if Branch is sure the app is installed. The risk here is if Branch registers someone as having the app, and the user proceeds to uninstall the app, the URI would still fire and an error model would pop up. 


This is still a fringe use case, but you'll encounter this a lot in QA testing if you're rapidly uninstalling/installing the app & clicking branch links. We recommend you use the following testing scenarios when QAing:


Scenario A: Set $uri_redirect_mode=2 (this will check URI schemes are properly configured)

  1. Install your app

  2. Create a link with $uri_redirect_mode=2, or append it as a query param to an existing link (this will override any link data)

  3. Paste the link into an organic Facebook post

  4. Click the link in the post from the Facebook app

  5. Does the "Leave Facebook?" modal pop-up? If so, URI schemes are properly configured. Facebook requires the modal to be displayed, unfortunately. It is expected that a deepview, webpage, or blank page are presented behind the modal. 


If scenario A fails, then there's an issue with your URI scheme configuration.


Scenario B: Set $uri_redirect_mode=1 (this will check intelligent app open)

  1. Uninstall your app

  2. Switch to LTE

  3. Reset IDFA/GAID ( Settings > Privacy > Advertising > Reset Advertising Identifier... )

  4. Install your app

  5. Open your app

  6. Wait 5-10 minutes (this ensures that the install data can propagate through our system so we can verify the app is installed)

  7. Create a link with $uri_redirect_mode=1, or append it as a query param to an existing link (this will override any link data)

  8. Paste the link into an organic Facebook post

  9. Click the link in the post from the Facebook app

  10. Does the "Leave Facebook?" modal pop-up like in the image above? If so, you are all set.


Scenario B is a good test of the real-world scenario. It is unlikely that your users will reset IDFA/GAIDs in the real world. However, when you are QAing - frequently installing and reinstalling your app - our persona data may be mixed up. With that in mind, don’t be alarmed if we try to open the app when it’s not installed - this is a common QA experience but a rare real-world one.