Create Deep Links

Overview

You can use Deep Links on your Journeys, Universal Ads links, Quick Links, and Universal Email. In this guide, we will walk you through how to configure your default and custom link behavior, as well as how to create short and long links.

Default link behavior

Your app is not installed

  • User clicks on a Branch deep link

  • Device navigates to the fallback (e.g. an app store or website)

    • App Stores Supported:
      • Apple App Store
      • Google Play
      • Huawei App Store
      • Vivo App Store
      • Oppo App Store
      • Baidu Mobile Assistant
  • User installs and opens your app

  • Branch passes deep link data into your app

Your app is installed

  • User clicks on a Branch deep link

  • Device opens your app or navigates to expected link behavior

  • Branch passes deep link data into your app

Expected link behavior

  • Expected link behavior is dependent on whether or not the app supports deep linking

  • *Able to force app open using $uri_redirect_mode or enabling a Deepview

Platform

iOS

Android

Facebook Newsfeed

Fallback; able to deep link via Facebook App Links

App

Facebook Browser

App

App

Facebook Messenger

Fallback; able to deep link via Facebook App Links

App

Facebook Messenger Browser

App

App

Instagram Profile

Fallback; able to force app open using $uri_redirect_mode=2

App

Instagram Browser

App

App

Instagram Stories

Fallback; able to force app open

App

Twitter Feed

Fallback; able to force app open. Links with $ios_url or $fallback_url redirect fallbacks require web SDK 2.48.0+ init on the website

App

Twitter Browser

App

App

Snap Messages

App

App

Snap Stories

Fallback; review custom instructions for using Branch in Snap stories

App

Reddit

Fallback; need to use $use_https_app_store: true in link to fallback to App Store

Fallback

Pinterest

Fallback

Fallback

Pinterest Browser

App

App

Google+

Fallback; App Store redirects will not work

Fallback

Chrome Browser

App

App

Chrome Address Bar

Fallback

Fallback; deep link data will not pass into the app

Safari Browser

App

N/A

Safari Address Bar

Fallback; Blocked by Apple

N/A

Firefox Browser

Fallback

App

Firefox Address Bar

Fallback

App

UC Browser

N/A

App

Naver Browser

N/A

App

Kakao Browser

N/A

App

Opera Browser

App

App

Ghostery Browser

App

Fallback; query strings must be encoded ($ = %24)

Google Hangouts

Fallback; able to force app open

App

Samsung SMS

N/A

App

Samsung SMS Browser

N/A

App

Apple iMessage

App

N/A

Apple Business Chat

App

N/A

Slack

App; must configure Slack to open links with Safari

App

WeChat

Fallback; customize WeChat fallback urls

Fallback; customize WeChat fallback urls

WhatsApp

App; app.link require https/http to be clickable

App; app.link require https/http to be clickable

LINE

Fallback; able to force app open

App

Discord

App

App

Apple Mail

App

N/A

Gmail

App

App

Yahoo Mail

Fallback; able to force app open

App

TikTok

Ads promoting apps will take users to the app store

Ads promoting apps will take users to the app store

TikTok

Ads taking users to a non app-store landing page will open in an in-app browser.

Ads taking users to a non app-store landing page will open in an in-app browser.

Custom link behavior

Pass data from link to app

  • Add link data to each deep link

  • Add key-values pairs to your Quick Links

  • Append query strings https://example.app.link/fzmLEhobLD?$custom_data=123&hello=world

Fallback to a specific URL

  • Determine where a deep link will navigate to if either

    • Your app is not installed

    • [or] Another app prevent links from deep linking outside their app

  • Fallback overrides (ordered by precedence)

    • Add query string https://example.app.link?$ios_url=https://example.com
    • Add link data $ios_url = 'https://example.com' (docs)
    • Add link data for a deep view $ios_deepview = 'deepviewId' (docs)
    • Enable a Deep View globally on the Branch Dashboard
    • Add link data $fallback_url = 'https://example.com' (docs)
    • Add iOS/Android Custom URL on the Branch Dashboard
    • Add Default URL ($fallback_url) on the Branch Dashboard

