adjust-icon

Set up deep links

Deep links are URIs (Uniform Resource Identifiers) that direct users to specific pages within your app. They improve the user experience by guiding them directly to relevant content after they interact with a link.

Adobe AIR SDK supports two types of deep links, based on whether the user has already installed your app:

  • Direct deep links: If the user already has your app installed, the link opens the specified page.
  • Deferred deep links: If the user doesn’t have your app installed, the link directs them to the app store to install it. After installation, the app opens in the specified page.

You can reattribute your users by sending deep link information to Adjust. When a user interacts with the deep link, the SDK sends this data to Adjust to update their attribution information.

  1. First, create a new AdjustDeeplink instance with your deep link URI. The AdjustDeeplink class validates this URI and checks the formatted string to ensure successful processing.

  2. Then, call the Adjust.processDeeplink method to handle the deep link and pass the information to Adjust.

The AdjustDeeplink class constructor requires the following argument:

deeplink: Uri

The deep link URI that opens your app.

The Adjust.processDeeplink method requires the following argument:

adjustDeeplink: AdjustDeeplink

TheAdjustDeeplinkinstance you created.

To get information via a direct deep link, subscribe to the InvokeEvent.INVOKE event and set up a callback method that's triggered once this event happens. You can access the URL of the deep link that opened your app inside that callback method:

var app:NativeApplication = NativeApplication.nativeApplication;
app.addEventListener(InvokeEvent.INVOKE, onInvoke);
// ...
private static function onInvoke(event:InvokeEvent):void {
if (event.arguments.length == 0) {
return;
}
var deeplink:String = event.arguments[0];
trace("Deeplink = " + deeplink);
var adjustDeeplink:AdjustDeeplink = new AdjustDeeplink(deeplink);
Adjust.processDeeplink(adjustDeeplink);
}

To get information via a deferred deep link, you set a callback method on the AdjustConfig instance. This receives a String parameter where the content of the URL will be delivered.

  1. Call setDeferredDeeplinkCallback method on your adjustConfig instance.
  2. Pass the deep link as a String.

The setDeferredDeeplinkCallback method requires the following arguments:

setDeferredDeeplinkCallback: setDeferredDeeplinkCallback

A function that sets a deferred deep link callback.

deeplink: String

The deferred deep link you want to pass.

var appToken:String = "{YourAppToken}";
var environment:String = AdjustEnvironment.SANDBOX;
var adjustConfig:AdjustConfig = new AdjustConfig(appToken, environment);
adjustConfig.setDeferredDeeplinkCallback(DeferredDeeplinkCallback);
Adjust.initSdk(adjustConfig);
// ...
private static function DeferredDeeplinkCallback(deeplink:String):void {
trace("Received deferred deep link");
trace("Deep link = " + deeplink);
};

The SDK opens deferred deep links by default. You can disable this behavior with the disableDeferredDeeplinkOpening method.

  1. Call disableDeferredDeeplinkOpening on your adjustConfig instance.
adjustConfig.disableDeferredDeeplinkOpening();

Adapat and add snippets See template: Adobe Extension tutorial

Tutorial: Create a deferred deep link function

If you followed the integration guide, you've already configured the Adjust AIR SDK to process and open deep links. If you haven't done this, refer to set up deep link handling for instructions.

In this tutorial, you'll learn how to create a callback function that controls deep linking functionality using the setDeferredDeeplinkCallback method. The function will open the link depending on the following condition:

"If the deep link contains "no_open", the app won't open it."

The result looks like this:

package {
import com.adjust.sdk.Adjust;
import com.adjust.sdk.AdjustConfig;
import com.adjust.sdk.AdjustEnvironment;
import com.adjust.sdk.AdjustLogLevel;
public class Example extends Sprite {
public function Example() {
var appToken:String = "{YourAppToken}";
var environment:String = AdjustEnvironment.SANDBOX;
var adjustConfig:AdjustConfig = new AdjustConfig(appToken, environment);
adjustConfig.setLogLevel(AdjustLogLevel.VERBOSE);
adjustConfig.setDeferredDeeplinkCallback(DeferredDeeplinkCallback);
Adjust.initSdk(adjustConfig);
}
}
private static function deferredDeeplinkDelegate(uri:String):void {
trace("Received deferred deeplink");
trace("URI = " + uri);
}
}

Here's what you need to do:

  1. Inside the try...catch block, call the setDeferredDeeplinkCallback method of your adjustConfig instance. Pass an OnDeferredDeeplinkResponseListener instance as an argument.

    Main.as
    // add snippet
  2. Create a new public function called launchReceivedDeeplink inside your OnDeferredDeeplinkResponseListener declaration. This method takes a Uri argument and returns a boolean.

    Main.as
    // add snippet
  3. Add an if condition to the launchReceivedDeeplink to check if the deeplink contains the value "no_open". If the string is found, the function returns false, and the app shouldn't open the deferred deep link.

    Main.as
    // add snippet
  4. Finally, add an else block to return true if the deep link doesn't contain "no_open".

    Main.as
    // add snippet

That's it! When a user opens your app with a deferred deep link, the Adobe AIR SDK will check if the link contains the string "no_open". If it does, the app won't open the deep link.