Documentation

User Acquisition

Integrate AppsFlyer with Unity

Activate the Unity Ads integration in the AppsFlyer dashboard, enable full data-sharing, map events, and set partner permissions.
Read time 7 minutesLast updated a month ago

Important
The following documentation discusses products or services (“Third-party Products”) not developed, owned, or operated by Unity. This information might be outdated or incomplete and is provided for your convenience. Your use of any Third-party Product is subject to its own terms. Unity makes no warranties regarding these products and isn't liable for any damages or losses arising from their use, including issues related to content, advertising, or materials from Third-party providers.
Set up AppsFlyer as your Mobile Measurement Partner (MMP) for Unity User Acquisition campaigns. Integration includes the following setup tasks:
For the most up-to-date AppsFlyer integration information, consult the AppsFlyer Help Center.

Prerequisites

Before setup, ensure you meet the following requirements:

Integrate Unity with AppsFlyer

Complete the following steps to integrate AppsFlyer with your User Acquisition campaign:

Activate the Unity Ads integration

To activate Unity Ads in the AppsFlyer dashboard, follow these steps:
  1. In the AppsFlyer dashboard, go to Collaborate > Partner Marketplace.
  2. Search for Unity Ads and select Set up integration to open in the Integration tab.
  3. Activate the Activate Partner toggle.
  4. Some advertisers might have an Advanced Privacy toggle in the Integration tab. If your dashboard contains this toggle, ensure that you deactivate it.
Important
If Advanced Privacy is active in your integration setup, AppsFlyer can't share any event data with your campaign.
Deactivate Advanced Privacy

Deactivate Advanced Privacy

Configure general integration settings

To configure your general integration settings, follow these steps in the Integration tab > General settings section:
  1. Activate the Share organic/non-organic indication toggle.
Share organice and non-organic

Share organic and non organic

  1. Enter your Unity Game ID in the Unity Ads Game ID field. To copy your Game ID from the Unity Dashboard, refer to the following steps:

To copy your Game ID from the User Acquisition 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.
  2. Scroll or search to locate the desired app.
  3. Select Settings () at the end of the app row to open the app details page.
  4. Go to the MMP settings section.
  5. Select copy () next to Game ID to copy the ID to your clipboard.
Note
Enter your Game ID exactly as shown in the User Acquisition dashboard. Mismatched Game IDs prevent Unity from receiving events correctly.

Configure attribution settings

To set up attribution for your integration, follow these steps in the Integration tab of your AppsFlyer integration:
1

Set the click-through lookback window

Set the click-through lookback window to 2 Days.
To set the window, follow these steps in the Install attribution section:
  1. Set the Install engaged click-through lookback window to Days.
  2. Using the slider, set the window to 2 Days.
2

Enable view-through attribution

To enable view-through attribution, activate the Install view-through attribution toggle.
3

Set the view-through lookback window

Set the view-through lookback window to 7 Days.
To set the window, follow these steps in the Install attribution section:
  1. Set the Install engaged view-through lookback window to Days.
  2. Using the slider, set the window to 7 Days.
Lookback windows

Lookback windows

4

Share default install postbacks with all sources

Include all of your users in install postbacks.
To set the users for Install events, go to the Default postbacks section and select for users from > All media sources, including organic
All media sources, including organic

All media sources, including organic

Configure data-sharing settings

To set up secondary postbacks for post-install events, follow these steps:
1

Enter your Game ID

Enter your Game ID in the game_id field.To copy your Game ID from the Unity Dashboard, refer to the following steps:

To copy your Game ID from the User Acquisition 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.
  2. Scroll or search to locate the desired app.
  3. Select Settings () at the end of the app row to open the app details page.
  4. Go to the MMP settings section.
  5. Select copy () next to Game ID to copy the ID to your clipboard.
Note
Enter your Game ID exactly as shown in the User Acquisition dashboard. Mismatched Game IDs prevent Unity from receiving events correctly.
2

Enable post-install event postbacks

Enable post-install event postbacks and set the postback window to Lifetime.
To enable the postbacks and set the window, follow these steps in the Integration tab > In-app event settings section:
  1. Activate the In-app event postbacks toggle.
  2. Set the In-app event postback window to Lifetime.
Lifetime in-app event postbacks

Lifetime in-app event postbacks

3

Map events

Map AppsFlyer post-install events to the correct Unity Ads event name.
You can map any in-app event you set up in the AppsFlyer dashboard. Refer to AppsFlyer's In-app events documentation for a list of AppsFlyer event names.
To map your AppsFlyer events to Unity events, follow these steps in the Integration tab > In-app event postbacks section:
  1. Go to Collaborate > Partner Marketplace and search for
    Unity Ads
    to open your Unity Ads integration.
  2. In the Integration tab, go to the In-app event postbacks section.
  3. Activate the In-app event postbacks toggle.
  4. 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 table for suggested AppsFlyer event names and required Unity event names:

Event type

Suggested AppsFlyer event

Required Unity partner event

Mapping notes

Session
af_app_opened
session
-
Ad revenue
af_ad_revenue
ad_revenue
If your AppsFlyer account supports ad revenue data-sharing, enable ad revenue sharing with the Get ad revenue data toggle in the Ad revenue tab.
Otherwise, don't send ad revenue events. Mapping ad revenue events as other event types can cause campaign optimization to stop working. Refer to the AppsFlyer Ad revenue attribution documentation for details and instructions.
In-app purchase
af_purchase
purchase
Don't map revenue events to purchase events.
Milestone completion
  • af_level_achieved
  • {custom_milestone_event}
level_complete
You must enter
level_complete
in the mapped to partner event field. You can enter custom SDK event names in the AppsFlyer event field.
You must enter the required Unity event name in the mapped to partner event field. You can enter custom SDK event names in the AppsFlyer event field. However, the recommended best practice is to use the Suggested AppsFlyer event names provided here.

Enable ad revenue data-sharing

If you want to send ad revenue data for Return on Ad Spend (ROAS) Ad revenue or Hybrid campaigns, you must enable ad revenue data-sharing in your integration.
To share ad revenue event data with your campaign, follow these steps:
1

Activate ad revenue sharing

To activate ad revenue data-sharing, follow these steps in the AppsFlyer dashboard:
  1. Go to Collaborate > Partner Marketplace and search for
    Unity Ads
    to open your Unity Ads integration.
  2. In the Ad revenue tab, activate the Get ad revenue data toggle.
The Ad revenue tab and Get ad revenue toggle in the AppsFlyer integration setup.

Get ad revenue toggle

2

Configure ad revenue data-sharing

To configure your ad revenue data-sharing settings, follow these steps in the AppsFlyer dashboard:
  1. 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 documentation for details and instructions.
  1. In the Revenue settings > Ad revenue tab, select New ad revenue integration.
  2. Select Unity Ads from the list of revenue partners.
  3. In the partner configuration, select Impression-level (via SDK) with Device-level (via S2S API) as the report type.
The Impression-level with Device-level option in the AppsFlyer Ad revenue partner configuration.

AppsFlyer Revenue settings configuration

3

Enter your API credentials

To finish your ad revenue data-sharing setup, follow these steps in the AppsFlyer dashboard Revenue Settings:
  1. Enter your Unity Game ID in the App key field. To retrieve your Game ID from the Unity Dashboard, refer to the following steps:

To copy your Game ID from the User Acquisition 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.
  2. Scroll or search to locate the desired app.
  3. Select Settings () at the end of the app row to open the app details page.
  4. Go to the MMP settings section.
  5. Select copy () next to Game ID to copy the ID to your clipboard.
  1. Enter your Unity API Service account secret key in the Secret key field. To retrieve your secret key from the Unity Dashboard, refer to the following steps:

Note
Only Organization Owners or Organization Managers can create service accounts and secret keys. Refer to User types, roles, and permissions for more information.
To retrieve your Secret key and Key ID from the User Acquisition dashboard, follow these steps:
1

Create or open your service account

To generate API keys, you need a service account. To access your service account, follow these steps:
  1. Go to Settings > API management.
The API management page of the User Acquisition dashboard

API management

  1. In the Stats API v2.0 section, select Service account.
  2. On the Service accounts page, select your account from the table. If you don't have a service account, select + New to create one.
2

Generate keys

To generate a secret key and key ID, follow these steps:
  1. From your service account page, go to the Keys section.
  2. Select + Add key to generate a Key ID and Secret key. You can't view previously-generated keys.
  3. Select the copy buttons following the Key ID and the Secret key to copy both credentials.
Important
The dashboard displays the Secret key only once. Store the Key ID and Secret key together somewhere secure. If you lose the Secret key, you must create a new key.
3

Assign the organization role

A service account with no role assigned can still authenticate, but every request it makes fails with a
403
error and an Invalid Credentials message. You must assign the Advertise Stats API MMP Viewer role to your service account before you use its credentials.
To assign this role, follow these steps from your service account:
  1. In the Organization roles section, select + Manage organization roles.
  2. Open the User Acquisition category and select Advertise Stats API MMP Viewer.
  3. Select Save.

Set partner permissions

In the Permissions tab, configure the following permissions settings:
  1. Activate the Toggle Ad Network Permissions toggle to enable all other toggles.
  2. Activate the following toggles:
  • Configure integration
  • Configure in-app event postbacks
  • Access retention report
  • Access aggregate conversions and in-app event data
  • Access aggregate revenue data
  • View validation rules
  • Access Protect360 dashboard and raw data
  • Access ad revenue raw data (UA signals)
For descriptions of each permission, refer to the Permissions tab documentation in the AppsFlyer Help Center.