Open web instead of app

  • Your app is not installed
    • Device navigates to the fallback (e.g. an app store or website)
  • Your app is installed
    • iOS: need to override Universal Links
      • Add $web_only = true (docs)
      • Add redirect $ios_url = 'https://google.com' (docs)
      • [or] Append /e/ to the deep link
        • e.g. https://example.app.link/fzmLEhobLD -> https://example.app.link/e/fzmLEhobLD
    • Android: need to override App Links
      • Uncheck Enable App Links and then hit Save on the Branch Dashboard
      • Add redirect $android_url = 'https://google.com' (docs)
      • Add a broken URI Scheme with $android_deeplink_path = 'random' (docs)
  • Add _webonly in the link domain: e.g. branch.app.link -> branch_webonly.app.link
    • Does not work with custom link domains.

Social link behavior

  • Use OG Tags to display content as a preview card in Facebook, Twitter, Pinterest, iMessage, etc.
    • Basics are $og_title, $og_description, and $og_image_url
  • Use Deep Views to display content as a website

UTM Behavior

❗️

Enabled by Default

To disable this functionality, go to Link Settings -> Advance Settings -> Analytics mapping with UTM.

imageimage

  • When redirecting to a web URL, Branch automatically passes through any values from the following Branch link analytics tags as UTM parameters:
    • ~campaign -> utm_campaign
    • ~channel -> utm_source
    • ~feature -> utm_medium
  • This applies to web URLs defined using any of the following $fallback_url, $ios_url, $android_url, $desktop_url, $original_url, and $canonical_url.
  • If these UTM parameters are already detected on the URLs being redirected to, Branch will not overwrite them.
  • For more information about UTM parameters, please read Google Analytic's Custom Campaigns article.

Create deep links

Short links

  • Short links are the most common deep link
  • You can customize the subdomain of example.app.link, or change to your own personal domain (links.yoursite.com)
  • You can tailor the appearance of the short code to a custom alias during creation
    • Aliases can be short strings, e.g. https://example.app.link/october-sale
    • Or can be full link path, e.g. https://example.app.link/product/id1234
  • Short links encapsulate link data inside them on link creation
    • e.g. existing link https://example.app.link/fzmLEhobLD
  • Short links can have additional data appended to them
    • e.g. dynamic link https://example.app.link/fzmLEhobLD?content_id=123
  • Methods of creating short links
    • Use Quick Links for fast link creation and easy tracking
    • Use our App SDK to create and share links within your app
    • Use our Web SDK to create links which help convert your web users to app users
    • Use our HTTP API to programmatically create links from your server
    • Use our Chrome Extension to generate links from your browser

Long links

  • Long links can be created without a network call to Branch
  • Long links need link data to be added as a query string. Be sure to URI encode any urls in the link.
    • e.g. existing link https://example.app.link/fzmLEhobLD?foo=bar&baz=456&$fallback_url=https%3A%2F%2Fbranch.io%2F
    • e.g. dynamic link https://example.app.link/?foo=bar&baz=456&$fallback_url=https%3A%2F%2Fbranch.io%2F
  • Long links need a /a/ and a Branch Key if you use a custom link domain
    • e.g. existing link https://link.example.com/5NPh/p4M09KRLrD?foo=bar&baz=456&$fallback_url=https%3A%2F%2Fbranch.io%2F
    • e.g. dynamic link https://link.example.com/a/key_live_kaFuWw8WvY7yn1d9yYiP8gokwqjV0Swt?foo=bar&baz=456&$fallback_url=https%3A%2F%2Fbranch.io%2F
  • Long links need a /a/ and a Branch Key if you use a bnc.lt
    • e.g. existing link https://bnc.lt/5NPh/p4M09KRLrD?foo=bar&baz=456&$fallback_url=https%3A%2F%2Fbranch.io%2F
    • e.g. dynamic link https://bnc.lt/a/key_live_kaFuWw8WvY7yn1d9yYiP8gokwqjV0Swt?foo=bar&baz=456&$fallback_url=https%3A%2F%2Fbranch.io%2F
  • When adding tags to a dynamic link, enter each tag separately

