UnityAds Mediation Integration Guide

This guide will instruct you step-by-step on how to set UnityAds live as an Ad Network on Unity LevelPlay.

Before you start Make sure you have correctly integrated ironSource’s Rewarded Video, Interstitial or Banner into your application.
  • UnityAds Supports Android Operating Systems Version 4.4 (API level 19) and up.

Step 1. Create a UnityAds Account

  1. Create an account with UnityAds. You can do so here.
  2. Once your account has been verified you can log in at their partner login here.

Step 2. Create an Application and Placement in UnityAds

Follow these steps to create your UnityAds application:

  1. Create Application
    1. Once you login, navigate to the Developer Dashboard and select the Operate tab:
      unity-1
    2. Then add a new project:
      unity-2
    3. Name your new project and enter the store IDs you wish to publish on (Apple App Store or Google Play). If the game hasn’t been published yet you can always add the IDs later.
      unity-3
      Note: You will need a unique UnityAds application per platform (iOS + Android) just like you do with your ironSource account.
  2. Create Placement
    UnityAds creates two default placements: one for Video (Interstitial on the ironSource Dashboard) and on for Rewarded Video. To view your placements or create new placements, including Banner, to run with Unity LevelPlay:
    1. From Operate tab of the Developer Dashboard, select your Project:
      unity-4
    2. Select Platforms from the left navigation bar to view a list of your Project’s active platforms:
      unity-5
    3. Then, select the platform you want to create Placements for:
      unity-6
    4. Click on ‘ADD NEW PLACEMENT’
      unity-7
    5. The below window will appear and you must fill in the following info:
      1. Check Rewarded video to make the ads displayed through this Placement unskippable.
      2. Select the ad Type to display through this Placement (currently, Video is the only option).
      3. Name the Placement. The Placement ID, which you call in your code implementation, automatically populates based on your entry.
      4. Check mute audio if you want the ad to default to muted audio.
      5. If you did not check Rewarded video, you can specify the number of seconds to Allow skip after for ads displayed through this Placement.
        unity-8
      6. After clicking ‘Save‘, you should see your manually added placement under your default placements:
        unity-9

      Step 3. Activate UnityAds on ironSource Network SDK Setup

      Immediately after you confirm your application, you will be redirected to a summary page open to the ‘Monetization Settings’ tab. There you will find 3 pieces of Data from your UnityAds account which need to be input into your ironSource Network Setup Module in order for UnityAds to work correctly in connection with Unity LevelPlay:

      Game ID This is the unique identifier of your Application in UnityAd’s system.
      Placement ID
      This is the unique identifier of your Ad Placement in UnityAd’s system. Two Ad Placements are created by default for your application; a Rewarded and Non-Rewarded placement.
      API Key
      This is a unique identifier for your UnityAds account, which allows Unity LevelPlay to import performance data from your UnityAds account to use in reporting & optimization.
      Organization core ID This is a unique identifier for your UnityAds account, which allows Unity LevelPlay to import performance data from your UnityAds account to use in reporting & optimization.

      Once you obtain this information, you must configure UnityAds Parameters in your ironSource Account. By adding the above information correctly, you will be able to take full advantage of UnityAds’ ad inventory and reporting data on Unity LevelPlay.

    1. Game ID

      Go to Operate tab and select your Project, then select Platforms from the left navigation bar. You will then see a list of all added apps in that project as well as their respective Game IDs:
      unity-10

    2. Placement ID
      Go to Operate tab and select your Project, then select Platforms from the left navigation bar. Choose the platform you want to see placements for:

      unity-11

      Select the relevant application from the available list and under the ‘Ad Placements‘ tab you will see the placement IDs for all your placements. Choose the ID of the default ad type (Rewarded video, video or one of the placements you created)

    3. API Key
      Navigate to the main Operate section and click on API Access. You will then see your API Key.
    4. Organization core ID

    Navigate to the main Operate section and click on Settings. You will then see your Organization core ID:

    Configure UnityAds’s Parameters into ironSource Account

    Once you have all of these parameters, log in to your ironSource account.

    • Go to ‘Monetize‘ ➣ ‘SDK Networks‘ ➣ ‘Available Networks‘.

      unity-13

    • Select UnityAds from the list of available Ad Networks and input the UnityAds ‘API Key‘ and Organizational ID in the relevant fields.
    • Make sure you choose the app you want to integrate from the apps list on the left side of the SDK networks page.
    • Click on the unity ads’ Setup button and enter the ‘Game ID‘ and ‘Placement ID‘ under the relevant Ad Unit Settings:
      unity-last
    • You will then see UnityAds as Active for Mediation on your Setup Dashboard.
    • New! Verify your integration with the Reporting API; this column will check your integration through the Reporting API and return three possible responses: Verified, Failed and No Response. Double check your integration and the information you entered above; then click ‘Retry‘ until you see ‘Verified’.

    Step 4. Add the UnityAds Adapter to Your Build

    Unity LevelPlay supports both Gradle dependencies and manual download mechanisms.

    Gradle

    1. Make sure the following Maven URL exist in your build.gradle script of your app module (should appear only once for all the adapters).
      repositories {
      maven {
      url "https://android-sdk.is.com/"
      }
      }
    2. Add the adapter’s Maven name to your build.gradle script of your app module.
      implementation 'com.ironsource.adapters:unityadsadapter:4.3.26'
      implementation 'com.unity3d.ads:unity-ads:4.6.0'

    Manual Download

      1. Download the UnityAds Adapter and SDK:
        This will add the UnityAds Adapter and SDK to your build. You can find the latest UnityAds files here.
      2. Add the UnityAds Adapter to your Project:
        After you download the Adapter; drop the UnityAdsAdapter jar into the libs folder in your Android Project.

    Unity integration with Supersonic Mediation - 08

    1. Make sure to add the following to your Gradle build file under the dependencies section:
      implementation 'com.ironsource.adapters:unityadsadapter:4.3.26'
      implementation 'com.unity3d.ads:unity-ads:4.6.0'

    Step 5. Update AndroidManifest.xml

    As of UnityAds Android adapter version 4.3.4+ (Android SDK Version 6.17.0), UnityAds adapter will be released as AAR. Only if you intend to keep your Jar integration, please add the manifest.

    Manifest Permissions:

    <uses-permission android:name="android.permission.INTERNET" /> 
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    Manifest Activities
    Add the following activities inside the manifest tag and the <application> tag:

    <activity
        android:name="com.unity3d.services.ads.adunit.AdUnitActivity"
        android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
        android:hardwareAccelerated="true"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
    <activity
        android:name="com.unity3d.services.ads.adunit.AdUnitTransparentActivity"
        android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
        android:hardwareAccelerated="true"
        android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    <activity
        android:name="com.unity3d.services.ads.adunit.AdUnitTransparentSoftwareActivity"
        android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
        android:hardwareAccelerated="false"
        android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    <activity
        android:name="com.unity3d.services.ads.adunit.AdUnitSoftwareActivity"
        android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
        android:hardwareAccelerated="false"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
    When upgrading to UnityAds adapter 2.1.0 from an older adapter version, make sure to remove the AAR from your project as well as the compile project (‘:unity-ads’) code in your dependencies section.

    For ProGuard Users Only 

    If you are using ProGuard with the UnityAds adapter, you must add the following code to your ProGuard configuration (Android Studio: proguard-rules.pro or Eclipse: proguard-project.txt):

    # Keep filenames and line numbers for stack traces
    -keepattributes SourceFile,LineNumberTable
    # Keep JavascriptInterface for WebView bridge
    -keepattributes JavascriptInterface
    # Sometimes keepattributes is not enough to keep annotations
    -keep class android.webkit.JavascriptInterface {
       *;
    }
    # Keep all classes in Unity Ads package
    -keep class com.unity3d.ads.** {
       *;
    }
    # Keep all classes in Unity Services package
    -keep class com.unity3d.services.** {
       *;
    }
    -dontwarn com.google.ar.core.**
    -dontwarn com.unity3d.services.**
    -dontwarn com.ironsource.adapters.unityads.**

    Step 6. UnityAds Additional Settings

    User-level COPPA

    Unity LevelPlay lets publishers communicate UnityAds User-level COPPA settings directly to the UnityAds network. This feature is enabled using ironSource SDK 7.1.12+, UnityAds Android Adapter 4.3.15+.

    Use the following syntax, to set UnityAds user.nonBehavioral flag with the parameter True:

     IronSource.setMetaData("UnityAds_coppa","true");

    Use the following syntax, to set UnityAds user.nonBehavioral flag with the parameter False:

     IronSource.setMetaData("UnityAds_coppa","false");

    Done!
    You are now all set to deliver UnityAds Ads within your application!


    What’s Next?

    To leverage additional ad networks through ironSource Mediation, integrate the adapters and follow our integration guides