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.
This article explains the flow for integrating OneLink-based attribution links into your Amazon Web Services Simple Email Solution (Amazon SES) based email system in order to seamlessly deep link from emails. The integration utilizes Amazon SES's support for Universal Links on top of the branded click recording domain.
- AppsFlyer iOS SDK version 4.9.0
- AppsFlyer Android SDK version 4.9.0
Setting up Amazon SES
In case of any issues with Amazon SES account setup, please open a ticket for 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 (e.g. click.example.com).
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:
- User opens an email
- 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.
- Associate the click recording domain in Xcode:
- 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:@[@"click.example.com"]];
- 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
onAppOpenAttributionAPI for deep link logic execution.
Step 5: Configuring link for email campaigns
- Create OneLink template for your email campaigns
- Create Branded link
- Run the following command: host <your click subdomain>
For instance, if your domain is example.com, and the subdomain is click, the command should be: host click.example.com
Save the output of the command.
- Contact your AppsFlyer CSM or send an email to email@example.com with the following information to complete the configuration:
- The output of the host command
- App ID
- OneLink template name
- 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 esplinks.appsflyer.com to your subdomain as follows:
Creating emails and testing links
Step 7: Sending your first email
- When creating the OneLink URL, make sure to URL-encode all parameter values
- 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.
- Place the OneLink URL in the email you are creating in Amazon SES Code Editor or Design Editor.
- 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.
https://example.onelink.me/abcd?pid=Email&c=Spring_Newsletter&is_retargeting=true& af_dp=testapp://path/to/content&af_web_dp=https://www.example.com/path/to/content& af_ios_url=https://www.example.com/path/to/content&af_android_url=https://www.example.com/path/to/content
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 the AppsFlyer dashboard, attributed to the provided media source and campaign
- A click appears in Amazon SES's data