Force a Journey to auto-open the app for users that have it installed
You can use Journeys to auto-open the app for users who have it installed by selecting the CTA in the template editor:
While the auto-open setting in the template editor will work on iOS Chrome and Android, there are some specific cases to be aware of:
-
The Web SDK’s auto-open can cause unexpected user experiences if used on web pages inside webviews in your own app, so it’s best to avoid that if possible.
-
Auto-open will only work on Android Chrome from a link click; redirecting from a manually inserted URL will not auto-open the app.
-
Because auto-open is powered by URI schemes and these can lead to error messages on iOS Safari for users without your app, this is not enabled on iOS by default.
If you would like the app to open automatically on iOS Safari as well, you'll need to use a setting called
$uri_redirect_mode
. Since Branch has a massive pool of cookies tied to device identifiers, we know if your app is installed when the user clicks a link. We use this intelligence to determine when to use URI schemes. You can reach out to Support to enable this behavior across all your links, or set it just for Journeys in the web SDK:
<script type="text/javascript">
// load the Branch web lib
(function(b,r,a,n,c,h,_,s,d,k){if(!b[n]||!b[n]._q){for(;s<_.length;)c(h,_[s++]);d=r.createElement(a);d.async=1;d.src="build.min.js";k=r.getElementsByTagName(a)[0];k.parentNode.insertBefore(d,k);b[n]=h}})(window,document,"script","branch",function(b,r){b[r]=function(){b._q.push([r,arguments])}},{_q:[],_v:1},"addListener applyCode banner closeBanner creditHistory credits data deepview deepviewCta first getCode init link logout redeem referrals removeListener sendSMS setBranchViewData setIdentity track validateCode".split(" "), 0);
// init Branch and pass in your preference to open the app
branch.init('BRANCH_KEY');
// Trigger your Journeys banner to use the correct redirect mode
branch.setBranchViewData({
'$uri_redirect_mode': 1
});
</script>
Or, set it for individual templates by adding deep link data $uri_redirect_mode:1
:
Read our blog to learn more about the challenges of URI schemes on iOS and the URI redirect mode feature.
Updated over 4 years ago