Skip to main content

Deeplink

If you are using the Adtrace tracker URL with an option to deep link into your app from the URL, there is the possibility to get info about the deep link URL and its content. Hitting the URL can happen when the user has your app already installed (standard deep linking scenario) or if they don't have the app on their device (deferred deep linking scenario).

Standard scenario

To support deep linking in Android, the app's AndroidManifest.xml file will need to be modified. Please refer to this page of our Android SDK for the needed modifications to AndroidManifest.xml.

To support deep linking in iOS 8 or earlier, the app's Info.plist file will need to be modified. Please refer to page of our iOS SDK for the needed modifications to Info.plist.

To support deep linking in iOS 9 or later, your app would have to handle Universal Links. Please refer to this page of our iOS SDK for the needed modifications.

Deferred scenario

While deferred deep linking is not supported out of the box on Android and iOS, our Adtrace SDK makes it possible.

In order to get info about the URL content in a deferred deep linking scenario, you should set a callback method on the AdTraceConfig object which will receive one parameter where the content of the URL will be delivered. You should set this method on the config object by calling the method setDeferredDeeplinkCallbackListener:

var adtraceConfig = new AdTraceConfig(appToken, environment);

adtraceConfig.setDeferredDeeplinkCallbackListener(function(deeplink) {
console.log("Deferred deep link URL content: " + deeplink);
});

AdTrace.create(adtraceConfig);

In the deferred deep linking scenario, there is one additional setting which can be set on the AdTraceConfig object. Once the Adtrace SDK gets the deferred deep link info, we are offering you the possibility to choose whether our SDK should open this URL or not. You can choose to set this option by calling the setShouldLaunchDeeplink method on the config object:

var adtraceConfig = new AdTraceConfig(appToken, environment);

adtraceConfig.setShouldLaunchDeeplink(true);
// or adtraceConfig.setShouldLaunchDeeplink(false);

adtraceConfig.setDeferredDeeplinkCallbackListener(function(deeplink) {
console.log("Deferred deep link URL content: " + deeplink);
});

AdTrace.create(adtraceConfig);

If nothing is set, the Adtrace SDK will always try to launch the URL by default.

If you are using this feature, in order for your user to be properly reattributed, you need to make one additional call to the Adtrace SDK in your app. Once you have received deep link content information in your app, add a call to appWillOpenUrl method of the AdTrace instance. By making this call, the Adtrace SDK will try to find if there is any new attribution info inside the deep link and if any, it will be sent to the Adtrace backend. If your user should be reattributed due to a click on the Adtrace tracker URL with deep link content in it, you will see the attribution callback in your app being triggered with new attribution info for this user.

Call to the appWillOpenUrl method in a React component would look like this:

componentDidMount() {
Linking.addEventListener('url', this.handleDeepLink);
Linking.getInitialURL().then((url) => {
if (url) {
this.handleDeepLink({ url });
}
})
}

componentWillUnmount() {
Linking.removeEventListener('url', this.handleDeepLink);
}

handleDeepLink(event) {
AdTrace.appWillOpenUrl(event.url);
}