Skip to content




This guide will walk you through how to setup your email campaigns with Sailthru using Branch Universal Email to automatically convert your email links into multi-platform deep links

The basic integration involves four parts:

  1. Configure your ESP
  2. Activate integration and setup link behavior
  3. Configure your mobile app
  4. Updating the links in your email

Universal Email allows you to automatically convert your email links into multi-platform deep links that take users directly to content in the app on mobile devices, while still maintaining the same web experience for desktop and mobile users without the app.

When a link is clicked by a user without the app, it will route that user to the original web URL (including on desktop). When a link is clicked by a user with your app, it will direct that user into the relevant in-app content regardless of platform or email client.



This guide requires you to have already integrated the Branch SDK into your app.

To open the app directly on iOS 9.2+, you must configure your email integration and your app to support Universal Links in emails.

Contact your Branch Account Manager or at any time for assistance with the setup steps.

Configure your ESP

Setup a custom click tracking domain

  1. Add and verify a custom click tracking domain in the Domain section of your Sailthru account:


Adding a custom click-tracking domain

If you need help with setting up a custom click-tracking domain - please ask your account manager or request support at Sailthru.

Activate integration

Choose your email service provider

Navigate to the Universal Email section of the Branch dashboard. Select Sailthru and click Enable.

Branch turns the web URLs you put into your emails into Branch deep links, opening the app for users with your app installed to that same content in the app.


