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

Migrating Firebase Dynamic Links to Branch Links

Migrate your existing usage of Firebase Dynamic Links to Branch Links to power your mobile linking and attribution experiences

Overview

Google announced that they will shut down Firebase Dynamic Links and that the feature is no longer recommended for new projects. Branch makes it easy to transition deep links from Firebase so you can continue creating great user experiences and ensuring your marketing efforts effectively drive new customers to your app.

👍

Dynamic Links without the Firebase SDK

If you are using Dynamic Links without the Firebase SDK, you can skip to Step 5.

Prerequisites

In order to start migrating your Firebase Dynamic Links to Branch Links, you need to have the following:

  1. Developer resources for your mobile app.
  2. The ability to identify your existing Firebase Dynamic Links.

Migrate from Dynamic Links to Branch Links

🚧

Using Firebase and Branch Side-by-Side

It is possible to implement Branch SDKs alongside the Firebase SDK you already have implemented, and to start using Branch Links that way. This lets you ensure that your users have a seamless experience and that you can continue handling Firebase Dynamic Links out in the wild. This may be especially important if you are also using Firebase for other use cases, like authentication.

WARNING: Using the Branch iOS SDK alongside the Firebase SDK will cause issues unless you disable method swizzling with the FirebaseAppDelegateProxyEnabled flag (learn more here). In this case, Branch recommends either removing the Firebase SDK entirely before integrating the Branch iOS SDK, or disabling method swizzling.

1. Create & Configure your Branch Dashboard Account

Go to https://dashboard.branch.io/ and create an account. After creating your account navigate to the Configuration page to start configuring your app settings.

Set your Redirects

In the Required Redirects section, set your redirects per platform, and specify the correct app configuration settings.

Set your Social Media Preview

In the Social Media Preview section, set your title, description, and thumbnail image.

Establish your Link Domain

In the Link Domain section, set your Default Link Domain or set a custom domain.

For additional details on configuring your Branch Dashboard, view our guide here.

2. Integrate the Branch SDK & Set Up Deep Linked Routing

We have full guides on integrating the Branch SDK into your mobile app. Follow these guides based on your platform of choice:

📘

Additional Deep Linked Routing Resources

The integration guides above go through setting up deep linked routing for your app. We also have additional resources on in-app routing that can be found here.

3. Verify Branch Links

During the integration process, you should have gone through testing your Branch Links. By now you should be able to do the following with Branch Links:

  • Branch Link click can redirect to your website and relevant mobile app store listings if the app is not installed or if it's a web-only link.
  • Branch Link click opens your mobile app if the app is installed.
  • Branch Link click can deep link into specific in-app content if the app is installed.

4. Understand Parameter Mapping

Before migrating Dynamic Links to Branch Links, it's important to understand how different parameters are mapped between Firebase and Branch. If your Dynamic Links are utilizing specific parameters for certain behaviors or analytics, use the following table to determine which Branch parameter you will need to achieve the same result:

📘

No Branch Parameter

For some Firebase parameters, there isn't an equivalent Branch parameter. This is because Branch does not require that parameter to achieve that behavior; it is automatically determined in your Dashboard Configuration.

FirebaseBranchDescription
link$canonical_urlThe link your app will open. Specify a URL that your app can handle, typically the app's content or payload, which initiates app-specific logic (such as crediting the user with a coupon or displaying a welcome screen). This link must be a well-formatted URL, be properly URL-encoded, use either HTTP or HTTPS, and cannot be another Dynamic Link.
afl$android_urlThe link to open when the app isn't installed. Specify this to do something other than install your app from the Play Store when the app isn't installed, such as open the mobile web version of the content, or display a promotional page for your app.
ifl$ios_urlThe link to open when the app isn't installed. Specify this to do something other than install your app from the App Store when the app isn't installed, such as open the mobile web version of the content, or display a promotional page for your app.
ipfl$ipad_urlThe link to open on iPads when the app isn't installed. Specify this to do something other than install your app from the App Store when the app isn't installed, such as open the web version of the content, or display a promotional page for your app.
efr$ios_uri_redirect_modeIf set to '1', skip the app preview page when the Dynamic Link is opened, and instead redirect to the app or store. The app preview page (enabled by default) can more reliably send users to the most appropriate destination when they open Dynamic Links in apps; however, if you expect a Dynamic Link to be opened only in apps that can open Dynamic Links reliably without this page, you can disable it with this parameter. This parameter will affect the behavior of the Dynamic Link only on iOS.
ofl$fallback_urlThe link to open on platforms beside Android and iOS. This is useful to specify a different behavior on desktop, like displaying a full web page of the app content/payload (as specified by param link) with another dynamic link to install the app.
st$og_titleThe title to use when the Dynamic Link is shared in a social post.
sd$og_descriptionThe description to use when the Dynamic Link is shared in a social post.
si$og_image_urlThe URL to an image related to this link. The image should be at least 300x200 px, and less than 300 KB.
utm_source~channelGoogle Play analytics parameters.
utm_medium~featureGoogle Play analytics parameters.
utm_campaign~campaignGoogle Play analytics parameters.
utm_term~keywordsGoogle Play analytics parameters.
utm_content~tagsGoogle Play analytics parameters.

