-
Notifications
You must be signed in to change notification settings - Fork 20
DeepLink
In the context of mobile apps, deep linking is a term which describes the flow when a user tap on a link opens the mobile application instead of the page in a browser.
-
Enable HTTPS on existing link domains by adding certificates
The first task here is to enable HTTPS on your existing link domains. You should also add certificates to them.
-
Serve JSON files on the link domain
Now, you should provide JSON configuration files to these link domains, which create the direct relationship with the apps. These files are checked at app install. For more information, check here for iOS and here for Android.
-
Enable link domains in the app
- for iOS, the
com.apple.developer-associated-domains
should be added as anappLink
. The app will receive the URL as an activity. For more information, read the iOS documentation for Support of Universal Links - for Android, an intent should be added with the link domain. For more information, see the Android documentation for creating Intent Handlers
- for iOS, the
-
The well set application installed on the device already
When Emarsys provides a link which is trackable (usually in emails), and the user clicks on it, the click can be reported to Emarsys by the SDK.
Note
Deep linking or deep link tracking doesn't mean that any screen/content will be automatically opened in the application. If it's a case for you, you should do it manually.
-
All of the points above are set correctly
-
Add deep links as trackable links in email
The next step is using the UniversalLinks in iOS and the URL schemes in Android as trackable links in emails.
-
Process links in the app
-
for iOS in order to track deep links with the Emarsys SDK, you need to call
trackDeepLink
in your AppDelegate'sapplication:continueUserActivity:restorationHandler:
method.Objective-C
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *__nullable restorableObjects))restorationHandler { return [Emarsys trackDeepLinkWith:userActivity sourceHandler:^(NSString *source) { NSLog([NSString stringWithFormat:@"Source url: %@", source]); }]; }
Swift
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool { return Emarsys.trackDeepLink(with: userActivity, sourceHandler: { url in if let source = url { print(source) } }) }
The (BOOL) return value of
Emarsys.trackDeepLink
indicates whether the UserActivity contained a Mobile Engage email deeplink and whether it was handled by the SDK.The first parameter is the UserActivity that comes from the AppDelegate’s
application:continueUserActivity:restorationHandler:
method.The second parameter is optional, it is a closure/block that provides the source Url that was extracted from the UserActivity.
For more information, read the relevant iOS documentation.
-
for Android, Emasrys SDK automatically handles deep link tracking with most use cases, with only one exception: manual tracking is needed when your Activity has onNewIntent overriden. In that case, you can track the deep link using the
trackDeepLink
method like below:Java
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); Emarsys.trackDeepLink(this, intent, new CompletionListener(){ @Override public void onCompleted(@Nullable Throwable errorCause) { ... } ); }
Kotlin
override fun onNewIntent(intent:Intent) { super.onNewIntent(intent) Emarsys.trackDeepLink(this, intent) {throwable -> ...} }
-
In the context of mobile apps, there is a common mistake to use the deep link term for every event/trigger that somehow connects with the application.
Using the Emarsys SDK's rich notification feature the customer can send notification which contains application event as (default)action when user triggers it the registered push event handler will be called with the given name and payload parameters.
Using the Emarsys SDK's rich notification feature the customer can send notification which contains an url as (default)action when user triggers it the url will be opened outside of the application.
Using the Emarsys SDK's in app messaging feature the customer can set action in the inApp message which contains a name a payload and when being triggered by the user the registered inApp event handler will be called by the SDK with the given name and payload parameters.
Using the Emarsys SDK's in app messaging feature the customer can set action in the inApp message which contains an url and when being triggered by the user the url will be opened outside of the application.
On the Mobile Engage / Push page there is an option to set custom data fields which are traveling in the push payload and which are extractable when the push message arrives into the application.