To do this, it must be possible to map your web URL content (e.g. a page with brown loafers at into a working deep link that takes users to brown loafers in the app. The Universal Email setup flow will attempt to automatically detect this mapping for you.

If you do not want to set this up yet, you can select No, just open to app homepage for now.


By default, email deep links will redirect users without your app to the same content on the web instead.


If you would like to send users to the App Store or another default you have specified in Link Settings, you can select Open to default redirects.


Checking your deep linking setup

If you chose not to set up deep linking to specific content within your app, then you can skip this step.


In this step, you will want to enter a web URL that corresponds to a specific screen within your app. In other words, the webpage should have content that also exists in your app. If you do not know whether your web content also exists in-app, try any URL other than your website homepage. Some examples:

  • A product page, like a page with brown loafers
  • An article
  • A content page, like a video or image

Once you choose one and click Submit, meta tags that can be used for deep linking will be retrieved from your webpage. You will see a result indicating the mapping between your web content and your app content. For a full explanation of the tests run on this page and the possible results, check out the support section.

We couldn't determine your deep linking setup

If an app deep linking scheme that maps to your web content cannot be successfully detected, you can configure your settings manually, or you can reach out to your Branch account manager or support for assistance.


We will help you set up one of the following methods:

If you use unique key/value data as deep link values:

  1. Recommended: Hosted deep link data: You can host your deep link data on your website with a metatag that looks like this <meta name="branch:deeplink:my_key" content="my_value" /> where my_key and my_value will become a key value pair in deep link data. For each web URL, Branch will look for those tags and embed the deep link data (if found) into the deep link. Note that Branch also accepts App Links tags for deep linking. For more details, please read Hosted Deep Link Data.
  2. As query parameters: Simply append query parameters on to your web url and Branch will take those parameters and put them in deep link data.

If you use your web URL as a deep link value:

  1. URL path: If you use the path of your web URL as your $deeplink_path value, or any other deep link value, then the configuration will automatically take the path of the URL and put it in deep link data.
  2. Full URL: If you use the full web URL as your $deeplink_path value, or any other deep link value, then the configuration will take the entire URL and put it in deep link data.

Host deep link data for more than just emails

The Branch Quick Link creator also scrapes your web URL for deep link data to make link creation even easier. Hosting Deep Link Data on your website will make using Branch products easier in future.

Deep linking settings for email

The following are all the possible settings you can configure for deep linking with email.

Setting Example Link Data Result
Open the app homepage No settings configured to generate deep link data for email; email links will route to the app homepage.
Open to specific app content Deep link to specific app content based on one or more of the following settings.
Translate query parameters on URLs into Branch link data URL: product_id: 123456
Translate web URL into Branch link data:
Full URL for key ______
Key: $canonical_url
Translate web URL into Branch link data:
URL path for key ______
Key: $deeplink_path
$deeplink_path: shoes/brown-loafers
Retrieve hosted deep link data from website and translate into Branch link data URL:
Meta Tags: <meta name="branch:deeplink:product_id" content="123456" />
product_id: 123456
Strip protocol (http:// or https://):
from $deeplink_path
from $ios_deeplink_path
from $android_deeplink_path
Note: Typically used with one of the other settings.
Other Settings: Translate web URL into Branch link data: Full URL for key $deeplink_path
Translate query parameters on URLs into Branch link data from parameter ______ to key ______
Note: Not configurable in the UI. Contact support to use this setting.
Parameter: utm_content
Key: category
category: shoes
Setting Description
Open to specific web content Route to the original URL specified in the email.
Open to default redirects Route to defaults specified in Link Settings.

Tell us your click tracking domain

You can retrieve your click tracking domain from the Domain section of your Sailthru account. If you have not added a custom click tracking domain yet, follow the instructions here.


Configure your app for your click tracking domain

You can send ESP configuration to your development team


In this prompt, enter the email of someone on your team who is qualified to modify your iOS app, and then click Send. They will complete the technical setup steps below.

Click Next to proceed to Validate and test the integration

Upload your AASA file

Sailthru will host an Apple App Site Association (AASA) file for you, so that your click tracking domain appears to Apple as a Universal Link, and the app will open and deep link.

To set up your AASA file, download the AASA file from the email you received from Branch, and follow the instructions provided by Sailthru for setting up the HTTPS certificates.

Validate and Test


The last step of the Universal Email setup flow validates whether you have completed all necessary steps and whether an engineer on your team has completed the integration steps. You will also see recommendations for how to improve your email integration.

Once it's done the AASA file and SSL certificate - required for Universal Links - specific to that domain will be generated.

The conversion to Branch links will only work when your links are wrapped in your click tracking domain. To test links without wrapping, please generate a test link on the Verification step of email onboarding, also accessible by clicking the gear icon for your ESP on the email page.


Configure your mobile app

Send your AASA file to your ESP


Your AASA file must be uploaded to your click tracking domain by your email service provider. Your ESP account manager will do this for you - enter their email and click Send, and they will receive an email with the file and request to upload.

Technical setup

The following app changes ensure that your email integration supports Universal Links. You will need access to your app code to make these changes.

You should have received an email from Branch with your ESP's click tracking domain. If not, likely you or someone on your team still needs to complete the Universal Email setup flow.

How does it work?

Apple recognizes the click tracking domain as a Universal Link, and opens the app immediately without the browser opening. Once the app has opened, Branch will collect the referring URL that opened the app (at this time, it will be the click tracking url). Inside the app, Branch will robotically “click” the link, registering the click with the ESP, and returning the Branch link information to the Branch SDK inside the app. This information is then used to deep link the user to the correct in-app content. See the Support section for more information.

Add your click tracking domain to your Associated Domains

To enable Universal Links on your click tracking domain, you'll need to add the click tracking domain to your Associated Domains entitlement.

  1. In Xcode, go to the Capabilities tab of your project file.
  2. Scroll down and enable Associated Domains if it is not already enabled.


  3. Copy your click tracking domain from the email you received from Branch, or retrieve it from your ESP's settings.

  4. In the Domains section, click the + icon and add your click tracking domain. For example, if your click tracking domain is, add an entry for


Having trouble or new to Universal Links?

Follow these instructions for more details on enabling Universal Links in the Branch dashboard and in Xcode.

If you have links to content that exists only on web, and not in the app (for example, a temporary marketing webpage that isn't in the app) then this code snippet will ensure all links that have not had the deep linking script applied will open in a browser.

You should add this code snippet inside the deep link handler code block. Note that this uses query parameter $web_only=true. This should match the query parameter on the web URL you enter in the email.

[branch initSessionWithLaunchOptions:launchOptions andRegisterDeepLinkHandler:^(NSDictionary *params, NSError *error) {
  // params are the deep linked params associated with the link that the user clicked before showing up.
  if (params[@"$3p"] && params[@"$web_only"]) {
            NSURL *url = [NSURL URLWithString:params[@"$original_url"]];
            if (url) {
                [application openURL:url]; // check to make sure your existing deep linking logic, if any, is not executed, perhaps by returning early
  } else { 
    // it is a deep link
    GDLog(@"branch deep link: %@", [params description]); 
    [self handleBranchDeeplink:params];

Using Universal email

Once you’ve completed the one time setup steps, it’s time to send your first email.

This guide will identify which web links you'd like to open the app and deep link, as well as convert them to Branch links.

There are a few different ways you can create Branch links that are compatible with Universal Email + Sailthru. You will need to replace the web URLs in your templates with these. To create Branch links, you can either:

  1. Automatically populate emails with content via Zephyr
  2. Making regular Branch links compatible with email
  3. Create email links via API without changing your email templates
  4. Convert all web links in your email to deep links

Automatically populate emails with content via Zephyr

Sailthru allows you to automatically populate emails with content via Zephyr. This means that you can create a template once, then have all subsequent emails automatically configured to convert normal web URLs into deep links.

The Sailthru integration requires you to add code in two places:

  1. At the top of an email template
  2. Immediately before a hyperlink
Prepare your template

At the top of each email template, you should simply copy and paste the following snippet. It specifies a variable that is used to automatically contruct deep links, branch_base_url. This snippet will be provided by your Branch Account Manager.

Copy the below snippet and paste it above the <head> tag:

{branch_base_url='BASE URL FROM BRANCH'}

Enter the base url provided by your Branch account manager.



Before each hyperlink, you’ll need to include a short amount of code. Put the original link (which will automatically be converted to a deep link) on the first line of the code snippet.


<a href="ORIGINAL URL">Click me</a>



{*Branch deeplink builder*}{deeplink=branch_base_url + "&%24original_url=" + u(link)}{*end Branch deeplink builder*}

<a href="{deeplink}">Click me</a>



{*Branch deeplink builder*}{deeplink=branch_base_url + "&%24original_url=" + u(link)}{*end Branch deeplink builder*}

<a href="{deeplink}">Click me</a>


Using Branch Links with Zephyr

The Branch deep link script also works with Sailthru's Zephyr personalization language. Here's an example with the correct syntax.


{*Branch deeplink builder*}{deeplink=branch_base_url + "&%24original_url=" + u(link)}{*end Branch deeplink builder*}

<a href="{deeplink}">Click me</a>

Be sure to add "$3p":"e_xx" to the deep link data of any links you use in email to ensure Universal Link and click tracking works as expected.

To create email links via API, please use the instructions on how to create links via API, but include the following key value pairs in your call:

  1. "$3p":"e_xx" This is required for Universal Link and click tracking functionality.
  2. "$original_url":"{{your web url URI encoded}}" For each piece of content, include a URI encoded version of your content's web URL. You can also add deep link data as query parameters on that web URL. This ensures accurate Content Analytics reporting. Example: "$original_url":""

We have provided a way of easily converting web links to Branch links, as well as an example. The example takes an html email (as a string) and applies the script to it.

Here is the script:

var crypto = require('crypto');
module.exports = function(original_url, branch_base_url) {
    if (!original_url) { return new Error('Missing original_url'); }
    if (typeof original_url != 'string') { return new Error('Invalid original_url'); }
    if (!branch_base_url) { return new Error('Missing branch_base_url, should be similar to'); }
    if (typeof branch_base_url != 'string') { return new Error('Invalid branch_base_url'); }

    return branch_base_url + '&%24original_url=' + encodeURIComponent(original_url);

Here is how links look before and after (the latter being a Branch deep link).

  1. Before:
  2. After:

Note that these are simplified examples, not actual demo links.

With your email service provider, all email links will open the app by default. In order for your app to know that the email link should bounce to web after opening the app, add %24web_only%3Dtrue to your links as a query parameter, for example:

<a href="" >Link to your app!</a>

Handle links for web-only content

Make sure you have completed the technical setup steps to handle web-only links within your app.


Curious about how email works and more FAQ? Visit our general email support page.