Amazon SES integration with AppsFlyer

At a glance: Amazon SES, an email delivery and analytics platform, embeds AppsFlyer OneLink within emails. Email recipients who click the link are deep linked into your app.


ESPs (Email Service Providers) can be excellent sources for segmented user traffic.

One of the problems with ESPs is recording clicks while still persevering deep linking functionality. ESPs wrap the deep linking URL with their own ESP's click recording domain. This procedure oftentimes breaks the iOS Universal Links process.

However, with ESPs that support Universal Links on top of their click recording domain, deep linking and click recording can still be performed.


  • AppsFlyer iOS SDK version 4.9.0

Setting up Amazon SES


In case of any issues with Amazon SES account setup, open a ticket for the Amazon SES support team.

Step 1: Verifying domain and email in Amazon SES

In order to use Universal Links with Amazon SES, you need to create a dedicated click recording domain and set a subdomain (for example,

This can be done by purchasing a designated domain or using your own domain.

Amazon SES verification guides:

Step 2: Configuring custom domains to handle redirects

HTTPS domains must be configured to handle open and click link redirects.

Step 3: Configuring Amazon SES to track clicks and opens

Set up Amazon Simple Notification Service (Amazon SNS) to send you notifications when:

  • A user opens an email
  • A user clicks a link in your email
  • Email bounces

Setting up AppsFlyer

Step 4: Configuring 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 must set up your app to deep-link and resolve Universal Links.

  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 see 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.

Step 5: Configuring link for email campaigns

  1. Create a OneLink template for your email campaigns.
  2. Create Branded link.
  3. Run the following command: host <your click subdomain>
    For instance, if your domain is, and the subdomain is click, the command should be: host
    Save the output of the command.
  4. Contact your AppsFlyer CSM or send an email to with the following information to complete the configuration:
    • The output of the host command 
    • App ID
    • OneLink template name
  5. AppsFlyer team will notify you when the configuration is complete.

Step 6: DNS configuration

After the configuration is complete, in your DNS provider add the CNAME to your subdomain as follows:

Subdomain CNAME

Creating emails and testing links

Step 7: Sending your first email

  1. When creating the OneLink URL, make sure to URL-encode all parameter values
  2. The following parameters are highly recommended to use:
    pid (media source) Use a media source that signifies this usage such as Email
    c (campaign) The name of the campaign you want to measure
    af_dp The deep link URI scheme you want to deep link your users into
    af_web_dp Where to redirect users clicking the link on a desktop
    af_ios_url Where to redirect users that don’t have the app when they click the link in an iOS device
    af_android_url Where to redirect users that don’t have the app when they click the link in an Android device
    is_retargeting For campaigns that retarget existing users, add is_retargeting=true.
  3. Place the OneLink URL in the email you are creating in Amazon SES Code Editor or Design Editor.
  4. At this stage, Amazon SES wraps the above link with the click recording domain that you set in the previous steps. Any click on the click recording domain will redirect to the OneLink attribution link.


For the sake of readability, URL parameters are not URL-encoded in this example.

Step 8: Testing your links

After steps 1-7 are completed, send yourself a test email. Verify that the following events take place:

  • If you have the app installed, the app should be invoked.
  • If the AppsFlyer SDK deep-linking APIs are implemented, you should be deep-linked into the relevant content.
  • A click appears in the AppsFlyer dashboard, attributed to the provided media source and campaign.
  • A click appears in Amazon SES's data.
Was this article helpful?