Universal Links for Email Engagement
Learn how to set up Apple Universal Links and Android Universal Links.
Overview
Mobile users are increasingly engaging with email on their devices. When you include a link to your website in an email and have a corresponding mobile app, you can ensure mobile device users are directed to your app rather than a web browser.
This is achieved through Universal Links. Universal links are special URLs that open in the users' web browser, mobile browser, or mobile app based on their device. They enhance the user experience by seamlessly redirecting to the appropriate destination.
For example, consider Amazon. When Amazon sends promotional emails with links to products, it uses universal links. If a recipient clicks the link on their mobile device and has the Amazon app installed, the app opens directly to the product page. If the app isn't installed, the link opens in the mobile browser. This method ensures a smooth transition for users, improving engagement and making it easier for them to continue shopping seamlessly from email to app.
Benefits
Here are the key benefits of Universal Links.
- Enhanced User Experience: Users are directed to the most appropriate destination, providing a seamless transition from email to app or web.
- Increased Engagement: Engagement rates are higher than web redirects by taking users directly to the app.
- Better Conversion Rates: Apps often provide a more optimized and personalized experience, leading to higher conversion rates.
- Streamlined User Journey: Users avoid the extra steps of navigating through a web browser, making the process more efficient and enjoyable.
- Improved Tracking and Analytics: Universal links can track clicks and user behavior, providing valuable insights for marketing strategies.
Prerequisites for Setting Up Universal Links
Before you can implement universal links in your email campaigns, the following requirements must be met:
- Create JSON File for:
For iOS
Create an "apple-app-site-association" JSON File: This file is essential for defining the association between your application and the universal links. Refer to Apple’s iOS Developer Documentation to learn how to create this file.
For Android
Create a "digital asset links" JSON File: This file is necessary to establish the connection between your application and the universal links. Refer to Google’s Android Developer Documentation to set up this file.
- Configure Intent Filters in the Android Manifest File: Modify your app's
AndroidManifest.xml
to include the necessary intent filters for universal links. Refer to Android Developer Documentation to configure the intent filter. - Host the JSON Files: The
apple-app-site-association
and digital asset links JSON files must be hosted on an HTTPS web server or a Content Delivery Network (CDN). - Submit Files to Netcore Support: After completing the steps above, raise a support ticket on the Netcore CE dashboard and share the
apple-app-site-association
anddigital asset links
JSON files. - Receive and Integrate URL Tracker: Netcore’s support team will provide you with a URL tracker. Add this URL tracker to the associated domains in your application configuration.
Configure Universal Links
- For iOS: You must include your branded link subdomain in your application's Associated Domains section. Customize your subdomain using the custom return path in the advanced settings during setup.
Example: Add an entry forapplinks.example.com
in your application's associated domain configuration. - For Android: To redirect to the app in the desired activity, you need to add specific intent filters in your
AndroidManifest.xml
.
<activity android:name=".TestingActivity"
android:exported="false">
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="panela.alamodelabel.in" />
</intent-filter>
</activity>
Handle the deep links on the same activity, whichever is desired to handle deep links.
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
handleDeepLinks(intent)
}
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
handleDeepLinks(intent)
}
private fun handleDeepLinks(intent: Intent?) {
intent?.let { intent1 ->
val action = intent1.action
val encodedURL = intent1.dataString
if (Intent.ACTION_VIEW == action && encodedURL != null) {
Log.d("App Link", encodedURL)
Thread {
try {
val originalURL = URL(encodedURL)
val urlConnection = originalURL.openConnection() as HttpURLConnection
urlConnection.instanceFollowRedirects = false
val resolvedURL = URL(urlConnection.getHeaderField("Location"))
Log.d("App Link", resolvedURL.toString())
} catch (ex: MalformedURLException) {
Log.e("App Link", Log.getStackTraceString(ex))
} catch (ex: IOException) {
Log.e("App Link", Log.getStackTraceString(ex))
}
}.start()
}
}
}
Resolving Netcore Click Tracking Links
Handling Click Tracking Links in Your Application
Once your application is configured to open Netcore click tracking links, it is important to ensure that these links are handled properly within your application. The links your applications receive are Netcore encoded so resolving them correctly is necessary to achieve the following:
-
Trigger the 'click Event in Your Netcore Account: This allows you to gather accurate statistics and track user interactions.
-
Determine the Original URL: Identifying the original URL helps direct the user to the correct part of your app.
Implementing Link Resolution
The following code examples illustrate the logic required to resolve and track Netcore click tracking links within your app.
iOS Example: Resolving Links Using Swift
Use the NSURLSession
to resolve the link and handle the response:
let netcoreURL = URL(string: "https://your-netcore-encoded-url")!
let task = URLSession.shared.dataTask(with: netcoreURL) { data, response, error in
guard error == nil else {
print("Error resolving link: \(error!)")
return
}
if let httpResponse = response as? HTTPURLResponse, httpResponse.statusCode == 200 {
// Successfully resolved the link
if let originalURL = httpResponse.url {
// Trigger the click event and navigate to the correct part of your app
print("Original URL: \(originalURL)")
}
}
}
task.resume()
Android Example: Resolving Links Using Java
Use HttpURLConnection
to resolve the link and handle the response:
try {
URL netcoreURL = new URL("https://your-netcore-encoded-url");
HttpURLConnection connection = (HttpURLConnection) netcoreURL.openConnection();
connection.setInstanceFollowRedirects(false);
int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
// Successfully resolved the link
String originalURL = connection.getHeaderField("Location");
if (originalURL != null) {
// Trigger the click event and navigate to the correct part of your app
System.out.println("Original URL: " + originalURL);
}
}
} catch (Exception e) {
e.printStackTrace();
}
Implementing the above code ensures your app can properly handle Netcore click-tracking links. This includes triggering click events for accurate tracking and resolving the original URL to guide the user to the appropriate section of your application.
Updated 5 months ago