Salesforce Marketing Cloud


At a glance: This article explains how to integrate OneLink URLs into a Salesforce Marketing Cloud (SFMC) account in order to seamlessly deep link from emails. The flow utilizes SFMC support for Universal Links on a branded click-recording domain.

ESP (Email Service Providers) are excellent sources for segmented user traffic. However some ESP, and this is a common ESP issue, don't perform correct attribution and deep linking.

ESPs wrap a deep-linking URL with their own ESP click-recording domain. This procedure often breaks the iOS Universal Links process. The good news! There are ESPs that support Universal Links on their click-recording domain, so deep linking and click-recording can be performed.


  • AppsFlyer iOS SDK version 4.9.0 

For iOS Universal Links you should perform the following in your SFMC environment:

  • Purchase and implement Sender Authentication Package (SAP)
  • Purchase an SSL Certificate (also known as SSL Configuration) and submit an SSL Request Form
    * To obtain Sender Authentication Package and SSL Certificate reach out to your Salesforce Account Representative or submit a deliverability support case via Salesforce Help.

SFMC setup

Steps 1-4 are needed to support iOS deep linking.

Part 1: Set your click-recording domain in SFMC

To set a click-recording domain, follow SFMC official guides for:

Step 2: Upload your SSL certificate to SFMC

In order for iOS Universal Links to work properly, your click-recording domain must include your domain’s SSL certificate that should be installed in your SFMC account. Instructions on setting your SSL certificates can be found in SFMC official guide.

Step 3: Set deep linking in SFMC

To enable deep linking from SFMC emails:

  1. Login to your SFMC account, and go to the Email Studio view
  2. Click on the Admin tab
  3. In the side menu, click on deep linking. In this view, you can configure new deep link integration with your app, or modify existing ones.

  4. To create a new configuration, click the Create button and enter your AppID. The AppID value is a combination of your Apple developer team ID and the Bundle ID. Both of these values can be retrieved from your Apple Developer account.


    Given the Team ID prefix 5UABCDFGH, and the Bundle ID, the following value should be entered:


  5. Your set up of universal links and deep linking is completed once SFMC sets up the Apple App Site Association (AASA) file. This process may take a few hours. You can see your generated file using the following URL:

Step 4: Configure your AppsFlyer SDK


If you haven’t already done so, make sure you have configured your app to support deep linking with OneLink.

After configuring your click-recording domain to support Universal Links as described previously, you need to set up your app to deep link and resolve the Universal Link.

  1. Associate the click-recording domain in Xcode:

  2. Provide the click-recording domain to the SDK API setResolveDeepLinkURLs. This API needs to be called before SDK initialization. For more information please refer to SDK documentation here.
    [[AppsFlyerTracker sharedTracker] setResolveDeepLinkURLs:@[@""]];
  3. When the app is invoked due to a click on the Universal Link, the AppsFlyer SDK resolves the deep link and extracts the underlying OneLink. All deep link parameters are then propagated into the onAppOpenAttribution API for deep link logic execution.

Creating custom attribution links and running campaigns

This section explains how to create custom attribution links from OneLink, then use them in campaigns.

Create custom attribution links using Salesforce 

Use the AppsFlyer app to directly create OneLink links via Salesforce. 

Integrate the AppsFlyer app in Salesforce


Install and integrate the AppsFlyer app in Salesforce. Thereafter, all your Salesforce users are connected.

Install the AppsFlyer app in Salesforce

  1. Log in to your Salesforce account.
  2. Go to Salesforce AppExchanage.
  3. Search for and install the AppsFlyer app.

Integrate the AppsFlyer app with Salesforce

  1. Open the AppsFlyer app in Salesforce.
  2. Authenticate using your AppsFlyer credentials.


    Currently, it isn't possible to log in using SSO providers such as Google. Contact your CSM or send an email to for help with authenticating using AppsFlyer credentials.

  3. Copy the token and Salesforce EID to a text file.
  4. Log in to your AppsFlyer account.
  5. In the navigation menu, click Integrated Partners.
  6. Search for and select SFMC.
  7. Under the Integration tab, complete the Token and SalesForce EID fields.
  8. Click Save integration.

Validate the AppsFlyer app integration

  1. Go to Salesforce.
  2. Hover over AppExchanage and select the AppsFlyer app.
  3. Click Validate to complete the AppsFlyer app integration.

Create custom attribution links in Salesforce using the AppsFlyer app

  1. In Salesforce, open the AppsFlyer app.
  2. Click Add OneLink.
  3. Complete these fields: Link Name, Base URL, and Attribution Link Parameters.
    • Base URL is the OneLink configuration URL.
    • Use it to create custom attribution links.
    • Example:
  4. (Optional) To add a parameter to a custom attribution link, click Add Parameter. See the list of recommended parameters.
  5. Click Generate Link.

Send your first email

Use custom attribution links created in Salesforce.

  1. In Salesforce Email Studio, create a new template or email.
  2. Click the Edit icon, the Content tab, then select Blocks.
  3. Scroll down to find AppsFlyer Button CB or AppsFlyer Image CB.
  4. Drag the image/button into the body of the email.
  5. Click the image/button to edit.
  6. In the Title field, name the image/button.
  7. Select a OneLink link.
  8. Save the email and send it.

Use attribution links created in AppsFlyer

  1. Create a custom attribution link manually or on the Link Management page.
    • URL encode all parameter values when creating a OneLink. 
    • These are highly-recommended parameters:
      pid  media source Representative media source such as email.
      c campaign name Campaign that will be attributed.
      af_dp deep-link URL  Deep-link redirect for users.
      af_web_dp desktop redirect Redirect for desktop users.

      Redirect for iOS-devices users who don't have the app installed.

      af_android_url   Redirect for Android-device users who don't have the app installed.
  2. Copy the link into the email created in Salesforce Email Studio.
    • Now, the Salesforce Marketing Cloud wraps the link with the click-recording domain that was previously set.
    • Any click on the click-recording domain redirects to the OneLink attribution link.


For readability purposes, the URL parameters are not URL encoded:

Test your links

After following all the required steps mentioned above, creating the appropriate OneLink URL, and placing it in an email, send yourself a test email.

What should you expect?

If you have the app installed, the app should be invoked. If the relevant AppsFlyer SDK deep linking APIs are implemented you should be deep linked into the relevant content.
In addition, a click should appear in both the AppsFlyer dashboard, attributed to the provided media source and campaign, and also in Salesforce's data.

Was this article helpful?