5. Migrating Links Created from the Firebase Console

Firebase Dynamic Links created in the Firebase console are useful for creating promo links to share on social media through a user interface.

To create the equivalent Branch Link, utilize the Branch Dashboard to create a Quick Link:

6. Migrating Links Created from the Dynamic Link Builder API

Firebase Dynamic Links created through the Firebase Dynamic Builder API (iOS | Android | Flutter) are useful for programmatically creating links in your app for user-to-user sharing or in any situation that requires many links.

guard let link = URL(string: "https://www.example.com/my-page") else { return }
let dynamicLinksDomainURIPrefix = "https://example.com/link"
let linkBuilder = DynamicLinkComponents(link: link, domainURIPrefix: dynamicLinksDomainURIPRefix)
linkBuilder.iOSParameters = DynamicLinkIOSParameters(bundleID: "com.example.ios")
linkBuilder.androidParameters = DynamicLinkAndroidParameters(packageName: "com.example.android")

guard let longDynamicLink = linkBuilder.url else { return }
print("The long URL is: \(longDynamicLink)")
NSURL *link = [[NSURL alloc] initWithString:@"https://www.example.com/my-page"];
NSString *dynamicLinksDomainURIPrefix = @"https://example.com/link";
FIRDynamicLinkComponents *linkBuilder = [[FIRDynamicLinkComponents alloc]
                                         initWithLink:link
                                               domainURIPrefix:dynamicLinksDomainURIPrefix];
linkBuilder.iOSParameters = [[FIRDynamicLinkIOSParameters alloc]
                             initWithBundleID:@"com.example.ios"];
linkBuilder.androidParameters = [[FIRDynamicLinkAndroidParameters alloc]
                                 initWithPackageName:@"com.example.android"];

NSLog(@"The long URL is: %@", linkBuilder.url);
val dynamicLink = Firebase.dynamicLinks.dynamicLink {
    link = Uri.parse("https://www.example.com/")
    domainUriPrefix = "https://example.page.link"
    // Open links with this app on Android
    androidParameters { }
    // Open links with com.example.ios on iOS
    iosParameters("com.example.ios") { }
}

val dynamicLinkUri = dynamicLink.uri
DynamicLink dynamicLink = FirebaseDynamicLinks.getInstance().createDynamicLink()
        .setLink(Uri.parse("https://www.example.com/"))
        .setDomainUriPrefix("https://example.page.link")
        // Open links with this app on Android
        .setAndroidParameters(new DynamicLink.AndroidParameters.Builder().build())
        // Open links with com.example.ios on iOS
        .setIosParameters(new DynamicLink.IosParameters.Builder("com.example.ios").build())
        .buildDynamicLink();

Uri dynamicLinkUri = dynamicLink.getUri();
final dynamicLinkParams = DynamicLinkParameters(
  link: Uri.parse("https://www.example.com/"),
  uriPrefix: "https://example.page.link",
  androidParameters: const AndroidParameters(packageName: "com.example.app.android"),
  iosParameters: const IOSParameters(bundleId: "com.example.app.ios"),
);
final dynamicLink =
    await FirebaseDynamicLinks.instance.buildLink(dynamicLinkParams);

To create the equivalent Branch Link, utilize Branch's relevant SDK methods (iOS | Android | Flutter):

buo.getShortUrl(with: lp) { url, error in
    print(url ?? "")
}
[buo getShortUrlWithLinkProperties:lp andCallback:^(NSString* url, NSError* error) {
    if (!error) {
        NSLog(@"@", url);
    }
}];
val lp = LinkProperties()
        .setChannel("facebook")
        .setFeature("sharing")
        .setCampaign("content 123 launch")
        .setStage("new user")
        .addControlParameter("$desktop_url", "http://example.com/home")
        .addControlParameter("custom", "data")
        .addControlParameter("custom_random", Long.toString(Calendar.getInstance().getTimeInMillis()))

    buo.generateShortUrl(this, lp, BranchLinkCreateListener { url?, error? ->
        if (error == null) {
            Log.i("BRANCH SDK", "got my Branch link to share: " + url)
        }
    })
