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 by parsing the path
* and navigating to the appropriate screen.
*
* Possible resolvedLink formats:
*
* 1. https://brandname.go.link/?adj_t=abc123&
* 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=abc123
* -> extract path from the URL
*
* 3. example://summer-clothes?promo=beach&adj_t=abc123
* -> 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=abc123&
* adj_deep_link=example%3A%2F%2Fandroid-specific-path%3Fparam%3Dvalue
* -> extract and decode the deep link from adj_deep_link
*/
};
Adjust.initSdk(adjustConfig);