# Open the right screen after a new install

> Carry a link through the store install so the first launch opens the screen the link named. Use the SDK link handler and its isDeferred flag.

Page: https://warplink.app/use-cases/deferred-onboarding

A deferred deep link keeps the destination alive through the store. The person taps a WarpLink link, installs the app, and opens it. On first launch the SDK asks WarpLink for the link that led to the install, and your app routes to that screen instead of a generic welcome.

## How it works

1. **Create the link with a destination.** Create a link whose destination is the screen you want a new user to see first, such as a product, a playlist or a team. Set the store fallbacks if they differ from the app's defaults.
2. **Add the SDK to the app.** Install the SDK for iOS, Android, React Native or Flutter and call configure with an SDK key tied to the app. The SDK does the matching on first launch.
3. **Handle the link on first launch.** Register the SDK link handler when you configure it. A link that survived the install arrives with isDeferred set, and you route to its screen. When no link arrives, show the usual welcome.
4. **Send the person to the right screen.** Read the path and parameters from the link the handler receives and open that screen after any required step, such as accepting terms. Keep the generic path ready for everyone without a link.
5. **Set the match window.** Each link has a window of 1 to 24 hours in which an install can be matched. Set it to cover how long your visitors usually take to install.
6. **Check how the match was made.** A match reports whether it was deterministic, and the Analytics page and the attribution attempts list show how installs matched. A tap on a real device is the last test.

## Handle the deferred link on first launch

### iOS (Swift)

```swift
import WarpLink

WarpLink.configure(
    // SDK key from Keys > SDK
    apiKey: "wl_live_yoursdkkeyhere000000000000000000",
    options: WarpLinkOptions(onLink: { result in
        guard case .success(let deepLink) = result, let deepLink else { return }

        if deepLink.isDeferred {
            // Survived the App Store install.
            navigate(to: deepLink.deepLinkUrl ?? deepLink.destination)
        } else {
            navigate(to: deepLink.destination)
        }
    })
)
```

### Android (Kotlin)

```kotlin
WarpLink.configure(
    context = this,
    // SDK key from Keys > SDK
    apiKey = "wl_live_yoursdkkeyhere000000000000000000",
    options = WarpLinkOptions(onLink = { result ->
        result.onSuccess { deepLink ->
            if (deepLink.isDeferred) {
                // Survived the Play Store install.
                navigateTo(deepLink.deepLinkUrl ?: deepLink.destination)
            } else {
                navigateTo(deepLink.destination)
            }
        }
    })
)
```

### React Native

```typescript
import { WarpLink } from '@warplink/react-native'

WarpLink.configure({
  // SDK key from Keys > SDK
  apiKey: 'wl_live_yoursdkkeyhere000000000000000000',
  onLink: ({ deepLink }) => {
    if (!deepLink) return

    if (deepLink.isDeferred) {
      // Survived the store install.
      navigateTo(deepLink.deepLinkUrl ?? deepLink.destination)
    } else {
      navigateTo(deepLink.destination)
    }
  },
})
```

### Flutter

```dart
import 'package:warplink_flutter/warplink_flutter.dart';

// Call from your root widget's initState
WarpLink.configure(
  // SDK key from Keys > SDK
  apiKey: 'wl_live_yoursdkkeyhere000000000000000000',
  onLink: (event) {
    if (event is! LinkEvent) return;
    final deepLink = event.deepLink;

    if (deepLink.isDeferred) {
      // Survived the store install.
      navigateTo(deepLink.deepLinkUrl ?? deepLink.destination);
    } else {
      navigateTo(deepLink.destination);
    }
  },
);
```

## What you get

- **Linking.** A link whose destination survives the store, so the first launch opens the screen the person tapped for.
- **Attribution.** Installs that follow a tap on a WarpLink link, in any channel, are matched by a cascade that starts with deterministic evidence where the operating system offers it, then probabilistic matching, and each result says which one it was.
- **Analytics.** Installs shown per link next to clicks, plus a report of install attribution attempts and the reasons some did not match.

## Questions

### What is a deferred deep link?

It is a deep link that waits for the install. The destination is stored when the link is tapped, and the app reads it on first launch, after the person has installed.

### How does the app find the right link?

The SDK sends the install's signals to WarpLink. The match uses the Android install referrer where it exists, then device-level signals, then probabilistic matching within the link's window. The result says which kind of match it was.

### What if there is no match?

No link reaches the handler, and your app shows its normal first screen. Build the generic path first and treat the deferred link as an improvement on it.

### Does it work on all four SDKs?

Yes. The iOS, Android, React Native and Flutter SDKs each tell a deferred link apart from a tap. The code section shows all four.

### How long can the install take?

A link's match window is set from 1 to 24 hours. An install that comes after the window is not matched to that link.

## Related

- [Deferred deep linking on iOS](https://warplink.app/blog/deferred-deep-linking-ios)
- [Deferred deep linking on Android](https://warplink.app/blog/deferred-deep-linking-android)
- [Deferred deep linking in React Native](https://warplink.app/blog/deferred-deep-linking-react-native)
- [Deferred deep linking in Flutter](https://warplink.app/blog/deferred-deep-linking-flutter)
- [Deferred deep links concept](https://warplink.app/docs/concepts/deferred-deep-links)
- [Invite-a-friend onboarding](https://warplink.app/use-cases/invite-friends-onboarding)
