adjust-icon

Set up direct deep linking

When a user with your app installed clicks an Adjust link, direct deep linking ensures they’re taken directly to specific content within the app.

How it works

  1. User clicks an Adjust link.
  2. The OS opens your app and passes the deep link to native code (iOS or Android).
  3. The Adjust SDK listens for deep links from the OS in native code and forwards them to directDeeplinkCallback.
  4. Your code passes the link to the Adjust SDK for attribution. The SDK also resolves short branded links.
  5. Your code navigates the user based on the resolved link.

Adjust SDK methods

Set directDeeplinkCallback on your AdjustConfig object before calling Adjust.initSdk to receive deep links intercepted by the Adjust SDK in native code.

Property declaration
DirectDeeplinkCallback? directDeeplinkCallback;

Use the Adjust.processAndResolveDeeplink method, which does the following:

  • Records attribution from deep link clicks
  • Resolves short branded links to their long branded link equivalent
  • Passes through all other links as is
Method signature
static Future<String?> processAndResolveDeeplink(AdjustDeeplink deeplink)

The Adjust.processDeeplink method records attribution from deep link clicks if you’re not using short branded links.

Method signature
static void processDeeplink(AdjustDeeplink deeplink)

The processAndResolveDeeplink method supersedes this legacy method.

Implementation

Set directDeeplinkCallback on your AdjustConfig object before calling Adjust.initSdk. The callback fires whenever the Adjust SDK receives a deep link from the OS in native code.

AdjustConfig adjustConfig = new AdjustConfig('{YourAppToken}', AdjustEnvironment.sandbox);
// Set direct deep link callback before initializing SDK
adjustConfig.directDeeplinkCallback = (String? incomingLink) async {
if (incomingLink == null) return;
// Create deep link object
final deeplink = AdjustDeeplink(incomingLink);
// Send deep link to Adjust's servers for attribution.
// If short branded link, receive long link.
// Otherwise, receive original link.
final resolvedLink = await Adjust.processAndResolveDeeplink(deeplink);
// Handle failure if resolvedLink is null
if (resolvedLink == null) return;
/*
* TODO: Handle the deep link and navigate to the appropriate screen.
*
* Possible resolvedLink formats:
*
* 1. https://brandname.go.link/?adj_t=def456&
* adj_link=https%3A%2F%2Fexample.com%2Fsummer-clothes%3Fpromo%3Dbeach
* -> extract and decode the deep link from adj_link
*
* 2. https://brandname.go.link/summer-clothes?promo=beach&adj_t=def456
* -> extract path from the URL
*
* 3. example://summer-clothes?promo=beach&adj_t=def456
* -> extract path from the URL
*
* Note (Android only): If your Android app scheme path differs from iOS,
* you may receive:
* https://brandname.go.link/?adj_t=def456&
* adj_deep_link=example%3A%2F%2Fandroid-specific-path%3Fparam%3Dvalue
* -> extract and decode the deep link from adj_deep_link
*/
};
Adjust.initSdk(adjustConfig);

If your main activity is singleTop, standard, or doesn’t specify a launch mode, you need to create a dedicated deep link activity to ensure deep links open correctly when the app is already running.

This is required because without proper configuration, deep links might launch the app in a new task or within another app’s task (such as a browser), resulting in two instances of the app running simultaneously.

Native Android setup

  1. Configure the manifest using the Dedicated Deep Link Activity Approach
  2. Create a DedicatedDeepLinkActivity that forwards deep links to your main FlutterActivity
  1. User clicks an Adjust link.
  2. The OS opens your DedicatedDeepLinkActivity with the deep link Intent.
  3. DedicatedDeepLinkActivity forwards the Intent to your main FlutterActivity using flags that bring the existing instance to the front.
  4. The Adjust SDK receives the deep link from your main FlutterActivity and forwards it to your directDeeplinkCallback.