Preparing mediated networks

When you integrate third-party SDKs into your Mobile Property, you are solely responsible for such integrations. You and the third-party SDK provider must ensure compliant data processing and treatment of any user-based or device-based privacy choices or flags.

This page shows you how to integrate MAX mediation network adapters in your app. Choose which mediated ad networks you want to integrate by checking the boxes below. Then this page will display instructions specific to those networks.

    Android

    Select the ad networks you want to integrate. Then follow the Android-specific instructions on this page.

  • Google Ad Manager
  • Google Bidding and Google AdMob
  • InMobi
  • Meta Audience Network
  • Pangle
  • VK Ad Network
  • Developers and publishers who use Google AdSense, AdManager, or AdMob must use a consent management platform (CMP) that Google certifies. The CMP must integrate with IAB’s Transparency and Consent Framework when you serve ads to users in the European Economic Area (EEA) or the UK. See Privacy: “TCF v2 consent” for more information.

    Add your Google bidding and Google AdMob app IDs

    1. Open the Integration Manager (AppLovin > Integration Manager).
    2. Install the latest Google bidding and Google AdMob adapter:
      1. Click Install in the Actions column next to Google bidding and Google AdMob in the Mediated Networks section of the Integration Manager.
      2. Click Import in the Import Unity Package dialog.
    3. Two new fields for your App IDs will appear in the Mediated Networks section of the Integration Manager. Enter the corresponding values there. Google bidding and Google AdMob. App ID (Android). App ID (iOS).

    Gradle errors

    Google AdMob requires Android Gradle plugin version 4.2.0 or higher and Gradle version 6.7.1 or higher. If you see the following error, update your Android Gradle plugin and Gradle versions:

    AAPT: error: unexpected element <property> found in <manifest><application>.
    

    To update your Android Gradle plugin and Gradle versions, take the following steps:

    1. In Unity, open Project Settings > Player > Android > Publishing Settings > Build.
    2. Check Custom Base Gradle Template. Build: Custom Base Gradle Template (Assets/Plugins/Android/baseProjectTemplate.gradle)
    3. Edit the Assets/Plugins/Android/baseProjectTemplate.gradle file. Set the dependencies to use Gradle build tools version 4.2.0:
      allprojects {
        buildscript {
          dependencies {
            classpath 'com.android.tools.build:gradle:4.2.0'
            «build script dependencies»
          }
        }
      }
      
    4. Download and install Gradle version 6.7.1 or higher.
    5. In Unity, open Unity Preferences > External Tools.
    6. Set the custom Gradle path so that it points to your newly-updated Gradle installation. ☐ Gradle installed with Unity (recommended). Gradle: /path/to/gradle-6.7.1. Browse button. Warning: You are not using the recommended Gradle, other versions are not officially supported.

    Meta Audience Network SDK migration

    If your project uses the Meta Audience Network Unity SDK, you must be on version 11.0 or later for the MAX Meta Audience Network adapter to function. To migrate from an older version of Meta Audience Network Unity SDK, delete the Assets/FacebookSDK directory, then download and re-import the latest version here.

    Meta Audience Network data processing options

    If you aren’t using the Meta Audience Network Unity Plugin, follow the instructions here under “Unity SDK, v5.10+ (not using the Audience Network-supplied Unity wrapper)” to add a wrapper for the relevant methods.

    If you do not want to enable Limited Data Use (LDU) mode, pass SetDataProcessingOptions() an empty string array:

    using AudienceNetwork;
    ⋮
    AdSettings.SetDataProcessingOptions(new string[] { });
    ⋮
    // Initialize MAX SDK

    If you want to enable LDU for users and to specify user geography, call SetDataProcessingOptions() like this:

    using AudienceNetwork;
    ⋮
    AdSettings.SetDataProcessingOptions(new string[] {"LDU"}, «country», «state»);
    ⋮
    // Initialize MAX SDK

    Using Google UMP

    If you use Google UMP as your CMP, you can determine whether the user consented to Meta. To do so, use the following code:

    bool? hasMetaConsent = MaxSdkUtils.GetAdditionalConsentStatus(89);
    if ( hasMetaConsent != null )
    {
      // Set Meta Data Processing Options accordingly.
    }
    else
    {
      // AC String is not available on disk. Please check for consent status after the user completes the CMP flow.
    }

    Meta Audience Network data processing options for users in California

    To learn how to implement Meta Audience Network’s “Limited Data Use” flag in California, read the Meta for Developers documentation.

    Android manifest merging errors

    Some network SDKs include the <queries> element in their bundled Android Manifest files. If you use an incompatible version of the Android Gradle plugin, this causes one of the following build errors:

    com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
    error: unexpected element <queries> found in <manifest>.
    

    To fix this error, upgrade to one of the following versions of the Android Gradle plugin. These versions support the <queries> element:

    Upgrade the Android Gradle Plugin, not the Gradle Build Tools.

    Current Android Gradle plugin versionVersion that supports <queries> element
    4.1.*All
    4.0.*4.0.1+
    3.6.*3.6.4+
    3.5.*3.5.4+
    3.4.*3.4.3+
    3.3.*3.3.3+

    To update the Gradle Plugin version to a compatible one, enable the custom base Gradle template:

    1. Select Edit > Project Settings….
    2. Choose Player and select the tab labeled with the Android icon.
    3. Open Publisher Settings and check Custom Base Gradle Template.

    The template is Assets/Plugins/Android/mainTemplate.gradle for Unity 2019.2 or below, and Assets/Plugins/Android/baseProjectTemplate.gradle for Unity 2019.3 or above. In that template, update the line below with the appropriate Gradle version:

    classpath com.android.tools.build:gradle:«x».«x».«x»
    

    compileSdkVersion

    Google Mobile Ads SDK versions 23.1.0 and newer require a compileSdkVersion of at least 34.

    Set the compileSdkVersion to 34 or higher in your app’s build.gradle.

    Refer to the Google Mobile Ads SDK Release Notes for the latest compileSdkVersion requirements.

    iOS

    Select the ad networks you want to integrate. Then follow the iOS-specific instructions on this page.

  • Google Ad Manager
  • Google Bidding and Google AdMob
  • InMobi
  • Meta Audience Network
  • Pangle
  • VK Ad Network
  • Developers and publishers who use Google AdSense, AdManager, or AdMob must use a consent management platform (CMP) that Google certifies. The CMP must integrate with IAB’s Transparency and Consent Framework when you serve ads to users in the European Economic Area (EEA) or the UK. See Privacy: “TCF v2 consent” for more information.

    Add your Google bidding and Google AdMob app IDs

    Open the Integration Manager (AppLovin > Integration Manager) and install the latest Google bidding and Google AdMob adapter:

    1. Click Install in the Actions column next to Google bidding and Google AdMob in the Mediated Networks section of the Integration Manager.
    2. Click Import in the Import Unity Package dialog.
    3. Two new fields for your App IDs will appear in the Mediated Networks section of the Integration Manager. Enter the corresponding values there. Google Bidding and Google AdMob. App ID (Android). App ID (iOS).

    Meta Audience Network SDK migration

    If your project uses the Meta Audience Network Unity SDK, you must be on version 11.0 or later for the MAX Meta Audience Network adapter to function. To migrate from an older version of Meta Audience Network Unity SDK, delete the Assets/FacebookSDK directory, then download and re-import the latest version here.

    Meta Audience Network data processing options

    If you aren’t using the Meta Audience Network Unity Plugin, you can follow the instructions here under “Unity SDK, v5.10+ (not using the Audience Network-supplied Unity wrapper)” to add a wrapper for the relevant methods.

    If you do not want to enable Limited Data Use (LDU) mode, pass SetDataProcessingOptions() an empty string array:

    using AudienceNetwork;
    ⋮
    AdSettings.SetDataProcessingOptions(new string[] { });
    ⋮
    // Initialize MAX SDK

    If you want to enable LDU for users and to specify user geography, call SetDataProcessingOptions() like this:

    using AudienceNetwork;
    ⋮
    AdSettings.SetDataProcessingOptions(new string[] {"LDU"}, «country», «state»);
    ⋮
    // Initialize MAX SDK

    Using Google UMP

    If you use Google UMP as your CMP, you can determine whether the user consented to Meta. To do so, use the following code:

    bool? hasMetaConsent = MaxSdkUtils.GetAdditionalConsentStatus(89);
    if ( hasMetaConsent != null )
    {
      // Set Meta Data Processing Options accordingly.
    }
    else
    {
      // AC String is not available on disk. Please check for consent status after the user completes the CMP flow.
    }
    Meta Audience Network data processing options for users in California

    To learn how to implement Meta Audience Network’s “Limited Data Use” flag in California, read the Meta for Developers documentation.

    Meta preparing for iOS 14.5 and above

    Version 6.2.1 of Audience Network SDK introduces the following requirement:

    • Implement the setAdvertiserTrackingEnabled flag, irrespective of the use of mediation. This informs Meta whether to use the data to deliver personalized ads.
    MaxSdkCallbacks.OnSdkInitializedEvent += (MaxSdk.SdkConfiguration sdkConfiguration) => {
    
    #if UNITY_IOS || UNITY_IPHONE || UNITY_EDITOR
      if (MaxSdkUtils.CompareVersions(UnityEngine.iOS.Device.systemVersion, "14.5") != MaxSdkUtils.VersionComparisonResult.Lesser)
      {
        // Note that App transparency tracking authorization can be checked via `sdkConfiguration.AppTrackingStatus` for Unity Editor and iOS targets
        // 1. Set Meta ATE flag here, THEN
      }
    #endif
    
      // 2. Load ads
    };

    Starting from Pangle iOS adapter version 4.9.1.0.0, Pangle is no longer available in Chinese Mainland. To monetize Chinese Mainland traffic, configure the CSJ network and add the CSJ adapter. For global traffic that excludes Chinese Mainland, you can continue to use Pangle for monetization.

    SKAdNetwork

    The Integration Manager automatically integrates SKAdNetwork IDs of integrated networks on your behalf.

To integrate Amazon for Unity, refer to the Amazon Publisher Services integration instructions page.

Integration Manager

You can access the AppLovin Integration Manager from your Unity IDE. It allows you to install or upgrade mediation adapters and the mediation plugin itself.

To launch the Integration Manager, select AppLovin > Integration Manager from the Unity menu bar.

AppLovin > Integration Manager

This displays a pop up window with a list of available mediation networks. You can Install or Upgrade ad networks by clicking buttons in the Action column.

AppLovin Integration Manager: AppLovin MAX Plugin Details. Mediated Networks. AppLovin Quality Service. Unity Environment Details

Manual download

Loading…


Was this article helpful?
Was this article helpful?
search