LinkProperties lp = new LinkProperties()
        .setChannel("facebook")
        .setFeature("sharing")
        .setCampaign("content 123 launch")
        .setStage("new user")
        .addControlParameter("$desktop_url", "https://example.com/home")
        .addControlParameter("custom", "data")
        .addControlParameter("custom_random", Long.toString(Calendar.getInstance().getTimeInMillis()));

    buo.generateShortUrl(this, lp, new Branch.BranchLinkCreateListener() {
        @Override
        public void onLinkCreate(String url, BranchError error) {
            if (error == null) {
                Log.i("BRANCH SDK", "got my Branch link to share: " + url);
            }
        }
    });
BranchUniversalObject buo = BranchUniversalObject(
  canonicalIdentifier: 'flutter/branch',
  //canonicalUrl: '',
  title: 'Flutter Branch Plugin',
  imageUrl: 'https://flutter.dev/assets/flutter-lockup-4cb0ee072ab312e59784d9fbf4fb7ad42688a7fdaea1270ccf6bbf4f34b7e03f.svg',
  contentDescription: 'Flutter Branch Description',
  keywords: ['Plugin', 'Branch', 'Flutter'],
  publiclyIndex: true,
  locallyIndex: true,
  contentMetadata: BranchContentMetaData()..addCustomMetadata('custom_string', 'abc')
  ..addCustomMetadata('custom_number', 12345)
  ..addCustomMetadata('custom_bool', true)
  ..addCustomMetadata('custom_list_number', [1,2,3,4,5 ])
  ..addCustomMetadata('custom_list_string', ['a', 'b', 'c']),
);

BranchLinkProperties lp = BranchLinkProperties(
  //alias: 'flutterplugin', //define link url,
  channel: 'facebook',
  feature: 'sharing',
  stage: 'new share',
  tags: ['one', 'two', 'three']
);
lp.addControlParam('url', 'http://www.google.com');
lp.addControlParam('url2', 'http://flutter.dev');

BranchResponse response =
  await FlutterBranchSdk.getShortUrl(buo: buo, linkProperties: lp);
if (response.success) {
  print('Link generated: ${response.result}');
} else {
  print('Error : ${response.errorCode} - ${response.errorMessage}');
}

7. Migrating Links Created from the REST API

Firebase Dynamic Links created through the Firebase REST API are useful for dynamically creating links on platforms that don't have a Builder API.

POST https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=api_key
Content-Type: application/json

{
  "dynamicLinkInfo": {
    "domainUriPrefix": "https://example.page.link",
    "link": "https://www.example.com/",
    "androidInfo": {
      "androidPackageName": "com.example.android"
    },
    "iosInfo": {
      "iosBundleId": "com.example.ios"
    }
  }
}

To create the equivalent Branch Link, utilize Branch's Deep Link API:

POST /v1/url HTTP/1.1
Accept: application/json
Content-Type: application/json
Host: api2.branch.io
Content-Length: 710

{"branch_key":"key_live_xxxx","channel":"facebook","feature":"onboarding","campaign":"new product","stage":"new user","tags":["one"],"data":{"$fallback_url":"string","$fallback_url_xx":"string","$desktop_url":"string","$ios_url":"string","$ios_url_xx":"string","$ipad_url":"string","$android_url":"string","$android_url_xx":"string","$samsung_url":"string","$huawei_url":"string","$windows_phone_url":"string","$blackberry_url":"string","$fire_url":"string","$ios_wechat_url":"string","$android_wechat_url":"string","$web_only":false,"$desktop_web_only":false,"$mobile_web_only":false,"$after_click_url":"false","$afterclick_desktop_url":"string"},"alias":"string","type":0,"duration":7200,"identity":"string"}

8. Migrating Long Links Manually

Firebase Dynamic Links created manually are useful if you don't need to track click data and don't care if links are long:

https://your_subdomain.page.link/?link=your_deep_link&st=your_title&sd=your_description

To create the equivalent Branch Link, utilize Branch's Long Links:

https://your_subdomain.app.link/?$canonical_url=your_deep_link&$og_title=your_title&$og_description=your_description

Additional Branch Link Creation Options

There are other methods of creating Branch Links that may better align with your marketing strategies and processes. Some of these options can help make your migration easier through bulk creation. View some of those options here:

OptionDescription
Bulk Quick Link Creation (CSV)Upload a CSV to the Branch Dashboard to create Quick Links in bulk.
Bulk Link Create APIProgrammatically create short links in bulk via Branch's Deep Linking API.
QR Code APIProgrammatically create QR Codes via Branch's QR Code API.
Note: Using this request will output your QR Code in the directory where the request was made and in the format defined in the request.