Testing Branch functionality can be challenging. Many functions require two parties to complete, and some tests can inadvertently affect your analytics data. Here are a few workarounds to help you test Branch features to your satisfaction.
Branch maintains both a Live environment and a Test sandbox for every app. You can think of these as separate apps in the Branch system that are simply available from the same Dashboard for convenience. There is no data crossover between the Live environment and the Test sandbox, both offer identical configuration options, and you use different Branch keys to access each one. Links respect the configuration settings of the Branch key under which they are created.
- Links created with your Live key will begin with
- Links created with your Test key will begin with
Universal Links in the Test environment
To enable Universal Link behavior for links created with your Test key, you need to add the following Associated Domains entries:
See here for more detailed instructions.
Toggling between these two modes on the Branch dashboard is simple:
Caution: Configuring the Test App
Using the Test environment in your app is easy:
- Go to Settings
- Make sure the toggle switch is in “Test” mode
- Grab the Branch Key (it will start with
- Simply replace the Live key in your app with this one (but be sure to switch it back before release!)
For more advanced implementations, you may want to specify keys for both Test and Live environments (for example, if you are building a custom switch to automatically select the correct key depending on compiler schemes).
Open your Info.plist file in Xcode, change the
branch_key entry to a Dictionary, and create two subentries for your keys:
To trigger the reference to the Test key, you simply need to call
getTestInstance at runtime as shown below:
At any time after you create a link, you can see all the information about the that link by appending
?debug=1. Make sure you are logged into the dashboard, are on the correct app, and that the proper Live or Test environment is selected. The link debugger allows you to select a platform and browser, and see what will happen on link click. The debugger will also show you all of the data associated with that specific link.
Branch intentionally adds a lot of restrictions to prevent
install events from being triggered on app updates and reinstalls. Of course this can make it a challenge to simulate fresh installs while testing, so we have created a debug mode to help you manually override these restrictions.
To enable this mode in your test builds, add a
setDebug call to your AppDelegate.m file after you create the Branch singleton, but before you call
initSession. Your code will end up looking something like this:
Branch *branch = [Branch getInstance]; [branch setDebug]; [branch initSession.....
Caution: Disable debug mode before release!
Make sure to disable debug mode before releasing your app. You can do this simply by removing the code you added.
After debug mode is enabled, do the following steps to verify your new installs are being tracked as expected:
- Uninstall your app from your device
- On your device, open any Branch link
- Re-install your app
- Confirm an install event occurs by looking through the SDK’s session initialization callbacks