> ## Documentation Index
> Fetch the complete documentation index at: https://docs.appeeky.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Smart Links

> One link per campaign that sends each visitor to the right store, with exact install attribution and deferred deep links on Android

A smart link is a short link for one campaign. It sends each visitor to the right place for their device and carries the campaign into the app, so installs and revenue from that link show up under source **Smart link** with the link's campaign.

```
https://ingest.appeeky.com/l/<slug>
```

Use one link per placement: a creator video, a newsletter, a QR code on a poster, a social profile.

***

## Create a Link

Create links under **My Apps → your app → Attribution → Smart links** in Appeeky, or with the API:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api.appeeky.com/v1/analytics/apps/YOUR_APP_ID/links" \
  -H "X-API-Key: YOUR_APPEEKY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "October newsletter",
    "campaign": "newsletter-oct",
    "iosUrl": "https://apps.apple.com/app/id6443843426",
    "androidUrl": "https://play.google.com/store/apps/details?id=com.example.app",
    "deepLink": "myapp://paywall",
    "webUrl": "https://example.com"
  }'
```

The response is the new link with a random `slug` and its public `url`.

### Fields

| Field | Required | Description |
| - | - | - |
| `name` | Yes | Display name, up to 120 characters |
| `campaign` | Yes | Campaign name, up to 120 characters. Letters, digits, `_`, `.`, `:` and `-`. |
| `iosUrl` | One of the three URLs | App Store or custom product page URL (`https://`) |
| `androidUrl` | One of the three URLs | Google Play URL, `https://play.google.com/store/apps/details?id=…` |
| `webUrl` | One of the three URLs | Where desktop visitors go (`https://`) |
| `deepLink` | No | In-app destination: a URL with the app's scheme (`myapp://paywall`) or a universal link |

At least one of `iosUrl`, `androidUrl` or `webUrl` is required. Update a link with `PATCH` (send only the fields that change; `null` clears a URL) and remove it with `DELETE`. See the [Analytics API](https://docs.appeeky.com/docs/analytics-api.md#smart-links).

***

## What Happens on Each Platform

### Android

The visitor goes to Google Play. The link puts the campaign, the link and the in-app destination into the Play install referrer. On the first launch after install, the SDK reads the referrer:

* the install is attributed to the link exactly, and
* `getDeferredDeepLink()` returns the link's `deepLink`.

```ts theme={"theme":{"light":"github-light","dark":"github-dark"}}
// First launch: send the user where the link pointed.
const destination = await Appeeky.getDeferredDeepLink();
if (destination) Linking.openURL(destination);
```

This needs the SDK's native module, which reads the Play Install Referrer.

If the link has no `androidUrl`, Android visitors go to `webUrl`.

### iOS

* **With a `deepLink`:** the link first tries to open the app through its URL scheme, with the campaign appended to the URL. If the app is installed, it opens there. If nothing opens the app within about 1.5 seconds, the visitor goes to the App Store (`iosUrl`, or `webUrl`).
* **Without a `deepLink`:** the visitor goes straight to the App Store.

When the link opens the already-installed app on its **first** launch, the install is attributed to the link and `getDeferredDeepLink()` returns the opening URL.

> [!WARNING]
>
> iOS has no deferred deep link from a smart link. When a visitor installs from the App Store and then opens the app, the app cannot know which link they clicked. Matching an App Store install back to a click needs device fingerprinting, which Apple does not allow. Those installs are usually counted as **Organic**, or as **Apple Search Ads** if they came from an ad.

### Desktop and other devices

The visitor goes to `webUrl`. If there is no `webUrl`, they see a simple page with buttons for the App Store and Google Play.

***

## Link Stats

Each link shows, for the selected period:

* **Clicks** in the period, in total and by platform (iOS, Android, other)
* **Installs** attributed to the link and first seen in the period
* **Revenue** those installs have made so far

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl "https://api.appeeky.com/v1/analytics/apps/YOUR_APP_ID/links?range=30d" \
  -H "X-API-Key: YOUR_APPEEKY_KEY"
```

Installs and revenue from a link also appear in every breakdown under source **Smart link** and the link's campaign, and you can filter the dashboard by that campaign.

***

## Click Privacy

For each click, Appeeky stores only the link, a random click id, the platform (iOS, Android or other, read from the browser's user agent) and the country. It does not store the IP address or the user agent, and it does not fingerprint devices.

***

## Related Docs

* [Attribution](https://docs.appeeky.com/docs/analytics-attribution.md)
* [SDK Reference](https://docs.appeeky.com/docs/analytics-sdk-reference.md#getdeferreddeeplink)
* [Analytics API](https://docs.appeeky.com/docs/analytics-api.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.