While standard deep links work great for redirecting your existing users (who already installed your app) to a specific screen or page within your app, they do not work for new users because new users get redirected to an app store to download the advertised app (then on first app open, these users see the app's default splash screen instead of the specified deep link).
With deferred deep linking, TUNE persists the deep link in an internal deep link database/registry and makes it available for app open events. So whether users are existing or new, each app open event initiates a lookup to retrieve a deferred deep link (if available). This persistence and retrieval service enables new users to reach a particular deep link after app install. For more information about deferred deep linking, visit Deferred Deep Linking with Attribution Analytics.
There are two ways to implement deferred deep linking:
- Through the TUNE SDK (as described on this page)
- Through server-to-server API calls (as described at Retrieving Deferred Deep Links from API)
To enable deferred deep linking, the following are required:
- Your TUNE account is enabled for deferred deep linking (contact tmcsupport@tune.com).
- In TUNE, configure deep link URLs for each page in your app (where ad clicks will link to).
- In TUNE, create TUNE links that include a configured deep link URL.
- Your app must be integrated with our Android SDK 3.7+. For more information about SDK code integration, please visit Android SDK Quick Start.
- Your app must implement a standard URL scheme for specific pages or screens in your app.
- Your app code must include the following call made after initializing the TUNE SDK:
- Your app must be integrated with our iOS SDK 4.12.0+. For more information about SDK code integration, visit iOS SDK Quick Start.
- Your app must implement a standard URL scheme or Universal Links for specific pages or screens in your app.
- The call to registerDeeplinkListener: must include an instance of a class that conforms to TuneDelegate protocol and implements the tuneDidReceiveDeeplink: and tuneDidFailDeeplinkWithError: methods
- Your app must be integrated with our iOS SDK 3.11.0+. For more information about SDK code integration, visit iOS SDK Quick Start.
- Your app must implement a standard URL scheme for specific pages or screens in your app.
- The call to checkForDeferredDeeplink: must include an instance of a class that conforms to TuneDelegate protocol and implements tuneDidReceiveDeeplink: method
- Your app must be integrated with our iOS SDK 3.7+. For more information about SDK code integration, visit iOS SDK Quick Start.
- Your app must implement a standard URL scheme for specific pages or screens in your app.
- Your app code must include the following call made after setAppleAdvertisingIdentifier:
- Your app must implement a standard URL scheme for specific pages or screens in your app.
- Your app code must include the following call made after setAppleAdvertisingIdentifier:
- Your app must be integrated with our Adobe AIR plugin 4.1.0+. For more information about SDK code integration, visit Adobe AIR Plugin Quick Start.
- Your app code must include the following calls made after initializing MobileAppTracker:
- Your app must be integrated with our Cordova plugin 4.1.0+. For more information about SDK code integration, visit Cordova Plugin Quick Start.
- Your app code must include the following call made after initializing the MobileAppTracker:
- Your app must be integrated with our Titanium plugin 3.12.0+. For more information about SDK code integration, visit Titanium Plugin Quick Start.
- To provide the deep link to TUNE when a deferred deep link is received, call the
setDeepLink("some_deep_link");
method. - When using TUNE deferred deep linking, use the same method in conjunction with
checkForDeferredDeepLink()
. - Your app code must include the following call made after initializing the MobileAppTracker:
- Your app must be integrated with our Unity plugin 3.11.0+. For more information about SDK code integration, visit Unity Plugin Quick Start.
- Your app code must include the following call made after initializing the TUNE SDK:
- Your app must be integrated with our Xamarin binding 4.0.0+. For more information about SDK code integration, visit Xamarin Plugin Quick Start.
- Your app code must include the following calls made after initializing Tune:
- Your app must be integrated with our Xamarin binding 5.1.0+. For more information about SDK code integration, visit Xamarin Plugin Quick Start.
- Create a subclass of TuneDelegate:
Tune.getInstance().registerDeeplinkListener(new TuneDeeplinkListener() {
@Override
public void didReceiveDeeplink(String deeplink) {
// Handle the deferred deeplink here
// e.g. open the link
if (!"".equals(deeplink)) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(deeplink)));
}
}
@Override
public void didFailDeeplink(String error) {
// Error was encountered
}
});
Tune.getInstance().checkForDeferredDeeplink(new TuneDeeplinkListener() {
@Override
public void didReceiveDeeplink(String deeplink) {
// Handle the deferred deeplink here
// e.g. open the link
if (!"".equals(deeplink)) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(deeplink)));
}
}
@Override
public void didFailDeeplink(String error) {
// Error was encountered
}
});
[Tune registerDeeplinkListener:self];
[MobileAppTracker checkForDeferredDeeplinkWithTimeout:0.75];
[Tune checkForDeferredDeeplink:self];
[Tune checkForDeferredDeeplinkWithTimeout:0.75];
// Add event listeners for TUNE_DEEPLINK, TUNE_DEEPLINK_FAILED before checking for deferred deep links
mat.addEventListener(MobileAppTracker.TUNE_DEEPLINK, tuneDeeplinkCallback);
mat.addEventListener(MobileAppTracker.TUNE_DEEPLINK_FAILED, tuneDeeplinkFailedCallback);
// Check for deferred deep link
mat.checkForDeferredDeeplink();
window.plugins.matPlugin.checkForDeferredDeeplink(function(deeplink) {
console.log('deferred deeplink success: ' + deeplink);
// TODO: add your code to handle the deep link url as appropriate
},
function(error) {
console.log('deferred deeplink failed: ' + error);
}
);
mat.checkForDeferredDeeplink(function(result) {
var deepLink = result['deeplink'];
var error = result['error'];
console.log('deep link is ' + deepLink);
console.log('deep link error is ' + error);
if(deepLink != null) {
setDeepLink(deepLink);
}
});
public class SampleTuneListener : TuneDelegate
{
public override void TuneDidReceiveDeeplink (string deeplink)
{
Console.WriteLine ("TUNE DidReceiveDeeplink: deeplink = " + deeplink);
// handle opening link
}
public override void TuneDidFailDeeplinkWithError (NSError error)
{
Console.WriteLine ("TUNE DidFailDeeplinkWithError: error = " + error.Code + ", " + error.LocalizedDescription);
}
}
public class TuneDeeplinkListener : TuneDelegate
{
public override void TuneDidReceiveDeeplink(string deeplink)
{
Console.WriteLine ("TUNE DidReceiveDeeplink: deeplink = " + deeplink);
TUNE.SetDeeplink(deeplink, "{you may put your app name here}");
}
public override void TuneDidFailDeeplinkWithError(NSError error)
{
Console.WriteLine ("TUNE DidFailDeeplinkWithError: error = " + error.Code + ", " + error.LocalizedDescription);
}
}
TuneDeeplinkListener listener = new TuneDeeplinkListener();
using TuneSDK;
public class TuneDeeplinkListener : Java.Lang.Object, ITuneDeeplinkListener
{
public TuneDeeplinkListener ()
{
}
public void DidReceiveDeeplink(string deeplink)
{
Console.WriteLine ("TUNE DidReceiveDeeplink: " + deeplink);
// Pass deferred deeplink value to TUNE
Tune.Instance.ReferralUrl = deeplink;
// TODO: handle deeplink redirection
}
public void DidFailDeeplink(string error)
{
Console.WriteLine ("TUNE DidFailDeeplink: error = " + error);
}
}
TuneDeeplinkListener listener = new TuneDeeplinkListener();
Select a preferred platform.
- The Tune SDK does not auto-open the deferred deep link url. This behavior is different than the behavior of older SDKs 3.7-3.10.0.Your tuneDidReceiveDeeplink: callback implementation now needs to handle opening of the deep link url. The following code snippets shows sample implementation with both success and failure callbacks
- The TUNE SDK automatically opens the deferred deep link, if it becomes available within the provided timeout duration. In addition, if you need to retrieve the full deferred deep link from MAT (for debugging, testing, or campaign optimization purposes), then you can implement the following callback in your app code:
- Your app must be integrated with our iOS SDK 3.7+. For more information about SDK code integration, visit iOS SDK Quick Start.
The TUNE SDK automatically opens the deferred deep link, if it becomes available within the provided timeout duration. In addition, if you need to retrieve the full deferred deep link from TUNE (for debugging, testing, or campaign optimization purposes), then you can implement the following callback in your app code:
- The Tune Adobe AIR plugin does not auto-open the deferred deep link url.
- In the same script file, add your code to handle the deep link in the following callbacks:
- Your Unity project must have a GameObject called TuneListener with TuneListener.cs attached. To add this, you may choose TUNE->Setup->Create TuneListener GameObject from your Unity menu.
- In TuneListener.cs, add your code to handle the deep link in the following callbacks:
In the listener callbacks, handle opening the deferred deep link returned.
- After TUNE has been init, invoke the call to get a deferred deep link:
In the listener callbacks, handle opening the deferred deep link returned.
- After TUNE has been init, invoke the call to get a deferred deep link:
private function tuneDeeplinkCallback(event:StatusEvent):void {
trace(event.code + "::" + event.level);
// Pass deferred deep link value to MAT
mat.setDeepLink(event.level);
// Handle deferred deep link here
}
private function tuneDeeplinkFailedCallback(event:StatusEvent):void {
trace(event.code + "::" + event.level);
}
/// Deferred Deep Linking
- (void)tuneDidReceiveDeeplink:(nullable NSString *)deeplink {
NSLog(@"Tune deferred deeplink = %@", deeplink);
if(deeplink) {
//When the app is opened due to a deep link, call the Tune deep link setter
[Tune handleOpenURL:[NSURL URLWithString:deeplink] sourceApplication:nil];
}
//Handle opening deep link
}
- (void)mobileAppTrackerDidReceiveDeeplink:(NSString *)deeplink
- (void)tuneDidReceiveDeeplink:(NSString *)deeplink {
NSLog(@"Tune deferred deeplink = %@", deeplink);
if(deeplink) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:deeplink]];
}
}
- (void)tuneDidReceiveDeeplink:(NSString *)deeplink
public void trackerDidReceiveDeeplink (string url)
{
print ("TuneListener trackerDidReceiveDeeplink: " + url);
// Let Unity open the deep link
Application.OpenUrl(url);
// TODO: You may alternatively add your custom code to handle the deferred deep link url directly here
// If so, call the following line to inform TUNE of the deep link that was opened
// Tune.SetDeepLink(url);
}
public void trackerDidFailDeeplink (string error)
{
print ("TuneListener trackerDidFailDeeplink: " + error);
}
SampleTuneListener listener = new SampleTuneListener();
Tune.RegisterDeeplinkListener(listener);
// Check for deferred deep link
Tune.CheckForDeferredDeeplink((listener);
// Check for deferred deep link
Tune.Instance.checkForDeferredDeeplink(listener);
Select a preferred platform.
If you're not using the Unity Application.OpenUrl()
method to handle the deep link, you can directly call the setter method provided by the TUNE plugin:
- (void)tuneDidFailDeeplinkWithError:(nullable NSError *)error {
NSLog(@"Tune failed to receive deferred deep link: error = %@", error);
}
- (void)tuneDidFailDeeplinkWithError:(NSError *)error {
NSLog(@"Tune failed to receive deferred deep link: error = %@", error);
}
Tune.SetDeepLink (deep_link_url);
Select a preferred platform.
After calling this method to set the deep link, TUNE includes the deep link information in all measurement requests in the current session.
Example: Setting Deferred Deep Link when using the Facebook Unity Plugin
If you're implementing deferred deep linking through the Facebook Unity plugin, you can use the following sample code to retrieve deferred deep links:
FB.Mobile.FetchDeferredAppLinkData(DeepLinkCallback);
Sample implementation of Facebook Unity plugin deferred deep link callback:
void DeepLinkCallback(IAppLinkResult result) { if (!String.IsNullOrEmpty(result.Url)) { Debug.Log(result.Url); Tune.SetDeepLink (result.Url); } }
For more information about deferred deep linking with the Facebook Unity plugin, visit https://developers.facebook.com/docs/unity/reference/current/FB.Mobile.FetchDeferredAppLinkData.
For more information about TUNE response methods, visit Reading Server Responses.