Custom Action Handling

Deeplink callback in InApp

It is used to navigate users directly to a specific location or content within a mobile app.

Default Handling

By default, SDK passes the deep link callback to the AppDelegate/SceneDelegate method .

If your application is running below iOS 13, then deep link callback is received in the AppDelegate methods

Swift Objective-C
import UIKit

// Custom Scheme Link
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) - Bool {
  
  //Call only if MoEngageAppDelegateProxyEnabled is NO in Info.plist
  MoEngageSDKAnalytics.sharedInstance.processURL(url) 
}

// Universal Links
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) - Void) - Bool {
  if userActivity.activityType == NSUserActivityTypeBrowsingWeb ,
    let incomingURL = userActivity.webpageURL{
    //Call only if MoEngageAppDelegateProxyEnabled is NO in Info.plist
    MoEngageSDKAnalytics.sharedInstance.processURL(incomingURL) 
  }
  //rest of the implementation
  return true
}
    

If your application is above iOS 13, then a  deeplink callback is received in the below  SceneDelegate method

Swift
import UIKit

// Custom Scheme Link
func scene(_ scene: UIScene, openURLContexts URLContexts: Set) {
        let url = URLContexts.first?.url
        MoEngageSDKAnalytics.sharedInstance.processURL(url)
}

// Universal Scheme Link
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
        if let url =  userActivity.webpageURL {
            MoEngageSDKAnalytics.sharedInstance.processURL(url)
        }
    }
}

Custom Handling

To receive the deeplink callback in the MoEngageInAppNativeDelegate , do pass MoEngageInAppConfig(shouldProvideDeeplinkCallback: true) while initializing the MoEngageSDKConfig object.

Refer to the doc for callback methods.

warning

SDK Version

Custom Deeplink Callback is supported MoEngageInApp @ 6.00.0.

Previous

Next

Was this article helpful?
0 out of 1 found this helpful

How can we improve this article?