Configure deep links

You're free to add any of your own key-value parameters to a Branch link. These parameters will be passed to your app via the Branch SDK, however some keys will have specific extra effects.

Reserved prefixes

  • Branch adds additional properties to your deep link data to explain the link
PrefixUsage
$Branch reserved keyword
~Branch analytical data
+Branch added values

Analytical labels

  • These labels allow you to filter and organize your deep links
KeyDefaultUsage
~channelUse channel to tag the route that your link reaches users. For example, tag links with 'Facebook' or 'LinkedIn' to help track clicks and installs through those paths separately
~featureThis is the feature of your app that the link might be associated with. For example, if you had built a referral program, you would label links with the feature 'referral'
~campaignUse this field to organize the links by actual campaign. For example, if you launched a new feature or product and want to run a campaign around that
~campaign_idUse this field to organize the links by actual campaign id. For example, if you launched a new feature or product and want to run a campaign around that
~customer_campaignThe customer campaign specified for the last attributed touch. can be specified on links by the client.
~stageUse this to categorize the progress or category of a user when the link was generated. For example, if you had an invite system accessible on level 1, level 3 and 5, you could differentiate links generated at each level with this parameter
~tagsThis is a free form entry with unlimited values ['string']. Use it to organize your link data with labels that don't fit within the bounds of the above
~secondary_publishersecondary publisher specified for the last attributed touch. passed by the ad network.
~customer_secondary_publisherThe ID of the secondary publisher specified for the last attributed touch. can be specified on links by the client.
~creative_nameThe creative name specified for the last attributed touch.
~creative_idThe creative ID specified for the last attributed touch.
~ad_set_nameThe ad set name specified for the last attributed touch.
~ad_set_idThe ad set ID specified for the last attributed touch.
~customer_ad_set_nameTThe customer ad set name specified for the last attributed touch. can be specified on links by the client.
~ad_nameThe ad name specified for the last attributed touch.
~ad_idThe ad ID specified for the last attributed touch.
~customer_ad_nameThe customer ad name specified for the last attributed touch. can be specified on the link by the client.
~keywordThe keyword specified for the last attributed touch.
~keyword_idThe unique ID for keyword of the last touch
~customer_keywordThe customer keyword of the last touch. Can be specified on links by the client.
~placementThe placement of the last touch, as set with an analytics tag. Actual app or website the ad appears on display campaigns.
~placement_idThe ID of placement of the last touch, as set with an analytics tag. Actual app or website the ad appears on display campaigns.
~customer_placementThe customer specified placement of the last touch, as set with an analytics tag. Actual app or website the ad appears on display campaigns. Can be specified on the link by the client.
~sub_site_nameReference to the site where the ad was displayed.
~customer_sub_site_nameCustomer reference to the site where the ad was displayed. Can be specified on links by the client.
  • These labels allow you to customize attribution windows for a single link
