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

# OEM Integration

Source: https://docs.linkrunner.io/affiliate-partners/oem-integration

Track installs from phone maker placements, such as app store icons and suggested apps on Xiaomi, OPPO and vivo

OEM placements are ads that phone makers show on their own devices: app store icons, suggested apps, folder recommendations and lock screen units. Most of them send the user straight to an app store without opening a browser. A normal [tracking link](https://docs.linkrunner.io/affiliate-partners/tracking-links) never loads, so Linkrunner never sees the click and the install looks organic.

To get credit for this traffic, your server reports each click, and optionally each impression, to Linkrunner as it happens. Linkrunner matches the install to your report and sends you the install postback as for any other campaign.

## Pick the method for each placement

| Your placement                                                        | Use                                                            | What gets credited                                           |
| --------------------------------------------------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------ |
| The user taps an icon or suggested app and lands in an app store     | [S2S clicks](https://docs.linkrunner.io/affiliate-partners/s2s-clicks)                   | Installs after a tap, within the advertiser's click window   |
| The app is shown to the user, who doesn't tap it                     | [S2S impressions](https://docs.linkrunner.io/affiliate-partners/s2s-impressions)         | Installs with no click, within the view-through window       |
| The placement opens a web page or a browser before the store         | [Tracking links](https://docs.linkrunner.io/affiliate-partners/tracking-links)           | Installs after a tap, recorded when the link loads           |

Most OEM partners use S2S clicks for taps and add S2S impressions for views. You can send both for the same campaign. A click always wins over an impression, so the same install is never credited twice.

> **Note:**
>
> **Factory pre-installs are not supported.** An app that ships already installed on the phone has no click or impression to report. Linkrunner records its first open as organic.

## How Linkrunner matches OEM installs

```
User taps your OEM placement ─────────────► App store (Google Play or the phone maker's store)
      │                                              │
      │ your server, at the moment of the tap        │ user installs and opens the app
      ▼                                              ▼
GET s2s.linkrunner.io/v1/click/<app_id>     Linkrunner SDK reports the install
      │                                              │
      └──────────── Linkrunner matches the install to your click
                                   │
                                   ▼
                    Install postback to your endpoint
```

Linkrunner tries these matches in this order. Send as many as you have.

| Match             | What you send                                                                                                                         | Precision     |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
| **Device ID**     | The raw `gaid` on Android or `idfa` on iOS. If you can't pass the raw GAID, send `sha1_advertising_id`, the SHA1 hash of the lower-case GAID | Exact         |
| **Play referrer** | Open Google Play with `referrer=lr_ia_id%3D<click_id>`, using the `click_id` from the S2S click response                              | Exact         |
| **IP address**    | The user's public device `ip`                                                                                                         | Probabilistic |

If the phone already has an earlier click with the same GAID, from you or another source, Linkrunner matches that earlier click first.

What this means for OEM traffic:

- **The referrer match only works through Google Play.** The Linkrunner SDK reads the Google Play Install Referrer. An install from the phone maker's own app store carries no Play referrer, so the device ID is what makes the match.
- **Send the GAID on every click.** It is the only exact match for installs from a phone maker's store. If your platform only has a hashed GAID, send it as `sha1_advertising_id`. A 40 character hex value sent in `gaid` is treated the same way.
- **OAID is not used for matching.** Phones without Google Play services have no GAID. For those, send `ip` so Linkrunner can fall back to an IP match.
- **Impressions need a raw device ID.** S2S impressions match on `gaid` or `idfa` only. A hashed GAID or an IP address alone is rejected.

## Before you start

You need three things from the advertiser and one from your own dashboard:

| What                                   | Who sets it up                                                                                                                                       |
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| A connected partner account            | The advertiser connects you in **Integrations → Affiliate Partners**                                                                                 |
| **S2S clicks and impressions** switch  | The advertiser, in **Integrations → Affiliate Partners → Configure**. Send them [these steps](https://docs.linkrunner.io/affiliate-partners/turn-on-s2s-clicks)                 |
| **View-through**, only for impressions | The advertiser, in **Settings → Attribution Windows**. See [View-through attribution](https://docs.linkrunner.io/features/attribution-windows#view-through-attribution)        |
| Your S2S token                         | You, in **Settings → S2S Credentials** (step 1 below)                                                                                                |

This is what the advertiser sees once they turn on S2S for you:

![The partner's Configure page with the S2S clicks and impressions switch turned on](https://docs.linkrunner.io/images/affiliate-partners/s2s-clicks-switch-on.webp)

And once they turn on view-through for you, with its window:

![View-through attribution turned on for a partner with a 24 hour window](https://docs.linkrunner.io/images/ctv-attribution/ctv-view-through-on.webp)

Until the switch is on, your requests are rejected with `partner_not_enabled`. Impressions sent before view-through is on are rejected with `view_through_disabled`.

## Set it up

**1. Get your S2S token**

In your affiliate dashboard, open [**Settings → S2S Credentials**](https://dashboard.linkrunner.io/affiliate/settings?tab=s2s) and click **Generate token**. The token starts with `lrs2s_` and is **shown only once**, so store it as a secret on your server. One token covers every app and every S2S endpoint.

![S2S Credentials with the Generate token button](https://docs.linkrunner.io/images/affiliate-partners/ctv-s2s-credentials.webp)

**2. Create a campaign for each OEM placement**

Pick the advertiser's app in the switcher at the top left. In **All Campaigns**, click **Create Link**, name the campaign after the placement (for example "OEM app store icon") and click **Create Campaign**. See [Create a campaign link](https://docs.linkrunner.io/affiliate-partners/create-campaign-link).

The **Campaign Created** screen shows the **Template URL**. If view-through is on for you, it also shows a ready-made **View-through URL** for impressions.

![Campaign Created with the Template URL and the View-through URL. The CTV impression URL below them shows only when CTV is on for you](https://docs.linkrunner.io/images/ctv-attribution/ctv-campaign-created-url.webp)

Copy the `c` value from the Template URL. You need it for every request.

**3. Build the S2S click URL**

Send the Template URL's parameters to `https://s2s.linkrunner.io/v1/click/<app_id>` instead. `<app_id>` is the Android package name, such as `com.example.app`. Add the device fields your server has, and send your token in the `X-Linkrunner-Token` header:

```http
GET https://s2s.linkrunner.io/v1/click/com.example.app?c=OgWmhiSXhG&tid={click_id}&s2={placement_id}&gaid={gaid}&ip={device_ip}&click_time={timestamp_ms}
X-Linkrunner-Token: <your_token>
```

| Parameter                        | Required    | What to send                                                                                     |
| -------------------------------- | ----------- | ------------------------------------------------------------------------------------------------ |
| `c`                              | Yes         | The campaign code from your Template URL                                                         |
| `tid`                            | Yes         | Your own unique ID for this click. It comes back in `{click_id}` and `{tid}` on postbacks        |
| `gaid` or `sha1_advertising_id`  | Recommended | The device's GAID, or its SHA1 hash                                                              |
| `ip`                             | Recommended | The user's public device IP, not your server's. Required when you have no device ID              |
| `click_time`                     | Optional    | When the user tapped, in Unix milliseconds or seconds. Defaults to the time we receive the call  |
| `s2`, `s3`, `s4`                 | Optional    | Your own values, such as the placement or the phone maker. They come back in `{s2}` to `{s4}`    |

If your ad server can't set headers, pass the token as the `lr_token` query parameter instead. See [Authenticate your requests](https://docs.linkrunner.io/affiliate-partners/s2s-clicks#authenticate-your-requests).

**4. Fire it at the moment of the tap**

Call the URL from your server with `GET` when the user taps, and send the user straight to the store. The user doesn't wait for this call. A `200` with `"status":"accepted"` means the click is recorded.

If the placement opens Google Play, add the `click_id` from the response to the store URL as `referrer=lr_ia_id%3D<click_id>`. This gives an exact match when the click has no GAID.

> **Warning:**
>
> Send each click as it happens. Linkrunner only credits an install to a click it received before the install. Clicks older than 24 hours are rejected, and there is no way to re-attribute an install afterwards.

**5. Optional: report impressions**

If your placement is shown without a tap, report it with the **View-through URL** from your dashboard. It sends the same `c` to `https://s2s.linkrunner.io/v1/impression` with the advertiser's link domain in `d`. `https://s2s.linkrunner.io/v1/impression/<app_id>` works too. Send a unique `tid` per impression and the raw `gaid`. See [S2S impressions](https://docs.linkrunner.io/affiliate-partners/s2s-impressions) for every parameter.

**6. Test it end to end**

Send one click with the GAID of a test Android phone. Install the app on that phone from the store your placement opens, then open the app. In [Postback logs](https://docs.linkrunner.io/affiliate-partners/postback-logs), find the `install` row for your campaign and expand it. **Click ID** shows your `tid`, and **Request sent** shows the URL Linkrunner called.

![An expanded postback in Postback Logs, here a sale event, with the request sent and the Click ID marked](https://docs.linkrunner.io/images/affiliate-partners/postback-log-detail.webp)

> **Tip:**
>
> Already sending OEM clicks to AppsFlyer? Keep the template. Change the host to `s2s.linkrunner.io/v1/click/<app_id>`, set `c` to the Linkrunner campaign code, and add your token. AppsFlyer names such as `clickid`, `advertising_id`, `sha1_advertising_id`, `af_ip` and `af_sub1` to `af_sub3` work as they are. See [Coming from AppsFlyer](https://docs.linkrunner.io/affiliate-partners/s2s-clicks#coming-from-appsflyer).

## See your results

In **All Campaigns**, installs from your S2S clicks count under **Installs**, like installs from a tracking link. Installs credited to your impressions also count under **View Through Attribution**. To see accepted impressions, turn on the **Impressions** column with the columns icon at the right of the toolbar. See [See your results](https://docs.linkrunner.io/affiliate-partners/ctv-impressions#see-your-results) for the steps.

![Campaign table with Clicks, Impressions, Installs and View Through Attribution columns](https://docs.linkrunner.io/images/affiliate-partners/ctv-campaign-table.webp)

Each install postback tells you how it was credited:

- `{touch_type}` is `click` for an install from your S2S click and `impression` for a view-through install.
- `{device_brand}` is the brand the user sees, such as `POCO`, not the company that makes the phone, such as `Xiaomi`. Use it to split results by phone brand. See [Device macros](https://docs.linkrunner.io/affiliate-partners/postbacks#device).

The advertiser's fraud rules apply to your clicks as to any other partner's. Installs credited to an impression are never checked against click-to-install time rules, because an install that follows an OEM impression within seconds is normal. See [Fraud data](https://docs.linkrunner.io/affiliate-partners/fraud-data).

## Troubleshooting

**Every request returns `partner_not_enabled`.**
The advertiser hasn't turned on S2S clicks for you on this app, or `c` is a campaign that isn't yours. Send them [these steps](https://docs.linkrunner.io/affiliate-partners/turn-on-s2s-clicks). Changes take up to 5 minutes to apply.

**Requests return `missing_device_id`.**
A click needs a `gaid`, `idfa`, `sha1_advertising_id` or `ip`. An impression needs a raw `gaid` or `idfa`. A GAID of all zeros counts as missing. The phone returns it when the user has deleted their advertising ID or opted out of ads personalisation. Send `ip` on those clicks instead.

**Requests return `invalid_device_id`.**
The GAID is not a valid ID, for example `null`, `unknown` or a value without dashes. Send the GAID as the phone reports it, or its 40 character SHA1 hash.

**Clicks are accepted but installs show as organic.**
Check, in this order:

1. The click carries the real GAID of the installing phone, not a placeholder or your test value.
2. The click reached Linkrunner before the user opened the app.
3. With IP only, `ip` is the phone's public IP at the time of the tap, not your server's. A phone that switches from Wi-Fi to mobile data before installing gets a new IP and may not match.
4. The phone has no earlier click with the same GAID, from you or another source. Linkrunner matches the earliest one.

**Installs from phones without Google Play services are not credited.**
These phones have no GAID, and OAID is not used for matching. Send `ip` on those clicks so Linkrunner can try an IP match.

For other rejection reasons, see [S2S clicks troubleshooting](https://docs.linkrunner.io/affiliate-partners/s2s-clicks#troubleshooting) and the [S2S Click API reference](https://docs.linkrunner.io/api-reference/s2s-clicks).

**Need help?** Contact <support@linkrunner.io>
