# Send web visitors to your app with one smart link

> One link routes mobile web visitors to the matching screen in your app, the store page if it is not installed, and the web page on desktop.

Page: https://warplink.app/use-cases/web-to-app-smart-links

A smart link is one URL that sends each visitor where they belong. Someone with the app is taken into the app, someone on iOS or Android without it lands on the right store page, and someone on a desktop reaches your web page. You put the same link on your site, in posts and in messages.

## How it works

1. **Register the app.** Add your iOS bundle and team IDs, your Android package and signing certificate hashes, and the store URLs. WarpLink serves the association files, and the store URLs become the fallbacks for your links.
2. **Create the link.** Set the web destination, then set the iOS and Android fallback URLs if a link needs different stores from the app's defaults. The link settings win over the app settings.
3. **Put it where people click.** Make one link per placement: your website, social bios, newsletters and support replies. Give each link its own UTM fields and each placement can be told apart.
4. **Keep the destination through an install.** With the SDK in your app, the first launch after install asks for the match and opens the screen the link pointed to. The match window is set per link, from 1 to 24 hours.
5. **Check each path.** Open the link on an iPhone with the app, an Android phone without it, and a laptop. The deep link checker reads both association files if the app path fails.
6. **Read where taps come from.** The link page shows clicks and installs, and a breakdown by device, operating system, country and referrer, so you can see how much of the traffic is on a phone.

## Create one link for all visitors

### REST API (TypeScript)

```typescript
// One link for every visitor: the app when it is installed, the store when it is not, the web page on a desktop.
const response = await fetch("https://api.warplink.app/v1/links", {
  method: "POST",
  headers: {
      // API key from Keys > API
      Authorization: "Bearer wl_live_YOUR_API_KEY",
      "Content-Type": "application/json",
    },
  body: JSON.stringify({
    app_id: "3f9a1c2e-6b7d-4e1a-9c2f-8a5b1d0e7c44",
    slug: "get-started",
    destination_url: "https://app.example/get-started",
    ios_fallback_url: "https://apps.apple.com/app/id000000000",
    android_fallback_url: "https://play.google.com/store/apps/details?id=com.example.app",
    match_window_hours: 24,
  }),
});

const link = (await response.json()) as { short_url: string };
```

### 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)
            }
        }
    })
)
```

## What you get

- **Linking.** One link that picks the app, the store page or the web page by device type and by whether the app is installed.
- **Attribution.** Installs that follow a tap on a WarpLink link, in any channel, are matched on first launch, and the SDK opens the destination the person tapped for.
- **Analytics.** Clicks, unique clicks and installs per link, with device, operating system, country and referrer breakdowns.

## Questions

### What does a visitor on a desktop see?

The web destination you set on the link. A desktop has no app to open, so the link sends the visitor to the page.

### How does the link know the app is installed?

The phone decides. Universal Links on iOS and App Links on Android hand the tap to the app when it is installed and the domain is verified. Otherwise the link redirects to the store page.

### Will the person land on the right screen after installing?

Yes, when the SDK is in your app. The first launch asks for the match and opens the destination from the link. The match window is up to 24 hours.

### Can I set different store pages for one link?

Yes. Set ios_fallback_url and android_fallback_url on the link. Without them, the store URLs from the app registration are used.

### Is this the same as a deferred deep link?

A deferred deep link is the part that carries the destination through the install. A smart link is the single URL that starts it and covers the other paths too.

## Related

- [One link for both app stores](https://warplink.app/blog/one-link-for-both-app-stores)
- [Smart link services for app marketers](https://warplink.app/blog/best-smart-link-tools-for-app-marketers)
- [Deferred deep linking](https://warplink.app/deferred-deep-linking)
- [Deferred deep links concept](https://warplink.app/docs/concepts/deferred-deep-links)
- [Deferred onboarding](https://warplink.app/use-cases/deferred-onboarding)
