# AppsFlyer integration validation

> Review the AppsFlyer integration rules and how to resolve integration setup warnings in the User Acquisition Dashboard.

When you [integrate](/user-acquisition/partner-integration/appsflyer/integrate-appsflyer-with-unity.md) your user acquisition campaign with AppsFlyer, the Unity dashboard validates your integration setup to ensure it's configured correctly. If you don't resolve these integration errors, you can't launch new or paused campaigns, and your live campaigns can suffer serious performance and attribution issues.

## Required integration rules

You must adhere to the following rules to set your campaigns live:

* [The Game ID in the MMP integration must match the Game ID in the Unity dashboard](#the-game-id-must-match).
* [Postback windows must be set to lifetime](#postback-windows-must-be-set-to-lifetime).
* [Click-through lookback windows must be at least 2 days](#click-through-lookback-windows-must-be-at-least-2-days).
* [View-through lookback windows must be at least 7 days](#view-through-lookback-windows-must-be-at-least-7-days).
* [View-through attribution must be enabled](#view-through-attribution-must-be-enabled).
* [Level Complete event postbacks for Level Complete campaigns must contain values](#level-complete-event-postbacks-must-contain-values).
* [Purchase event postbacks for Purchase campaigns must contain values](#purchase-event-postbacks-must-contain-values).
* [Revenue event postbacks for Ad revenue campaigns must contain values](#revenue-event-postbacks-must-contain-values).
* [Session event postbacks for Retention campaigns must contain values](#session-event-postbacks-must-contain-values).
* [Purchase events must be correctly mapped for Payer campaigns](#purchase-event-postbacks-must-be-mapped-correctly).
* [AppsFlyer events must be mapped to the correct Unity event name](#appsflyer-events-must-be-mapped-to-the-correct-unity-event-name).
* [Within two days of launch, the app must have at least one install postback in the past 90 days](#app-must-receive-at-least-one-install-postback).
* [Within seven days of launch, campaigns must have one or more Ad Revenue event postbacks](#campaigns-must-receive-one-or-more-ad-revenue-postbacks).
* [Within seven days of launch, campaigns must have one or more In-app Purchase event postbacks](#campaigns-must-receive-one-or-more-in-app-purchase-postbacks).

Refer to the [Required resolutions](#required-resolutions) sections for instructions on how to resolve these issues.

## Recommended integration rules

The following integration aren't required to set your campaign live. However, failure to meet these recommended rules can negatively impact campaign performance and attribution:

* [Send Install event postbacks for users from all sources, including organic](#send-install-event-postbacks-for-users-from-all-sources).
* [Send post-install event postbacks for users from all sources, including organic](#send-post-install-event-postbacks-for-users-from-all-sources). This includes the following postback types:
  * Send In-app Purchase event postbacks for users from all sources, including organic.
  * Send Ad Revenue event postbacks for users from all sources, including organic.
  * Send Session event postbacks for users from all sources, including organic.
  * Send Level Complete event postbacks for users from all sources, including organic.

Refer to the [Recommended resolutions](#recommended-resolutions) sections for instructions on how to resolve these issues.

## Required resolutions

To meet the required integration rules, refer to the following sections.

### The Game ID must match

To meet this validation rule, ensure that the Game ID you enter in the AppsFlyer dashboard matches the Game ID in the Unity User Acquisition dashboard exactly. To retrieve your Game ID from the **Apps** page of the Unity dashboard, follow these steps:

1. Go to **Apps** from the left navigation menu of the dashboard. The provided table lists each of your organization's apps. Following each app name, the dashboard displays the app platform and Game ID.
2. Select the **Copy** symbol next to the ID to copy it to your clipboard.

You can also retrieve your Game ID from the **Campaigns**, **Campaign details**, and **Creative packs** pages of the dashboard. Refer to the [Game ID](/user-acquisition/getting-started/locate-advertiser-credentials.md#game-id) documentation for details.

### Postback windows must be set to lifetime

To meet this validation rule with AppsFlyer, set your In-app event postback window to `lifetime`. To set this window, follow these steps:

1. Go to the **In-app event postbacks** section of the **Integration** tab.
2. Activate the **In-app event postbacks** toggle.
3. Set the **In-app event postback window** to **lifetime**.


   **Lifetime postback window:**
   ![The in-app event postback window setting in the AppsFlyer integration setup](/api/media?file=/user-acquisition/media/images/appsflyer-lifetime-postback-window.png)

### Click-through lookback windows must be at least 2 days

To meet this validation rule, set your click-through lookback window to `2` days. To set this window, follow these steps:

1. Go to the **Install attribution** section of the **Integration** tab.
2. In the **Install engaged click-through lookback window** section, select **Days**.
3. Using the slider, set the window to **2** **Days**.


   **2-day click-through lookback window:**
   ![The install engaged click-through lookback window setting in the AppsFlyer integration setup](/api/media?file=/user-acquisition/media/images/appsflyer-click-through-lookback.png)

### View-through lookback windows must be at least 7 days

To meet this validation rule, set your view-through lookback window to `7` days. To set this window, follow these steps:

1. Go to the **Install attribution** section of the **Integration** tab.
2. In the **Install engaged view-through lookback window** section, select **Days**.
3. Using the slider, set the window to **7** **Days**.
4. Activate the **Install view-through attribution** toggle.


   **7-day view-through lookback window:**
   ![The install engaged view-through lookback window setting in the AppsFlyer integration setup](/api/media?file=/user-acquisition/media/images/appsflyer-view-through-lookback.png)

### View-through attribution must be enabled

To meet this validation rule, ensure that you enable view-through attribution in your AppsFlyer integration setup. To enable view-through attribution, follow these steps:

1. Go to the **Install attribution** section of the **Integration** tab.
2. Following the **Install engaged view-through lookback window** section, activate the **Install view-through attribution** toggle.


   **View-through attribution enabled:**
   ![The install view-through attribution toggle in the AppsFlyer integration setup](/api/media?file=/user-acquisition/media/images/appsflyer-view-through-lookback.png)

### Level Complete event postbacks must contain values

To meet this validation rule, ensure that you choose **Values & revenue** when you map Level Complete events in your AppsFlyer integration setup. To configure this data-sharing setting, follow these steps:

1. Go to the **In-app event postbacks** section of the **Integration** tab.
2. Activate the **In-app event postbacks** toggle.
3. In the **including** column of the mapping table, select **Values & revenue**:

Refer to the following example of correct mapping:

| AppsFlyer event     | mapped to partner event | for users from                       | including        |
| ------------------- | ----------------------- | ------------------------------------ | ---------------- |
| `af_level_achieved` | `level_complete`        | All media sources, including organic | Values & revenue |


**Share Level Complete event values and revenue:**
![The Values & revenue selection in the AppsFlyer event mapping table](/api/media?file=/user-acquisition/media/images/appsflyer-values-and-revenue.png)

### Purchase event postbacks must contain values

To meet this validation rule, ensure that you choose **Values & revenue** when you map Purchase events in your AppsFlyer integration setup. To configure this data-sharing setting, follow these steps:

1. Go to the **In-app event postbacks** section of the **Integration** tab.
2. Activate the **In-app event postbacks** toggle.
3. In the **including** column of the mapping table, select **Values & revenue**:

Refer to the following example of correct mapping:

| AppsFlyer event | mapped to partner event | for users from                       | including        |
| --------------- | ----------------------- | ------------------------------------ | ---------------- |
| `af_purchase`   | `purchase`              | All media sources, including organic | Values & revenue |


**Share Purchase event values and revenue:**
![The Values & revenue selection in the AppsFlyer event mapping table](/api/media?file=/user-acquisition/media/images/appsflyer-values-and-revenue.png)

### Revenue event postbacks must contain values

> **Important:**
>
> To map Ad revenue events with AppsFlyer, you must first [enable ad revenue](#campaigns-must-receive-one-or-more-ad-revenue-postbacks) sharing. Refer to the [AppsFlyer Ad revenue attribution](https://support.appsflyer.com/hc/en-us/articles/217490046-ROI360-guide-ad-revenue-attribution#connect-to-ad-revenue-integrated-partners) documentation for details and instructions.

To meet this validation rule, ensure that you choose **Values & revenue** when you map Ad revenue events in your AppsFlyer integration setup. To configure this data-sharing setting, follow these steps in the **Integration** tab of the AppsFlyer integration setup:

1. Go to the **In-app event postbacks** section of the **Integration** tab.
2. Activate the **In-app event postbacks** toggle.
3. In the **including** column of the mapping table, select **Values & revenue**:

Refer to the following example of correct mapping:

| AppsFlyer event | mapped to partner event | for users from                       | including        |
| --------------- | ----------------------- | ------------------------------------ | ---------------- |
| `af_ad_revenue` | `ad_revenue`            | All media sources, including organic | Values & revenue |


**Share Ad Revenue event values and revenue:**
![The Values & revenue selection in the AppsFlyer event mapping table](/api/media?file=/user-acquisition/media/images/appsflyer-values-and-revenue.png)

### Session event postbacks must contain values

To meet this validation rule, ensure that you choose **Values & no revenue** when you map Session events in your AppsFlyer integration setup. To configure this data-sharing setting, follow these steps:

1. Go to the **In-app event postbacks** section of the **Integration** tab.
2. Activate the **In-app event postbacks** toggle.
3. In the **including** column of the mapping table, select **Values & no revenue**:

Refer to the following example of correct mapping:

| AppsFlyer event | mapped to partner event | for users from                       | including           |
| --------------- | ----------------------- | ------------------------------------ | ------------------- |
| `af_app_opened` | `session`               | All media sources, including organic | Values & no revenue |


**Share Session event values only:**
![The Values & no revenue selection in the AppsFlyer event mapping table](/api/media?file=/user-acquisition/media/images/appsflyer-values-no-revenue.png)

### Purchase event postbacks must be mapped correctly

To meet this validation rule, ensure that you map Purchase events correctly in your AppsFlyer integration setup. To map your Purchase event postbacks, follow these steps:

1. Go to the **In-app event postbacks** section of the **Integration** tab.
2. Activate the **In-app event postbacks** toggle.
3. Map your Purchase event row as follows:

| AppsFlyer event | mapped to partner event | for users from                       | including        |
| --------------- | ----------------------- | ------------------------------------ | ---------------- |
| `af_purchase`   | `purchase`              | All media sources, including organic | Values & revenue |


**Purchase event mapping for In-app Purchase campaigns:**
![The event mapping table in the AppsFlyer integration setup](/api/media?file=/user-acquisition/media/images/appsflyer-purchase-event-mapping.png)

### AppsFlyer events must be mapped to the correct Unity event name

To meet this validation rule, ensure that you map all AppsFlyer event postbacks correctly. To map your events, follow these steps:

1. Go to the **In-app event postbacks** section of the **Integration** tab.
2. Activate the **In-app event postbacks** toggle.
3. Map your post-install events to Unity events in the **mapped to partner event** column as follows:
   * Session events to `session`
   * Level Complete events to `level_complete`
   * Ad Revenue events to `ad_revenue`
   * In-app Purchase events to `purchase`

Refer to the following example of correct event mapping:

| AppsFlyer event           | mapped to partner event | for users from                       | including           |
| ------------------------- | ----------------------- | ------------------------------------ | ------------------- |
| `af_purchase`             | `purchase`              | All media sources, including organic | Values & revenue    |
| `{custom_sdk_event_name}` | `level_complete`        | All media sources, including organic | Values & revenue    |
| `af_app_opened`           | `session`               | All media sources, including organic | Values & no revenue |
| `af_ad_revenue`           | `ad_revenue`            | All media sources, including organic | Values & revenue    |

> **Important:**
>
> To map Ad revenue events with AppsFlyer, you must first [enable ad revenue](#campaigns-must-receive-one-or-more-ad-revenue-postbacks) sharing. Refer to the [AppsFlyer Ad revenue attribution](https://support.appsflyer.com/hc/en-us/articles/217490046-ROI360-guide-ad-revenue-attribution#connect-to-ad-revenue-integrated-partners) documentation for details and instructions.

### App must receive at least one Install postback

To meet this validation rule, ensure that you configure your **Default postbacks** settings correctly so your campaigns can receive install postbacks. Configure these AppsFlyer integration settings as follows:

1. Go to the **Default postbacks** section of the **Integration** tab.
2. In the `Install` row, use the **for users from** dropdown to select **All media sources, including organic**.


   **Share all sources, including organic:**
   ![The Default postbacks section of the AppsFlyer integration setup](/api/media?file=/user-acquisition/media/images/appsflyer-default-install-postbacks.png)

### Campaigns must receive one or more Ad Revenue postbacks

To meet this validation rule, ensure that you enable ad revenue data in your AppsFlyer integration setup. To share ad revenue event data with your campaign, follow these steps:

1. Go to the **Ad revenue** tab of your AppsFlyer integration setup.

2. Activate the **Get ad revenue data** toggle.


   **Get ad revenue toggle:**
   ![The Ad revenue tab and Get ad revenue toggle in the AppsFlyer integration setup](/api/media?file=/user-acquisition/media/images/appsflyer-get-ad-revenue.png)

3. From the AppsFlyer dashboard side menu, go to **Settings** > **Revenue Settings**.

   > **Important:**
   >
   > To access the **Revenue Settings** menu, you need an AppsFlyer ROI360 subscription. Refer to the [AppsFlyer Ad revenue attribution](https://support.appsflyer.com/hc/en-us/articles/217490046-ROI360-guide-ad-revenue-attribution#connect-to-ad-revenue-integrated-partners) documentation for details and instructions.

4. In the **Ad revenue** tab of the **Revenue settings** page, select **New ad revenue integration**.

5. Select **Unity Ads** from the list of revenue partners.

6. In the partner configuration, select **Impression-level (via SDK) with Device-level (via S2S API)** as the report type.


   **AppsFlyer Revenue settings configuration:**
   ![The Impression-level with Device-level option in the AppsFlyer Ad revenue partner configuration](/api/media?file=/user-acquisition/media/images/appsflyer-ad-revenue-setup.png)

7. Enter your API credentials. Enter your [Game ID](/user-acquisition/getting-started/locate-advertiser-credentials.md#game-id) in the **App Key** field. To retrieve your **Secret key** from the Unity dashboard, refer to the following steps:

**Retrieve your Secret key:**

To retrieve your Secret key from the Unity Dashboard, follow these steps:

1. From the left navigation menu, go to **API Management**.

2. Select **Advertising Management API** > **Service account**.


   **Advertising Management Service account:**
   ![The API Management page of the User Acquisition dashboard](/api/media?file=/user-acquisition/media/images/api-service-account.png)

3. If you don't have a service account, select **+ New**. If you have a service account already, select it from the table.

4. In the service account page, go to the **Keys** section.

5. Select **+ Add key** to generate a new key.

6. Select the copy buttons following the **Secret key** to copy the ID.

### Campaigns must receive one or more In-app Purchase postbacks

To meet this validation rule, ensure that you map Purchase events correctly in your AppsFlyer integration setup. To map your Purchase event postbacks, follow these steps:

1. Go to the **In-app event postbacks** section of the **Integration** tab.
2. Activate the **In-app event postbacks** toggle.
3. Map your Purchase event row as follows:

| AppsFlyer event | mapped to partner event | for users from                       | including        |
| --------------- | ----------------------- | ------------------------------------ | ---------------- |
| `af_purchase`   | `purchase`              | All media sources, including organic | Values & revenue |


**Purchase event mapping for In-app Purchase campaigns:**
![The event mapping table in the AppsFlyer integration setup](/api/media?file=/user-acquisition/media/images/appsflyer-purchase-event-mapping.png)

## Recommended resolutions

To meet the recommended integration rules, refer to the following sections.

### Send Install event postbacks for users from all sources

To meet this recommended integration rule, ensure that you send Install event postback **for users from all media sources, including organic**. To do so, follow these steps:

1. Go to the **Default postbacks** section of the **Integration** tab of the AppsFlyer integration.
2. Use the **for users from** dropdown to select **All media sources, including organic** for Install events.


**Share all install postbacks for users from all media sources, including organic:**
![The Default postbacks section of the AppsFlyer Integration tab](/api/media?file=/user-acquisition/media/images/appsflyer-default-install-postbacks.png)

### Send post-install event postbacks for users from all sources

To meet all the post-install event recommended integration rules, ensure that you share event postbacks for users from **All media sources, including organic** when you map your events. To do so, follow these steps:

1. Go to the **In-app event postbacks** section of the **Integration** tab.
2. Activate the **In-app event postbacks** toggle.
3. In the **for users from** column, select **All media sources, including organic** for each of the following event types:

   * `purchase`
   * `ad_revenue`
   * `level_complete`
   * `session`


   **Share post-install event postbacks for users from all media sources, including organic:**
   ![The All media sources, including organic selection in the AppsFlyer event mapping table](/api/media?file=/user-acquisition/media/images/appsflyer-for-users-from-dropdown.png)
