You are here:
Using iOS Universal Links in Email Studio
The iOS universal link feature configures whether links in your Email Studio messages open in a previously installed iOS app or in a browser.
In this topic:
- Implement iOS Universal Links
- Test iOS Universal Links
- Force iOS Links to Open in a Browser
Implement iOS Universal Links
To use universal links, you need the Sender Authentication Package (SAP) and an SSL certificate for the click domain. Each AppID and click domain pair that you use must be unique across all active apps in your business units. Universal links work only with HTTPS connections.
-
Modify your iOS app to accept universal link requests.
-
Add your branded click domain link entry to the
com.apple.developer.associated-domains entitlement. Make sure that the entry
includes the applinks prefix.
For example, an entry for click.example.com looks like this:
"applinks:click.example.com". -
Use the webpageURL property on the NSUserActivity object provided by iOS to
determine whether the click originates from the click domain that Marketing Cloud
Engagement uses.
The property appears like this wrapped URL:
https://click.example.com/?qs=hxdwbvpwueDMUFuWaNEhguEVdMLWCPTsutky0fd - Verify that the incoming URL is from Engagement by performing a GET call to unwrap the first URL.
-
If your emails are using Einstein Content Selection, add another GET call to
unwrap the intermediate Einstein content selection URL.
Example of an Einstein Content Selection intermediate URL:
https://ecs.us.sfmc-einstein.com/einstein/api/block/44644947... - After the URL is fully unwrapped, retrieve the URL’s destination.
- To parse the logic from the unwrapped URL and navigate to the correct view in the app, call a method.
This pseudocode illustrates the steps for accepting a universal link request. This method accommodates wrapped URLs from Marketing Cloud Engagement that can use the Einstein Content Selection app. It adds a redirect before reaching the original URL. The pseudocode refers to a function calledNetworking.getUnwrapped(), which retrieves the final URL by issuing a GET request to the URL and retrieving the value of itslocationheader.-
public func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool { // Example: Double wrapped url if let url = userActivity.webpageURL { if url.absoluteString.contains("sfmc-einstein") { Networking.getUnwrapped(url) { result in switch result { case .success(let singleUnwrappedURL): // first unwrapped link; will need to be unwrapped again Networking.getUnwrapped(singleUnwrappedURL) { result in switch result { case .success(let doubleUnwrappedURL): // Final unwrapped link to be parsed by app parseAndRedirect(with: doubleUnwrappedURL) case .failure: print("Failed to get 2nd unwrapped link") } } case .failure: print("Failed to get 1st unwrapped link") } } } } return true }
-
Add your branded click domain link entry to the
com.apple.developer.associated-domains entitlement. Make sure that the entry
includes the applinks prefix.
-
Configure the iOS universal link for Email Studio. These settings are used to deploy
the apple-app-site-association (AASA) file to a click domain.
- In the Email Studio Admin section, under Deep Linking, enter your AppID. The AppID is your application’s alphanumeric teamID followed by the bundleID.
- To force a mobile web experience for profile and subscription centers, select Exclude Profile and Unsub Center.
- Save the entry.
-
The order of entries affects the order of entries in the AASA file. To change the
ordering, delete the entries and enter them in the correct order.
Your first entry must be a test or staging app.
- After it’s configured, your click domain serves an AASA file. The AASA is https://click.{your-sap-domain}/.well-known/apple-app-site-association.
-
{ "applinks": { "apps": [], "details": [ { "appID": "ABC123EFG.com.staging.app", "paths": [ "NOT /subscription_center.aspx*", "NOT /profile_center.aspx*", "NOT /unsub_center.aspx*", "NOT /u/*", "/*" ] }, { "appID": "HJK456LMN.com.production.app", "paths": [ "NOT /subscription_center.aspx*", "NOT /profile_center.aspx*", "NOT /unsub_center.aspx*", "NOT /u/*", "/*" ] } ] } }
Test iOS Universal Links
Before testing links with your own mobile app, add the domain to the iOS app entitlement. Using the same click domain for development and production versions doesn’t allow differentiation between test data and production data.
- To test links, send email messages to development versions of your app.
- For all versions of your app to use the feature, include all applicable AppID values in your association file. If you only use a single AppID value, include that value only in local builds of your app for testing purposes.
- Make sure that you use SSL certificates for all sandbox or testing accounts for Marketing Cloud Engagement.
Force iOS Links to Open in a Browser
Create a tag that prevents iOS universal links from opening the link in your mobile app. Instead, this tag excludes the universal link and forces your mobile device to open the link in a browser window.
- Open the HTML version of the email message containing the link.
-
Add
mc-deep-link="false"to the<a>tag of the link, like this example:<a href="https://www.example.com" mc-deep-link="false">Your Link</a> - Save the email message.

