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
- User clicks an Adjust link.
- The OS opens your app and passes the deep link to native code (iOS or Android).
- The
app_linkslibrary forwards the link to your Flutter code. - Your code passes the link to the Adjust SDK for attribution. The SDK also resolves short branded links.
- Your code navigates the user based on the resolved link.
Adjust SDK methods
Process deep link (recommended)
Use the Adjust.processDeeplink 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
static Future<String?> processDeeplink(String deeplink)App will open URL (legacy)
The Adjust.appWillOpenUrl method records attribution from deep link clicks but doesn’t resolve short branded links.
static void appWillOpenUrl(String url)The processDeeplink method supersedes this legacy method.
Implementation
Use the app_links library to receive deep links and pass them to the Adjust SDK.
dependencies: app_links: ^6.0.0 # check pub.dev for latest versionfinal _appLinks = AppLinks();
Future<void> _initDeepLinks() async { // Handle link when app is started from a deep link final initialLink = await _appLinks.getInitialLink(); if (initialLink != null) { _handleDeepLink(initialLink); }
// Handle links when app is already running _appLinks.uriLinkStream.listen(_handleDeepLink);}
Future<void> _handleDeepLink(Uri incomingLink) async { // Send deep link to Adjust's servers for attribution. // If short branded link, receive long link. // Otherwise, receive original link. final resolvedLink = await Adjust.processDeeplink(incomingLink.toString());
// 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 */}