# Tether on your own page

After the install, the app gets one WarpLink link, and your app code opens its screen. Use this guide when your website has a button that sends iPhone visitors to the App Store. You add one script and mark the button. The page keeps your design, your analytics and your copy.

No website with an App Store button? Use the [hosted page](https://warplink.app/docs/tether/hosted-page). The [Tether overview](https://warplink.app/docs/tether) compares the two.

This page is the guide. It has four steps, with the code for your page and for the app. A person or an AI agent can follow it from top to bottom. The dashboard shows the same steps. Open the Your own website tab, then choose Setup guide. In the Setup guide, choose Copy for your AI agent to give your agent the steps. For limits, details and fixes, see the [reference page](https://warplink.app/docs/tether/own-page-reference).

## Terms on this page

- **The app** is your iOS app with the WarpLink SDK.
- **Your page** is the page on your website with the App Store button.
- **A WarpLink link** is a short link, such as `<handle>.aplnk.to/<slug>`.
- **A tap** is a person tapping a link or a button on a phone.
- **A code** is a short text that the script copies when a person taps your button. The app reads it once after the install.
- **A tap marker** is text that WarpLink adds to your page address when a WarpLink link sends a person there. It looks like `#wl_rt=...`, or `wl_rt=...` in the query.
- **An allowed site** is a website address on the app's list. WarpLink makes codes only for taps on those sites.
- **A direct visitor** is a person who reaches your page with no WarpLink link. For example, from search, a bookmark, a typed address, or a link on another website.

## Before you start

- Save the iOS Bundle ID of the app in the app settings. Tether works only for an app with an iOS Bundle ID.
- Keep Tether on for the app. It is on by default, in the Settings tab of Tether. Each link that sends people to your page needs its own switch: open the link editor and turn on Use Tether for this link. If you have no WarpLink link for the app yet, create one first on the Links page.
- Install SDK 1.4.0 or newer in the iOS app. See [SDK read modes](https://warplink.app/docs/tether/sdk-modes).
- Get your SDK key on the Keys page. Only an owner or admin sees that page. Step 3 uses it as `YOUR_SDK_KEY`.
- Know the address of your site, such as `https://acme.example`. You add it to Allowed sites.
- Know your WarpLink app ID. The Setup guide in the dashboard fills it in. An AI agent gets it from `list_apps`.

Do the four steps in order. Step 4 checks the result. The code in step 3 is for iOS. React Native and Flutter code is on [SDK read modes](https://warplink.app/docs/tether/sdk-modes).

## Add the script to your page

Paste the script into your page one time. It copies a code to the clipboard when a person taps your App Store button.

The script runs on iPhone and iPad. It does nothing on computers, on Android, or in the browser inside some apps, such as Instagram. It sets no cookie and saves no data in the browser.

Add `data-warplink-handoff` to the button or link that opens the App Store.

A link in the same tab, a form submit button and a button with `type="button"` wait for the copy.

Then the link opens, the form submits, or the App Store opens.

Let the script open the App Store. Do not open it from your own code.

Write one of your WarpLink links in `data-warplink-link`. Use the full link address, as in `<handle>.aplnk.to/<slug>`. The link must belong to this app and have Tether on.

No link yet? Create a link for this app in the dashboard, then turn on Use Tether for this link.

Replace `YOUR_APP_ID` with the App Store id of your app. Replace `YOUR_LINK_SLUG` with the slug of your link.

`data-warplink-app` holds your WarpLink app id, not the App Store id. The snippet already has it.

Write `data-warplink-link` even when only WarpLink links lead to your page. It is the backup when a redirect removes the tap marker.

After the install, the app reads the code and gets one WarpLink link. Your app code then opens its screen. The script picks the link in two cases.

Case 1: a WarpLink link sent the person to your page. WarpLink adds a tap marker to the page address. The marker names that link. The app gets that link.

The tap marker is `#wl_rt=...`, or `?wl_rt=...` when the address already has a # part. You do not write it yourself.

Case 2: a direct visitor. The address has no valid tap marker, for example after a search or from a bookmark. The app gets the link in `data-warplink-link`.

Installs from the button link count as From your page in Results.

By default, the app gets the button link even when the person tapped no WarpLink link first.

To change this, open Direct visitors, under Advanced on the Settings tab of Tether. Choose Only after a link tap.

The app then gets the button link only if the person first tapped that link on a WarpLink page. A tap straight to your own page does not count. A visitor with no such tap gets no link from the code.

A link can use its own rule in the link editor.

A valid tap marker can name a link that is paused, expired or has Tether off. WarpLink then gives no code. It does not use the button link to make one.

An invitation link follows Referral handoff instead. It still gets a code.

Add the site of your page to Allowed sites. Write the site address only, such as `https://example.com`. WarpLink makes no code for a site that is not on the list.

```html
<script async src="https://aplnk.to/handoff.js" data-warplink-app="YOUR_WARPLINK_APP_ID"></script>

<a href="https://apps.apple.com/app/idYOUR_APP_ID" data-warplink-handoff data-warplink-link="YOUR_HANDLE.aplnk.to/YOUR_LINK_SLUG">
  Get the app
</a>
```

<span id="keep-the-fallback-working" />

## Point your links at your page

In the link editor of each link, turn on Use Tether for this link. Set the iOS fallback URL to the address of your page. It is under Customize per platform, or Customize for iOS in an iOS-only app.

When a person taps the link on an iPhone or iPad, WarpLink sends the person to your page. WarpLink adds the tap marker to the page address.

If the iOS URL of the link starts with `https://`, WarpLink sends the person there, not to your page. Leave the iOS URL empty, or use an app link such as `acmefit://`.

On the Settings tab of Tether, keep Use our hosted page off. While it is on, WarpLink can send the person to its own page instead.

Keep the tap marker (`#wl_rt=` or `?wl_rt=`) in the page address through every redirect. The script reads it to find the WarpLink link.

If the script cannot copy a code, the tap still carries on. A link still opens and a form still submits.

A button with `type="button"` opens the App Store only when the script has an address to open.

The script holds the tap for at most 3 seconds, then the page goes on.

## Read the code in the app

Install SDK 1.4.0 or later (Swift Package Manager): `.package(url: "https://github.com/WarpLinkApp/warplink-ios-sdk", from: "1.4.0")`. Earlier versions do not read the code.

Replace `YOUR_SDK_KEY` with an SDK key for this app. Create one on the Keys page of the dashboard, on the SDK keys tab. An AI agent can call `create_key` with type `sdk`.

Set the read mode with `tetherReadMode` in `configure`. The default is `.pasteButton`. The SDK then reads the code after the person taps a system paste button.

`.automatic` reads during the first-launch check, and again on a later launch until that check completes. `.onCall` reads when your code calls `WarpLink.readTether(completion:)`.

The first-launch check is the SDK's check for a link after an install. It repeats on a later launch until it completes.

In the default mode, add `WarpLinkPasteButton` to your first-run screen. It needs iOS 16. On iOS 15, use a plain button that calls `WarpLink.readTether(completion:)`, as the snippet does. iOS may show its paste prompt then.

Route links in `onLink`. In the paste button and on call modes, `onLink` first gets an estimate, if the SDK found one. An estimate is a best guess and can be the wrong link.

When the SDK reads a valid code, the exact link reaches the read callback. It reaches `onLink` again only when `onLink` got another link first. The snippet calls `routeOnce`, so each link opens once.

In automatic mode, `onLink` fires once per check. The link is exact when the SDK read a valid code. With no code, it is an estimate, if the SDK found one. Check `evidenceClass` to tell them apart.

Put each part of the snippet in its place. `lastRouted`, `routeOnce` and `handle` go at file scope. The `WarpLink.configure` block goes in your `App`'s `init()`. The `if #available` block goes in the `body` of your first-run view. Read `WarpLink.lastTetherTestReceipt` where you show or log it, for example in a button action.

The snippet calls `router.replaceRoute` and `router.showRoute`. Replace them with the app's own navigation code, which opens the screen for a link. If the app has no screen for the link, open the home screen.

Show or log the test receipt, so you can send it to `verify_setup` as `tether_test_receipt`. It is `WarpLink.lastTetherTestReceipt`. The SDK forgets it when the app restarts.

```swift
import SwiftUI
import WarpLink

// One match can reach onLink and the read callback. Route each link once.
@MainActor var lastRouted: String?
@MainActor func routeOnce(_ link: WarpLinkDeepLink, _ route: (WarpLinkDeepLink) -> Void) {
    let key = link.linkId.isEmpty ? link.destination : link.linkId
    guard key != lastRouted else { return }
    lastRouted = key
    route(link)
}

// router stands for your app's own navigation code. Replace it.
WarpLink.configure(
    apiKey: "YOUR_SDK_KEY",
    options: WarpLinkOptions(
        tetherReadMode: .pasteButton,
        onLink: { result in   // onLink runs on the main actor.
            guard case .success(let link?) = result else { return }
            if link.evidenceClass == .exact {
                routeOnce(link) { router.replaceRoute(with: $0) }   // the exact link: switch to it
            } else {
                routeOnce(link) { router.showRoute(for: $0) }       // an estimate: a best guess
            }
        }
    )
)

// On the first-run screen. Always let the person continue without it.
func handle(_ result: Result<TetherReadResult, WarpLinkError>) {
    guard case .success(.matched(let link)) = result else { return }   // Other results: .noCode, .unusable and .test.
    Task { @MainActor in routeOnce(link) { router.replaceRoute(with: $0) } }
}

if #available(iOS 16.0, *) {
    WarpLinkPasteButton(onTether: handle)
} else {
    Button("Paste your code") { WarpLink.readTether(completion: handle) }
}

// Show or log WarpLink.lastTetherTestReceipt after the SDK read the test code.
```

## Check it before a link opts in

Open https://YOUR_HANDLE.aplnk.to/test in Safari on an iPhone. The page shows a test code that starts with wl1t_. Tap Copy code. The code works for 15 minutes.

Read the code in your app. In paste button mode, tap the paste button. In automatic mode, delete the app, then install it again and open it. An app whose first-launch check is complete reads nothing. The receipt is ready after that check ends. In on call mode, call the read method.

The SDK sends the test code to WarpLink. It keeps a test receipt.

Show or log the receipt in your app: `WarpLink.lastTetherTestReceipt`. The SDK forgets it when the app restarts.

Send the receipt to the setup check as `tether_test_receipt`. An AI agent calls `verify_setup` with the app and the receipt. With REST, call `GET /v1/apps/{id}/setup-check?tether_test_receipt=<receipt>` with an API key.

The `tether_paste` row passes when the receipt is valid for this app. The check accepts a receipt for 1 hour. A test code makes no link, click or install.

Check that the tap marker survives. Comment out the script tag on a test page. The script removes the marker from the address when it reads it. Open a WarpLink link that has Tether on, on an iPhone or in desktop Safari with an iPhone user agent.

When the page has loaded, confirm that `wl_rt=` is anywhere in the address. If it is not, your site removed it. Put the script tag back. For the causes and fixes, see https://warplink.app/docs/tether/own-page-reference#tap-marker-lost.

## Allowed sites [#allowed-sites]

WarpLink makes a code only for taps on a site on the app's list. Open the Your own website tab of the app. In Allowed sites, write the site as an address with no path, such as `https://acme.example`, and add it. The address `https://www.acme.example` is a different site. An app can list up to 50 sites.

A site that is not on the list gets no code. Each site on the tab shows a badge. Script seen means the script ran there. See the [badges and the error](https://warplink.app/docs/tether/own-page-reference#allowed-sites-in-detail).

## Which link the app gets [#which-link-the-app-opens]

The app gets one WarpLink link after the install. The script picks the link in one of two cases.

| How the person reached your page | The app gets |
|----------------------------------|--------------|
| **Case 1.** The person tapped a WarpLink link. The page address has a tap marker. | That WarpLink link. |
| **Case 2.** A direct visitor: the address has no valid tap marker, for example after a search or from a bookmark. | The link you wrote in `data-warplink-link` on the button. Or no link from the code, when Direct visitors is Only after a link tap and the visitor has no earlier tap of that link that opened a WarpLink page, such as the hosted page. |

A valid tap marker wins over `data-warplink-link`. The [reference page](https://warplink.app/docs/tether/own-page-reference#which-link-the-app-gets-in-detail) shows each case step by step.

### Choose what a direct visitor gets [#direct-visitors]

By default the app gets the link you wrote on the button, even when WarpLink saw no earlier link tap. This rule is **Open the link's screen**, or `open_link` in the API.

The other rule is **Only after a link tap**, or `tap_only`. The app then gets the link on the button only if the visitor earlier tapped that link and the tap opened a WarpLink page, such as the hosted page. A tap that went straight to your own page does not count. If your site loses the tap marker, the visitor is then a direct visitor with no counted tap, and the code gives no link. See [Tap marker lost](https://warplink.app/docs/tether/own-page-reference#tap-marker-lost).

Set the rule for the whole app in **Direct visitors**, under **Advanced** on the Settings tab of Tether. A link can keep its own rule instead. In the link editor, choose **Use app setting (now: ...)**, **Open the link's screen** or **Only after a link tap**. The first choice names the app rule where the dots are, for example **Use app setting (now: Open the link's screen)**. A link rule wins over the app rule.

Choose **Only after a link tap** when you need install counts you can check. See [direct visitors in detail](https://warplink.app/docs/tether/own-page-reference#direct-visitors-in-detail).

## Agent steps [#agent-steps]

An AI agent can do these steps with MCP tools. The agent still writes the page and app code from the guide above. For an iOS, React Native or Flutter app with the hosted page off, `get_sdk_setup` returns these rows as `agent_steps` in its `tether` section. A write tool needs a key or connection with the matching scope. See [AI Agents](https://warplink.app/docs/ai-agents).

| Step | Dashboard place | MCP tool and field |
| --- | --- | --- |
| Save the iOS Bundle ID, Team ID and App Store URL | App settings: Bundle ID, Team ID, App Store URL | `update_app` with `ios_bundle_id`, `ios_team_id`, `ios_app_store_url`. Whenever you send `ios_bundle_id`, send `ios_team_id` too. The hosted page needs the Bundle ID and the App Store URL. |
| Keep Tether on for the app | Tether tab, Settings: Tether for this app | `update_app` with `tether`. It is on by default. Send it only to turn it back on. |
| Add the script to your page | Your own website tab: Add the script to your page | No tool changes your website. The agent adds the script tag from the `script` step of the guide. |
| Mark your App Store button | Your own website tab: Mark your App Store button | No tool changes your website. The agent adds `data-warplink-handoff` and `data-warplink-link` to the button. |
| Allow your site | Your own website tab: Allowed sites | `update_tether_page` with `allowed_sites`; or `list_tether_sites` (read only). `allowed_sites` is the full list of origins, such as `https://acme.example`. It replaces the saved list. |
| Keep the hosted page off | Tether tab, Settings: Use our hosted page | `update_tether_page` with `hosted_page`. It is off by default. Send `false` only to turn it off. |
| Turn on Tether for each link | Link editor: Use Tether for this link | `update_link` with `tether`; or `create_link` with `tether`. Send `true`. The call fails with `TETHER_NOT_AVAILABLE` when the app has no iOS Bundle ID or Tether is off for the app. |
| Start new links with Tether on | Tether tab, Settings: On for all new links | `update_tether_page` with `new_links`. Optional. Existing links keep their setting. |
| Point each link at your page | Link editor: iOS fallback URL, under Customize per platform | `update_link` with `ios_fallback_url`; or `create_link` with `ios_fallback_url`. Set `ios_fallback_url` to the address of your page. Leave `ios_url` empty, or use an app link such as `acmefit://`. |
| Choose what a direct visitor gets | Tether tab, Settings, Advanced: Direct visitors | `update_tether_page` with `direct_rule`; or `update_link` with `tether_direct_rule`. `open_link` or `tap_only`. `tether_direct_rule` is for one link; `null` follows the app. |
| Get the SDK key | Keys page: SDK keys | `list_keys` (read only); or `create_key` with `name`, `type`, `app_id`. `list_keys` checks existing keys and shows only a key prefix. `create_key` gets a new raw key: set `type` to `sdk`, give a `name`, and set `app_id` to tie the key to this app. The raw key shows once. Only an owner or admin can list or create keys. |
| Read the setup steps for the app | In the app tab | `get_sdk_setup` with `app_id`, `platform`. The `tether` section holds the guide, the privacy text and these steps. |
| Read the code in the app | In the app tab | No tool changes the app's code. The agent follows the `sdk_read` step of the guide. |
| Check the setup with a test code | In the app tab: Test it | `verify_setup` with `app_id`, `tether_test_receipt`. Send the receipt that the SDK shows after it reads the test code. The `tether_paste` row passes when it is valid. |
| Check the tap marker survives | Your own website tab: Allowed sites, the Tap marker lost warning | No tool checks it. Comment out the script tag on a test page, open a Tether link on an iPhone, and confirm `wl_rt=` is anywhere in the address after the page loads. If not, the site removed it: see `/docs/tether/own-page-reference#tap-marker-lost`. |
| See taps, copies and installs | Results tab | `get_tether_results` with `app_id` |

## What happens next

When people tap your links on iPhones, the Results tab shows taps, codes copied and codes accepted by the app. Read [Results](https://warplink.app/docs/tether/results) to see the three funnels.

## Reference and fixes [#reference-and-fixes]

The [reference page](https://warplink.app/docs/tether/own-page-reference) holds the details and the fixes. Each link below opens one part.

<span id="case-link-sent-person" />
<span id="case-another-way" />
<span id="if-both-are-present" />
<span id="if-only-warplink-links-lead-to-your-page" />
<span id="if-something-goes-wrong" />
<span id="reference" />
<span id="what-the-script-sends" />

- [Case 1: a WarpLink link sent the person to your page](https://warplink.app/docs/tether/own-page-reference#case-link-sent-person)
- [Case 2: the address has no valid tap marker](https://warplink.app/docs/tether/own-page-reference#case-another-way)
- [If both are present](https://warplink.app/docs/tether/own-page-reference#if-both-are-present) and [if only WarpLink links lead to your page](https://warplink.app/docs/tether/own-page-reference#if-only-warplink-links-lead-to-your-page)
- [If something goes wrong](https://warplink.app/docs/tether/own-page-reference#if-something-goes-wrong)
- [Limits](https://warplink.app/docs/tether/own-page-reference#limits)
- [What the script sends](https://warplink.app/docs/tether/own-page-reference#what-the-script-sends)

## Next steps

- [SDK read modes](https://warplink.app/docs/tether/sdk-modes) for the React Native and Flutter code and the three read modes
- [Test Tether](https://warplink.app/docs/tether/testing) for the checks, the test code and the setup rows that `verify_setup` returns
- [Hosted page](https://warplink.app/docs/tether/hosted-page) if you prefer a page WarpLink serves
- [Errors](https://warplink.app/docs/errors) for `TETHER_SITE_NOT_ALLOWED` and the other Tether codes
