# SKAdNetwork and iOS 14 click logic

> Review the SKAdNetwork click logic for iOS 14+ to ensure accurate attribution and campaign measurement under Apple’s privacy framework.

## Flowchart

1. ironSource SDK reads the SKAdNetworkItems from the publisher app's Info.plist.
2. ironSource bid request will include the `imp.ext.skadn` object for DSPs that are included in the publishers app's Info.plist.
3. If the campaign requires SKAdNetwork support, DSP should include `seatbid.bid.ext.skadn` in their bid response.
4. If the impression is shown and the user clicks, Apple will consider the app for install attribution.
5. If SKAdNetwork determines that the DSP's click led to the install, Apple will send the postback directly to the DSP.

## Bid request

If the DSP SKAdNetworkItem appears in the publisher app's Info.plist, ironSource will include a new object in the bid request that provides the necessary information to create a signature.

This object will only be present if both the ironSource SDK version and the OS version support SKAdNetwork.

### Imp.ext.skadn

| **Attribute** | **Description**                                                                                                                                                                                                                                                               | **Type**     | **Example**                                                          |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | -------------------------------------------------------------------- |
| `version`     | Version of skadnetwork supported. Always "2.0" or higher. Dependent on both the OS version and the SDK version. Note: With the release of SKAdNetwork 2.1, this field is deprecated in favor of the BidRequest.imp.ext.skadn.versions to support an array of version numbers. | String       | "version" : "2.0"                                                    |
| `versions`    | Array of strings containing the supported skadnetwork versions. Always "2.0" or higher. Dependent on both the OS version and the SDK version.                                                                                                                                 | String array | "versions": `["2.0", "2.1"]`                                         |
| `sourceapp`   | ID of publisher app in Apple's App Store. Should match app.bundle in OpenRTB 2.x                                                                                                                                                                                              | String       | "sourceapp": "880047117"                                             |
| `skadnetids`  | A subset of SKAdNetworkItem entries in the publisher app's Info.plist, expressed as lowercase strings, that are relevant to the bid request.                                                                                                                                  | String array | "skadnetids": `["cdkw7geqsh.skadnetwork", "qyjfv329m4.skadnetwork"]` |
| `ext`         | Placeholder for exchange-specific extensions to OpenRTB.                                                                                                                                                                                                                      | Object       | "ext" : {}                                                           |

#### Request SKAN object example

```json
{
    imp: \[
    {
        ext: {
        skadn: {
        version: "2.0",
        sourceapp: "880047117",
        skadnetids: \[
                    "cdkw7geqsh.skadnetwork",
                    "qyjfv329m4.skadnetwork"
                \]
            }
        }
    }
\]
}
```

## Bid response

If the bid request includes the BidRequest.imp.ext.skadn object, then a DSP could choose to add the following object to their bid response. If the object is included in the response (all parameters are required), ironSource will submit the click data and signature to the productView for iOS SKAdNetwork attribution.

### seatbid.bid.ext.skadn

| **Attribute** | **Description**                                                                                                    | **Type**     | **Example**                                     |
| ------------- | ------------------------------------------------------------------------------------------------------------------ | ------------ | ----------------------------------------------- |
| `version`     | Version of SKAdNetwork. Must be 2.0 or above.                                                                      | String       | "version" : "2.0"                               |
| `network`     | Ad network identifier used in signature. Should match one of the items in the skadnetids array in the request      | String       | "network": "cdkw7geqsh.skadnetwork"             |
| `campaign`    | Campaign ID compatible with Apple's spec. As of 2.0, should be an integer between 1 and 100, expressed as a string | String       | "campaign": "45"                                |
| `itunesitem`  | ID of advertiser's app in Apple's app store. Should match BidResponse.seatbid.bid.bundle                           | String array | "itunesitem": "123456789                        |
| `nonce`       | An id unique to each ad response. Refer to Apple's documentation for the proper UUID format requirements           | String       | "nonce": "473b1a16-b4ef-43ad-9591-fcf3aefa82a7" |
| `sourceapp`   | ID of publisher's app in Apple's app store. Should match BidRequest.imp.ext.skad.sourceapp                         | String       | "sourceapp": "880047117"                        |
| `timestamp`   | Unix time in millis string used at the time of signature                                                           | String       | "timestamp": "1594406341232"                    |
| `signature`   | SKAdNetwork signature as specified by Apple                                                                        | String       | "signature": "MEQCIEQlmZRNfYzK…"                |

### Response SKAN object example

```json
{
    seatbid: \[
    {
        bid: \[
        {
            ext: {
            skadn: {
                version: "2.0",
                network: "cdkw7geqsh.skadnetwork",
                campaign: "45",
                itunesitem: "123456789",
                nonce: "473b1a16-b4ef-43ad-9591-fcf3aefa82a7",
                sourceapp: "880047117",
                timestamp: "1603246928149",
                signature: "MEQCIEQlmZRNfYzKBSE8QnhLTIHZZZWCFgZpRqRxHss65KoFAiAJgJKjdrWdkLUOCCjuEx2RmFS7daRzSVZRVZ8RyMyUXg=="
                    }
                }
            }
        \]
    }
\]
}
```

## iOS 14.5 click logic

### Video

If a DSP returns `BidResponse.seatbid.bid.ext.skadn` object with a valid `itunesitem`:

* For VAST 2.0 Videos:
  * SKAdNetwork attribution will only be initiated if the `<ClickThrough>` element lands in the Apple App Store (redirect links are currently not supported).
  * ironSource supports click tracking through the VAST `<ClickTracking>` element.
* For VAST 2.0 CompanionAds:
  * SKAdNetwork attribution will only be initiated if the `<CompanionClickThrough>` element lands in the Apple App Store (redirect links are currently not supported).
  * ironSource supports click tracking through the VAST `<CompanionClickTracking>` element.

### Display

If a DSP returns `BidResponse.seatbid.bid.ext.skadn` object with a valid `itunesitem`:

* Display creatives must implement the clicks by calling: `mraid.open()`.
* Upon user click, ironSource will show the iOS StoreKit according to the itunesitem (bundle) received in the bid response.

> **Note:**
>
> Any other MRAID method (such as `window.open`, `window.location`) will result in click-tracking discrepancies.
