URLs can navigate to your website, but not to your app. Branch fixes this with deep links.
Branch will grow your app by allowing users to install, open, and navigate to content inside your app.
Increase discovery of your app by sharing its content, converting web users to app users, enabling user-to-user sharing, personalizing user experiences, tracking users, tracking referrals, tracking campaigns, tracking conversions, and increasing overall engagement.
Branch for Cordova, PhoneGap, and Ionic
Questions? Contact us
- Getting Started
- Features
- Troubleshooting
- Testing: Key Points
- Testing: Optional App Config
- Testing: Branch Analytics
- Testing: Simulating an Install
- Testing: Supported Platforms
- Testing: Sample Test App
- Link Data: Universal Object Properties
- Link Data: Deep Link Properties
- Link Data: Commerce Properties
- Compiling: Cordova Dependencies
- Compiling: Show Console Logs
- Compiling: Updating the Branch SDK
- Compiling: Incompatible Plugins
- Compiling: Errors
Getting Started
-
#### Configure Branch
-
Complete your Branch Dashboard
-
-
#### Configure App
-
Cordova and Ionic
<!-- sample config.xml --><!-- Branch --> -
PhoneGap
<!-- sample config.xml --><!-- Branch --> -
Change the following values to match your Branch Dashboard
com.eneff.branch.cordovatestbed
key_live_ndqptlgXNE4LHqIahH1WIpbiyFlb62J3
branchcordova
cordova.app.link
PW4Q8885U7
-
-
#### Initialize Branch
-
Cordova and PhoneGap
// sample index.jsvar app ={this;}{document;document;}{app;}{app;}{// Branch initializationBranch;};app; -
Ionic 1
// sample app.jsangular// ... -
Ionic 2/3
// sample app.component.js;;;;
-
-
#### Test Deep Link iOS
-
Create a deep link from the Branch Marketing Dashboard
-
Delete your app from the device
-
Compile your app (
cordova run ios
phonegap run ios
ionic cordova run ios
) -
Paste deep link in
Apple Notes
-
Long press on the deep link (not 3D Touch)
-
Click
Open in "APP_NAME"
to open your app (example)
-
-
#### Test Deep Link Android
-
Create a deep link from the Branch Marketing Dashboard
-
Delete your app from the device
-
Compile your app (
cordova run android
phonegap run android
ionic cordova run android
) -
Paste deep link in
Google Hangouts
-
Click on the deep link to open your app
-
Features
-
#### Initialize Branch Features
-
Loads Branch into your app
-
Must be called on
deviceready
andresume
// for development and debugging onlyBranch// for better Android matchingBranch// Branch initializationBranch;
-
-
#### Create Content Reference
-
The
Branch Universal Object
encapsulates the thing you want to share (content or user) -
Link Data: Universal Object Properties
// only canonicalIdentifier is requiredvar properties =canonicalIdentifier: 'content/123'canonicalUrl: 'https://example.com/content/123'title: 'Content 123 Title'contentDescription: 'Content 123 Description ' + DatecontentImageUrl: 'http://lorempixel.com/400/400/'price: 1212currency: 'GBD'contentIndexingMode: 'private'contentMetadata:custom: 'data'testing: 123this_is: true// create a branchUniversalObj variable to reference with other Branch methodsvar branchUniversalObj = nullBranch
-
-
#### Create Deep Link
-
Creates a deep link URL with encapsulated data
-
Needs a Branch Universal Object
-
Link Data: Deep Link Properties
-
Verify on the Branch Dashboard
// optional fieldsvar analytics =channel: 'facebook'feature: 'onboarding'campaign: 'content 123 launch'stage: 'new user'tags: 'one' 'two' 'three'// optional fieldsvar properties =$desktop_url: 'http://www.example.com/desktop'$android_url: 'http://www.example.com/android'$ios_url: 'http://www.example.com/ios'$ipad_url: 'http://www.example.com/ipad'$deeplink_path: 'content/123'$match_duration: 2000custom_string: 'data'custom_integer: Datecustom_boolean: truebranchUniversalObj
-
-
#### Share Deep Link
-
Will generate a Branch deep link and tag it with the channel the user selects
-
Needs a Branch Universal Object
-
Link Data: Deep Link Properties
// optional fieldsvar analytics =channel: 'facebook'feature: 'onboarding'campaign: 'content 123 launch'stage: 'new user'tags: 'one' 'two' 'three'// optional fieldsvar properties =$desktop_url: 'http://www.example.com/desktop'custom_string: 'data'custom_integer: Datecustom_boolean: truevar message = 'Check out this link'// optional listeners (must be called before showShareSheet)branchUniversalObjbranchUniversalObjbranchUniversalObjbranchUniversalObj// share sheetbranchUniversalObj
-
-
#### Read Deep Link
-
Retrieve Branch data from a deep link
-
Best practice to receive data from the
listener
-
Listener
// Branch initialization within your deviceready and resumeBranch -
First data
Branch -
Latest data
Branch
-
-
#### Display Content
-
List content on iOS Spotlight
-
Needs a Branch Universal Object
branchUniversalObj
-
-
#### Track Content
-
Track how many times a user views a particular piece of content
-
Needs a Branch Universal Object
-
Verify on the Branch Dashboard
branchUniversalObj
-
-
#### Track User
-
Sets the identity of a user (email, ID, UUID, etc) for events, deep links, and referrals
-
Verify on the Branch Dashboard
var userId = '123456'Branch -
Removes the identity of a user
Branch
-
-
#### Track Event
-
Registers a custom event
-
Events named
open
,close
,install
, andreferred session
are Branch restricted -
Recommended to Track User before Track Event to associate custom events with a user
-
Verify on the Branch Dashboard
var eventName = 'clicked_on_this'var metadata = 'custom_dictionary': 123 'anything': 'everything'Branchvar eventName = 'clicked_on_this'Branch
-
-
#### Track Commerce
-
Registers a custom commerce event
-
Link Data: Track commerce properties for
Currency
andCategory
-
Verify on the Branch Dashboard
// only revenue is requiredvar event ='revenue': 5029'currency': 148 // USD'transactionID': 'transaction id''coupon': 'coupon''shipping': 222'tax': 511'affiliation': 'affiliation''products':'sku': 'u123''name': 'cactus''price': 499'quantity': 2'brand': 'brand''category': 17 // Software'variant': 'variant''sku': 'u456''name': 'grass''price': 000'quantity': 1// optional fieldsvar metadata ='custom_dictionary': 123'anything': 'everything'Branch
-
-
#### Handle Referrals
-
Referral points are obtained from events triggered by users from rules created on the Branch Dashboard
-
Verify on the Branch Dashboard
-
Get credits
-
Referrer is tracked
-
Referrer creates a deep link
-
Referrer shares the deep Link
-
Referee clicks on deep link
-
Referee triggers a custom event
-
Catch the event in your Branch Dashboard as a rule
-
Referrer gets referral points
-
-
Spend credits
var amount = 10var bucket = 'this_bucket'Branchvar amount = 10Branch -
Load credits
var bucket = 'this_bucket'BranchBranch -
Load history
Branch
-
Troubleshooting
-
#### Testing: Key Points
-
Need to checkmark "app uses IDFA and GAID" when publishing your app
-
Best to enable Deepviews (Testing: Supported Platforms)
-
-
#### Testing: Optional App Config
<!-- sample config.xml --><!-- Branch --><!-- optional spec --><!-- optional previous link domain --><!-- optional previous link domain --><!-- required if iOS app --><!-- optional --><!-- optional (for bnc.lt and custom domains) --><!-- optional (simulate installs) --> -
#### Testing: Branch Analytics
-
Whenever a user
clicks
on a deep link and opens the app, and will trigger either aninstall
or anopen
-
installs
represent Branch recognizing the app_id and device_id for the first time -
installs
represent new app users and the success rate of your Branch deep links -
installs
do not represent App Store downloads -
non-Branch installs
are installs outside of Branch deep link clicks -
opens
are non-installs -
If a user uninstalls and reinstalls the app, this will be an
open
because Branch recognizes the device -
If a user has the app and clicks a Branch deep link, this will be an
open
because the user is not new
-
-
#### Testing: Simulating an Install
-
Delete your app
-
[iOS] iPhone Device -> Settings -> Privacy -> Advertising -> Reset Advertising Identifier -> Reset Identifier
-
[Android] Add
<android-testmode value="true" />
to yourConfig.xml
(Testing: Optional App Config) -
Add
Branch.setDebug(true);
beforeBranch.initSession();
(Initialize Branch Features) -
Click on a deep link to navigate to your
$fallback_url
because your app is not installed -
Install your app
-
Open your app
-
Read from
Branch.initSession(data)
for+is_first_session = true
-
-
#### Testing: Supported Platforms
-
Apps which support Branch deep links
iOS Details Android Details Facebook NewsFeed ✅ Works when DeepViews are enabled ✅ Facebook Messanger ✅ Works when DeepViews are enabled ✅ Twitter ✅ ✅ Pinterest ✅ Works when DeepViews are enabled ✅ Slack ✅ ✅ Chrome address bar 🅾️ 🅾️ Chrome web page ✅ ✅ FireFox address bar 🅾️ 🅾️ FireFox web page ✅ ✅ Safari address bar 🅾️ Safari web page ✅ WeChat ✅ Works when DeepViews are enabled ✅ WhatsApp ✅ app.link
requires https/http to be clickable✅ app.link
requires https/http to be clickableHangouts ✅ ✅ iMessage ✅ Apple Mail ✅ Gmail ✅ ✅
-
-
#### Testing: Sample Testing App
-
#### Link Data: Universal Object Properties
-
Properties
Key Default Usage Link 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
canonicalUrl The canonical URL, used for SEO purposes $canonical_url
title The name for the piece of content $og_title
contentDescription A description for the content $og_description
contentImageUrl The image URL for the content. Must be an absolute path $og_image_url
price The price of the item $amount
currency The 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
contentMetadata Any custom key-value data e.g. { "custom": "data" }
-
#### Link Data: Deep Link Properties
-
For Create Deep Link and Share Deep Link
-
Analytics
Key Default Usage channel Use 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 separatelyfeature This 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’ campaign Use 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 stage Use 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 tags This 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 abovealias Specify a link alias in place of the standard encoded short URL e.g. yourdomain.com/youralias
. Link aliases are unique, immutable objects that cannot be deleted. You cannot change the alias of existing links. Aliases on the legacybnc.lt
domain are incompatible with Universal Links and Spotlighttype 0
Set to 1
to limit deep linking behavior of the generated link to a single use. Set type to2
to make the link show up under Marketing Dashboard while adding$marketing_title
todata
. Must be anint
. Does not work with the Cordova SDK (limitation of native SDKs) -
Properties
-
Custom Data
Key Value Usage random 123
Any key-value pair hello "world"
Any key-value pair custom_data true
Any key-value pair -
Redirection
Key Default Usage $fallback_url Change 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) $desktop_url Change the redirect endpoint on desktops Text-Me-The-App page (set in Link Settings) $ios_url Change the redirect endpoint for iOS App Store page for your app (set in Link Settings) $ipad_url Change the redirect endpoint for iPads $ios_url
value$android_url Change the redirect endpoint for Android Play Store page for your app (set in Link Settings) $windows_phone_url Change the redirect endpoint for Windows OS Windows Phone default URL (set in Link Settings) $blackberry_url Change the redirect endpoint for Blackberry OS BlackBerry default URL (set in Link Settings) $fire_url Change the redirect endpoint for Amazon Fire OS Fire default URL (set in Link Settings) $ios_wechat_url Change the redirect endpoint for WeChat on iOS devices $ios_url value
$android_wechat_url Change the redirect endpoint for WeChat on Android devices $android_url
value$after_click_url URL redirect to after the main click redirect has completed $web_only false
Force to open the $fallback_url
instead of the app -
Deep Link
Key Default Usage $deeplink_path open?link_click_id=1234
Set 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_path Set the deep link path for Android apps When the Branch SDK receives a link with this parameter set, it will automatically load the custom URI path contained within $ios_deeplink_path Set the deep link path for iOS apps. When the Branch SDK receives a link with this parameter set, it will automatically load the custom URI path contained within $match_duration 7200
Lets you control the fingerprinting match timeout (the time that a click will wait for an app open to match) also known as attribution window. Specified in seconds $always_deeplink true
Set to false
to make links always fall back to your mobile site. Does not apply to Universal Links or Android App Links.$ios_redirect_timeout 750
Control 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_timeout 750
Control the timeout that the clientside JS waits after trying to open up the app before redirecting to the Play Store. Specified in milliseconds $one_time_use false
Set to true
to limit deep linking behavior of the generated link to a single use. Can also be set using type$custom_sms_text Text for SMS link sent for desktop clicks to this link. Must contain {{ link }}
Value of Text me the app page in Settings$marketing_title The Marketing Title for the deep link in the Marketing Dashboard -
Content
Key Default Usage $publicly_indexable 1
Cannot modify here. Needs to be set by the Branch Universal Object $keywords Keywords for which this content should be discovered by. Just assign an array of strings with the keywords you’d like to use $canonical_identifier 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 $exp_date 0
Cannot modify here. Needs to be set by the Branch Universal Object. Must be epoch timestamp with milliseconds $content_type This is a label for the type of content present. Apple recommends that you use uniform type identifier as described here -
DeepView
Key Default Usage $ios_deepview default_template
The name of the deepview template to use for iOS $android_deepview default_template
The name of the deepview template to use for Android $desktop_deepview default_template
The name of the deepview template to use for the Desktop -
Open Graph
Key Default Usage $og_title Set the title of the link as it will be seen in social media displays $og_description Set the description of the link as it will be seen in social media displays $og_image_url Set the image of the link as it will be seen in social media displays $og_image_width Set the image’s width in pixels for social media displays $og_image_height Set the image’s height in pixels for social media displays $og_video Set a video as it will be seen in social media displays $og_url Set the base URL of the link as it will be seen in social media displays $og_type Set the type of custom card format link as it will be seen in social media displays $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_id (Rarely used) Sets the app id tag -
Twitter
Key Default Usage $twitter_card Set the Twitter card type of the link $twitter_title Set the title of the Twitter card $twitter_description Set the description of the Twitter card $twitter_image_url Set the image URL for the Twitter card $twitter_site Set the site for Twitter $twitter_app_country Set the app country for the app card $twitter_player Set the video player’s URL. Defaults to the value of $og_video
.$twitter_player_width Set the player’s width in pixels $twitter_player_height Set the player’s height in pixels
-
-
-
#### Link Data: Commerce Properties
-
For Track Commerce
-
Categories
Value Category 0 Animals & Pet Supplies 1 Apparel & Accessories 2 Arts & Entertainment 3 Baby & Toddler 4 Business & Industrial 5 Camera & Optics 6 Electronics 7 Food, Beverage & Tobacco 8 Furniture 9 Hardware 10 Health & Beauty 11 Home & Garden 12 Luggage & Bags 13 Mature 14 Media 15 Office Supplies 16 Religious & Ceremonial 17 Software 18 Sporting Goods 19 Toys & Games 20 Vehicles & Parts -
Currencies
Value Currency 0 AED 1 AFN 2 ALL 3 AMD 4 ANG 5 AOA 6 ARS 7 AUD 8 AWG 9 AZN 10 BAM 11 BBD 12 BDT 13 BGN 14 BHD 15 BIF 16 BMD 17 BND 18 BOB 19 BOV 20 BRL 21 BSD 22 BTN 23 BWP 24 BYN 25 BYR 26 BZD 27 CAD 28 CDF 29 CHE 30 CHF 31 CHW 32 CLF 33 CLP 34 CNY 35 COP 36 COU 37 CRC 38 CUC 39 CUP 40 CVE 41 CZK 42 DJF 43 DKK 44 DOP 45 DZD 46 EGP 47 ERN 48 ETB 49 EUR 50 FJD 51 FKP 52 GBP 53 GEL 54 GHS 55 GIP 56 GMD 57 GNF 58 GTQ 59 GYD 60 HKD 61 HNL 62 HRK 63 HTG 64 HUF 65 IDR 66 ILS 67 INR 68 IQD 69 IRR 70 ISK 71 JMD 72 JOD 73 JPY 74 KES 75 KGS 76 KHR 77 KMF 78 KPW 79 KRW 80 KWD 81 KYD 82 KZT 83 LAK 84 LBP 85 LKR 86 LRD 87 LSL 88 LYD 89 MAD 90 MDL 91 MGA 92 MKD 93 MMK 94 MNT 95 MOP 96 MRO 97 MUR 98 MVR 99 MWK 100 MXN 101 MXV 102 MYR 103 MZN 104 NAD 105 NGN 106 NIO 107 NOK 108 NPR 109 NZD 110 OMR 111 PAB 112 PEN 113 PGK 114 PHP 115 PKR 116 PLN 117 PYG 118 QAR 119 RON 120 RSD 121 RUB 122 RWF 123 SAR 124 SBD 125 SCR 126 SDG 127 SEK 128 SGD 129 SHP 130 SLL 131 SOS 132 SRD 133 SSP 134 STD 135 SYP 136 SZL 137 THB 138 TJS 139 TMT 140 TND 141 TOP 142 TRY 143 TTD 144 TWD 145 TZS 146 UAH 147 UGX 148 USD 149 USN 150 UYI 151 UYU 152 UZS 153 VEF 154 VND 155 VUV 156 WST 157 XAF 158 XAG 159 XAU 160 XBA 161 XBB 162 XBC 163 XBD 164 XCD 165 XDR 166 XFU 167 XOF 168 XPD 169 XPF 170 XPT 171 XSU 172 XTS 173 XUA 174 XXX 175 YER 176 ZAR 177 ZMW
-
-
#### Link data: Mixpanel Integration
-
Sync with Mixpanel if plugin is installed
Branch
-
-
#### Compiling: Cordova Dependencies
-
Node
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)";brew update;brew install node; -
Xcode
-
Install Xcode
-
Open Xcode -> agree to SDK license agreement
-
Open Xcode -> Create new Xcode project -> Run simulator -> Agree to developer mode on mac
-
-
Android Studio
-
Read instructions
-
Install JVM
-
Install Android Studio
-
Open Android Studio -> configure -> appearance/system settings/android sdk -> android 6.0 -> Okay
-
Open Android Studio -> New project -> ... -> Run -> Create new emulator -> Nexus 6p 23 -> Finish
# add to ~/.bash_profileexport ANDROID_HOME=$HOME/Library/Android/sdkexport PATH=$ANDROID_HOME/tools:$PATHexport PATH=$ANDROID_HOME/platform-tools:$PATHsource ~/.bash_profile;android update sdk; -
Install Android SDK build-tools 24.0.1
-
Generate Android Keystore
keytool -genkeypair -dname "cn=Full Name, ou=Business Unit, o=Company, c=US" -alias release -keypass aaa111 -keystore release.keystore -storepass aaa111 -validity 10000keytool -list -v -keystore release.keystore
-
-
Genymotion [optional]
-
Install Virtual Box
-
Install Genymotion
-
Genymotion -> Add virtual device -> Google Nexus 6P - 6.0.0 - API 23 -> Next
-
-
-
#### Compiling: Show Console Logs
-
iOS Simulator
-
cordova run ios;
-
Safari -> Preferences -> Advance -> Show Develop menu in menu bar
-
Safari -> Develop -> Simulator -> index.html -> Console
-
May need to unplug and replug device
-
May need to open Xcode and update provisioning profile
-
-
iOS Xcode
-
cordova plugin add cordova-plugin-console;
-
cordova build ios;
-
Xcode -> APP_LOCATION/platforms/ios/APP_NAME.Xcodeproj
-
Xcode -> App -> General -> Signing -> Team
-
Xcode -> Product -> Run
-
Xcode -> View -> Debug Area -> Activate Console
-
-
Android Device
-
Plug device in
-
cordova run android;
-
Chrome -> chrome://inspect/#devices -> Console
-
-
Android Genymotion
-
Genymotion -> Start
-
cordova run android;
-
Chrome -> chrome://inspect/#devices -> Console
-
-
-
#### Compiling: Updating the Branch SDK
# terminalcordova plugin remove io.branch.sdkcordova plugin remove branch-cordova-sdk<!-- config.xml --> -
#### Compiling: Incompatible Plugins
-
The following plugins will not work with the Branch SDK
-
-
#### Compiling: Errors
-
error
ORIGINAL EXCEPTION: Branch is not definedReferenceError: Branch is not defined-
Branch opens and installs your app. You cannot simulate Branch in the desktop browser
// Ionic 2/3 - running on browser instead of deviceif !platform returnBranch// Ionic 2/3 - missing Branch importdeclare var Branch
-
-
error
** ARCHIVE FAILED **The following build commands failed:Check dependenciesError: Error code 65- Open app in
Xcode
and launch from there (to select aProvisioning Profile
)
- Open app in
-
error
An invalid value 'XC com eneff branch cordova_testbed' was providedNo profiles- Don't use
cordova
,hyphens
(Android), orunderscores
(iOS) in your bundle id (widget id)
Error: Error code 1- Add
<preference name="android-minSdkVersion" value="16" />
to yourconfig.xml
- Don't use
-