Skip to main content
When a user opens a DeepLink URL (e.g. from an email or ad), your app can receive the URL and navigate to the right screen. The DeepLink Flutter SDK helps you capture that URL and optional query/UTM parameters. After initializing the SDK with Deeplink().init(...), you can listen for incoming link open events via the SDK’s uriStream. Each event is a Uri representing a link that opened your app (Universal Link / App Link / custom scheme). Example:
import 'package:deeplink_flutter_sdk/deeplink_sdk.dart';

final Deeplink _deeplink = Deeplink();

void setupDeeplinkListener() {
  _deeplink.uriStream.listen((Uri uri) async {
    // Optionally resolve the link to get destinationUrl, utm, behaviors, etc.
    final data = await _deeplink.getLinkData(uri);

    final path = uri.path; // e.g. "/sale", "/product/123"
    final utmSource = uri.queryParameters['utm_source'] ?? data?['utm']?['utm_source'];
    final utmCampaign = uri.queryParameters['utm_campaign'] ?? data?['utm']?['utm_campaign'];

    // Navigate to the right screen based on the path or resolved data
    if (path == '/sale') {
      navigatorKey.currentState?.pushNamed('/sale');
    } else if (path.startsWith('/product/')) {
      final id = path.replaceFirst('/product/', '');
      navigatorKey.currentState?.pushNamed('/product', arguments: id);
    }
  });
}
See the deeplink_flutter_sdk example app for more patterns (initial link handling, smart routing, etc.).

Deferred deep linking

If the user did not have the app installed when they clicked the link, they are sent to the store. After they install and open the app, you still want to show the same content (e.g. the sale page). This is deferred deep linking.
  1. First launch after install — The DeepLink backend stores the click (and UTM/path) and matches it to the install (e.g. via Track Install or SDK init).
  2. SDK or API — On first launch, the SDK or your call to the Track Install API returns attribution (e.g. path, UTM). Use that to navigate the user to the right screen.
Example flow:
  • User taps https://yourapp.your-domain.com/sale?utm_campaign=summer.
  • User goes to store, installs, opens app.
  • Your app calls Deeplink().init(apiKey: ...) (or Track Install API); the backend returns something like { "path": "/sale", "utm_campaign": "summer" } as install attribution.
  • Your app navigates to the sale screen and can log the campaign.
Implementation details depend on your navigation setup; use the initial attribution payload to drive the first navigation.

UTM and query parameters

DeepLink links can include UTM and custom query parameters. When you handle a link (or deferred deep link), read uri.queryParameters or the attribution response and pass them to your analytics or routing:
  • utm_source, utm_medium, utm_campaign, utm_term, utm_content
  • Any custom keys you add when creating the link in the dashboard

Next steps

  • Create links in the Dashboard and set paths and UTM.
  • Use the Track Install API to record installs and get attribution if you are not using the SDK for that.