KeyDefaultUsage
$click_install_window_days7Time between a click or a web to app auto redirect and an install or reinstall. (i.e., https://branchster.app.link/hpNVE52gxE?$click_install_window_days=3)
$click_session_start_window_days1Time between a click or a web to app auto redirect and an open or web session start. (i.e., https://branchster.app.link/hpNVE52gxE?$click_session_start_window_days=7)
$click_conversion_window_days30Time between a click or a web to app auto redirect and a conversion event. Conversion events include commerce events (e.g. purchase, add to cart), all custom events, and all view events like pageviews & content views. (i.e., https://branchster.app.link/hpNVE52gxE?$click_session_start_window_days=30)
$impression_install_window_days1Time between an ad impression and an install or reinstall. (i.e., https://branchster.app.link/hpNVE52gxE?$impression_install_window_days=3)
$impression_session_start_window_days1Time between an ad impression and an open or web session start. (i.e., https://branchster.app.link/hpNVE52gxE?$impression_session_start_window_days=1)
$impression_conversion_window_days7Time between an ad impression and a conversion event. Conversion events include commerce events (e.g. purchase, add to cart), all custom events, and all view events like pageviews & content views. (i.e., https://branchster.app.link/hpNVE52gxE?$impression_session_start_window_days=7)

Custom data

  • Pass any custom data to be read inside your app
KeyValueUsage
random123Any key-value pair
custom_datatrueAny key-value pair
any_value{ 'random': 'dictionary' }Any key-value pair
look_at[1,2,3,4,5,6]Any key-value pair
nav_herecontent/123Any key-value pair

Redirections

  • Navigate to different locations based on device information
  • Navigation URLs must be websites, not deep links
KeyDefaultUsage
$fallback_urlChange the redirect endpoint for all platforms - so you don't have to enable it by platform. Note that Branch will forward all robots to this URL, which overrides any OG tags entered in the link. System-wide Default URL (set in Link Settings)
$fallback_url_xxChange the redirect endpoint for all platforms based on a lower-case Alpha-2 country code. For example, $fallback_url_de="..." would redirect Germany deep link clicks. You should also set $fallback_url to act as the global redirect in addition to the country-specific ones. WARNING: platform specific redirects (like $ios_url or $desktop_url) are set, they will override the country-specific redirect. Thus, the recommendation is to only use $fallback_url_xx for the country specific redirects and $fallback_url to catch all other users.
$desktop_urlChange the redirect endpoint on desktops Text-Me-The-App page (set in Link Settings)
$ios_urlChange the redirect endpoint for iOS App Store page for your app (set in Link Settings)
$ipad_urlChange the redirect endpoint for iPads $ios_url value
$android_urlChange the redirect endpoint for Android Play Store page for your app (set in Link Settings)
$samsung_urlRedirect to Samsung Galaxy Store on Samsung devices. Only link level control. Format should be http://www.samsungapps.com/appquery/appDetail.as?appId=YOUR.PACKAGE.NAME
$windows_phone_urlChange the redirect endpoint for Windows OS Windows Phone default URL (set in Link Settings)
$blackberry_urlChange the redirect endpoint for Blackberry OS BlackBerry default URL (set in Link Settings)
$fire_urlChange the redirect endpoint for Amazon Fire OS Fire default URL (set in Link Settings)
$ios_wechat_urlChange the redirect endpoint for WeChat on iOS devices $ios_url value
$android_wechat_urlChange the redirect endpoint for WeChat on Android devices $android_url value
$web_onlyfalseForce to open the $fallback_url instead of the app

Forced redirections

  • Prevent error messages from other apps when Branch deep links are clicked
KeyValueUsage
$uri_redirect_mode0This 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_mode1Smart 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_mode2Forceful redirect mode. Always try to force open the app, even if it risks showing an error message when the app is not installed.
  • Supported Apps
    • Facebook newsfeed iOS
    • Instagram iOS
    • Twitter iOS
    • Safari iOS
    • Firefox iOS & Android

Deep linking

  • Navigate to different locations based on device information
KeyDefaultUsage
$deeplink_pathopen?link_click_id=1234Set the deep link path for all platforms - so you don't have to enable it by platform. When the Branch SDK receives a link with this parameter set, it will automatically load the custom URI path contained within
$android_deeplink_pathSet the deep link path for Android apps. When the Branch SDK receives a link with this parameter set, it will automatically load the custom Android URI path contained within
$ios_deeplink_pathSet the deep link path for iOS apps. When the Branch SDK receives a link with this parameter set, it will automatically load the custom iOS URI path contained within
$desktop_deeplink_pathSet the deep link path for Desktop apps. You will have to fetch this parameter and route the user accordingly
$match_duration7200Lets you control the snapshotting match timeout (the time that a click will wait for an app open to match) also known as attribution window. Specified in seconds
$always_deeplinktrueSet to false to make links always fall back to your mobile site. Does not apply to Universal Links or Android App Links.
$ios_redirect_timeout750Control the timeout that the client-side JS waits after trying to open up the app before redirecting to the App Store. Specified in milliseconds
$android_redirect_timeout750Control the timeout that the client side JS waits after trying to open up the app before redirecting to the Play Store. Specified in milliseconds
$custom_sms_textText for SMS link sent for desktop clicks to this link. Must contain {{ link }} Value of Text me the app page in Settings
$marketing_titleSet the marketing title for the deep link.
$deeplink_no_attributionSet to true for the links to only support deep linking without any attribution for that link.

Content

  • Handle content properties
KeyDefaultUsage
$publicly_indexable1Cannot modify here. Needs to be set by the Branch Universal Object
~keywordKeywords for which this content should be discovered by. Just assign an array of strings with the keywords you'd like to use
$canonical_identifierThis is the unique identifier for content that will help Branch dedupe across many instances of the same thing. Suitable options: a website with pathing, or a database with identifiers for entities
$content_typeThis is a label for the type of content present. Apple recommends that you use uniform type identifier as described here
$do_not_processfalseThis will prevent click tracking and storage of link analytics. Deep link data will still flow into the app from link click to app open.

Deepview

KeyDefaultUsage
$ios_deepviewbranch_defaultThe name of the deepview template to use for iOS
$android_deepviewbranch_defaultThe name of the deepview template to use for Android
$desktop_deepviewbranch_defaultThe name of the deepview template to use for the Desktop
KeyValueDefault
$ios_passive_deepviewThe name of the template to use for iOS.branch_default
$android_passive_deepviewThe name of the template to use for Android.branch_default

Link appearance

  • Customize the apperance of your short link
KeyDefaultUsage
aliasnoneSpecify a link alias to replace of the standard encoded short URL (e.g. https://example.app.link/aQXXDHaxKF -> https://example.app.link/october-campaign or https://example.app.link/product/id1234). Link aliases must be unique per app (a 409 error will occur if you create an alias already taken). Also note that we don't currently support single character path segments after the domain (/a/, /b/, /c/, etc).

Open Graph

  • Handle Facebook properties
KeyDefaultUsage
$og_titleSet on dashboardSet the title of the link as it will be seen in social media displays
$og_descriptionSet on dashboardSet the description of the link as it will be seen in social media displays
$og_image_urlSet on dashboardSet the image of the link as it will be seen in social media displays
$og_image_widthSet the image's width in pixels for social media displays
$og_image_heightSet the image's height in pixels for social media displays
$og_videoSet a video as it will be seen in social media displays
$og_urlSet the base URL of the link as it will be seen in social media displays
$og_typeSet the type of custom card format link as it will be seen in social media displays. Don't set this property when sharing deep links on Facebook
$og_redirect(Advanced, not recommended) Set a custom URL that we redirect the social media robots to in order to retrieve all the appropriate tags
$og_app_idSet on dashboard(Rarely used) Sets the app id tag

Twitter

  • Handle Twitter properties
KeyDefaultUsage
$twitter_cardSet the Twitter card type of the link (e.g. player) (you must whitelist your deep link with the Twitter Card Validator
$twitter_titleSet on dashboardSet the title of the Twitter card
$twitter_descriptionSet on dashboardSet the description of the Twitter card
$twitter_image_urlSet on dashboardSet the image URL for the Twitter card
$twitter_siteSet the site for Twitter
$twitter_app_countrySet the app country for the app card
$twitter_playerSet the video player's URL. Defaults to the value of $og_video.
$twitter_player_widthSet the player's width in pixels
$twitter_player_heightSet the player's height in pixels

Other Reserved Keys

KeyUsage
access_token or AccessTokenUsed by Branch to determine if a deep link is a valid Branch link or not.
auth_tokenor AuthTokenUsed by Branch to determine if a deep link is a valid Branch link or not.
dataUsed by Branch to contain top-level link information. If this parameter is added to a Branch link via appending query params, it will be dropped. It can be safely used when creating a link manually via the dashboard.

Custom Tags

  • Handle custom meta tags
KeyValue
$custom_meta_tagsValid stringified JSON dictionary of the tags’ keys and values
  • Valid dictionary example: "{"twitter:player:stream": "https://branch.io\"}". This will result in the following meta tag: <meta property="twitter:player:stream" content="https://branch.io" />
  • If you create the link via the Dashboard, don’t worry about stringifying the dictionary. It will be done automatically.
  • apple_touch_icon is a special key in the dictionary. If you set it, we will add a <link rel="apple-touch-icon" href="<url>" /> tag to the scraped HTML page. This will allow you to show a custom icon for previews in iMessage, Safari Bookmarks, Slack, etc.

Universal Object

  • Properties for the Branch Universal Object within your app integration
KeyDefaultUsageLink Property
canonicalIdentifier(Required) This is the unique identifier for content that will help Branch dedupe across many instances of the same thing. Suitable options: a website with pathing, or a database with identifiers for entities$canonical_identifier
canonicalUrlThe canonical URL, used for SEO purposes$canonical_url
titleThe name for the piece of content$og_title
contentDescriptionA description for the content$og_description
contentImageUrlThe image URL for the content. Must be an absolute path$og_image_url
priceThe price of the item$amount
currencyThe currency representing the price in ISO 4217 currency code$currency
contentIndexingMode"public"Can be set to either "public" or "private". Public indicates that you'd like this content to be discovered by other apps.$publicly_indexable
contentMetadataAny custom key-value data e.g. { "custom": "data" }

BUO Best Practices

  • Do
    • Set the canonicalIdentifier to a unique, de-duped value across instances of the app
    • Ensure that the title, contentDescription and imageUrl properly represent the object
    • Initialize the Branch Universal Object and call logEvent with the VIEW_ITEM event on page load
    • Call showShareSheet and createShortLink later in the life cycle, when the user takes an action that needs a link
    • Call the additional object events (purchase, share completed, etc) when the corresponding user action is taken
  • Do not
    • Set the same title, contentDescription and imageUrl across all objects
    • Wait to initialize the object and register views until the user goes to share
    • Wait to initialize the object until you conveniently need a link
    • Create many objects at once and register views in a for loop.

Read deep links

  • Deep link data gets sent from your link to your app integration

Data structure

  • Example deep link data structure
{
          "identity_id": "427469360685348303",
          "link": "https://example.app.link?%24identity_id=427469360685348303",
          "session_id": "429691081177874743",
          "data": {
            "$canonical_identifier": "item/1503684554354.28",
            "$canonical_url": "https://example.com/home?utm_campaign=test&deeplink=value",
            "$desktop_url": "http://example.com/home",
            "$identity_id": "427469360685348303",
            "$og_description": "My Content Description",
            "$og_image_url": "http://lorempixel.com/200/200/",
            "$og_title": "46D6D28E-0390-40E4-A856-BD74F34D24C8",
            "$publicly_indexable": 1,
            "+click_timestamp": 1503684563,
            "+clicked_branch_link": true,
            "+is_first_session": false,
            "+match_guaranteed": true,
            "custom": "blue",
            "random": "FE848A5B-78F7-42EC-A253-9F795FE91692",
            "added": "1503684554354.33",
            "~campaign": "new launch",
            "~channel": "facebook",
            "~creation_source": 3,
            "~feature": "sharing",
            "~id": 429691043152332059,
            "~referring_link": "https://example.app.link/X7OsnWv9TF",
            "~stage": "new person",
            "~tags": [
              "one",
              "two"
            ]
          }
        }

Callback values

  • Additional properties read from the initSession within your app and website integrations

Key

Usage

~id

Automatically generated 18 digit ID number for the link that drove the install/open, if present (0 for dynamic and 3P links)

~referring_link

The referring link that drove the install/open, if present

~creation_source

Where the link was created (0 API
, 1 Quick Link, 2 SDK, 3 iOS SDK
, 4 Android SDK
, 5 Web SDK, 6 Dynamic, 7 Third party)

+match_guaranteed

If the match was made with 100% accuracy

+referrer

The referrer for the link click, if a link was clicked

+is_first_session

true if first session (install), false if any other session (open).

Default is false.

+clicked_branch_link

Whether or not the user clicked a Branch link that triggered this session.

Default is false.

+non_branch_link

App was opened from a non Branch link (third party, invalid Branch deep link, or Branch key mismatch).

Updated 7 days ago



Create Deep Links


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.