Integrate Ad Quality SDK

The Ad Quality SDK enables you to run Ad Quality in your app. It automatically collects all the ad events and attributes needed from the ad network SDKs you currently use. This makes the integration simple and requires minimal coding.

Important! Make sure you’ve added at least one app to your ironSource account before you integrate the Ad Quality SDK.

LevelPlay publishers can integrate and update the Ad Quality SDK as part of the mediation integration using one line of code. see the documentation here.

Step 1: Import the Ad Quality SDK to your app

  1. Use the following download link to add the Unity3D Package to your project:
  2. Make sure your Unity3D project is open and import the Unity3D package.
  3. Double-click on the extracted file. The different files will be populated automatically as shown below:
    Go to: Assets → External Dependency Manager → Android Resolver → Resolve

Important! For an android integration, make sure you use the “Resolve” process.
This will download all relevant artifacts, according to your choices.

Go to: Assets → External Dependency Manager → Android Resolver → Resolve

Step 2: Initialize the SDK

  1. Initialize the Ad Quality SDK using your ironSource app key, which can be found in the Unity LevelPlay Platform.
  2. Add the following code to your app’s main thread, or on the same thread as your other ad network SDKs to initialize the Ad Quality SDK:

Add the following code to the Awake method of your first scene:

void Awake ()
{
   // Initialize
   IronSourceAdQuality.Initialize(appKey);
}

Step 3 (optional): Advanced SDK Initialization

Note: If you’re using LevelPlay make sure you’ve init Ad Quality first to use the following functionalities 

Customize your integration settings to get even more functionality with these special configurations:

  1. User ID – Use your own user IDs, instead of the default IDs from Ad Quality
  2. Test mode – Test your Ad Quality SDK integration (default is false)
  3. Log level – Choose a log level to debug code issues (default is INFO)

Use the code below to create your config object with a builder.

Add the following code in the Awake method of your first scene:

ISAdQualityConfig adQualityConfig = new ISAdQualityConfig();

User ID

The Ad Quality SDK provides two options for configuring your user IDs:

1.Use your own user IDs, and add them before or during initialization:

adQualityConfig.UserId = userId;
// The default user id is Ad Quality internal id.
// The only allowed characters for user id are: letters, numbers, @, -, :, =,_ and /.
// The user id cannot be null and must be between 2 and 100 characters, otherwise it will be blocked.

2.Change the default user IDs after initializing the Ad Quality SDK, for cases for your ID’s are set later.

IronSourceAdQuality.ChangeUserId(userId);
// The default user id is Ad Quality internal id. 
// The only allowed characters for user id are: letters, numbers, @, -, :, =,_ and /. 
// The user id cannot be null and must be between 2 and 100 characters, otherwise it will be blocked.

Test Mode

adQualityConfig.TestMode = true;
// The default is false - set to true only to test your Ad Quality integration

Log level

adQualityConfig.LogLevel = ISAdQualityLogLevel.INFO;
// There are 5 different log levels:
// ERROR, WARNING, INFO, DEBUG, VERBOSE
// The default is INFO
IronSourceAdQuality.Initialize(appKey, adQualityConfig);

Step 4 (optional): Configure SDK callback events

Note: If you’re using LevelPlay make sure you’ve init Ad Quality first to use the following functionalities 

Unity3d callbacks should be implemented in a separate class, in the same place where the Ad Quality SDK was initialized.

public class AdQualitySdkInit: ISAdQualityInitCallback {

   public void adQualitySdkInitSuccess() {
       Debug.Log("unity: adQualitySdkInitSuccess");
   }
   public void adQualitySdkInitFailed(ISAdQualityInitError adQualitySdkInitError, string errorMessage) {
       Debug.Log("unity: adQualitySdkInitFailed " + adQualitySdkInitError + " message: " + errorMessage);
   }
}

AdQualitySdkInit adQualitySdkInit = new AdQualitySdkInit();
ISAdQualityConfig adQualityConfig = new ISAdQualityConfig {
   AdQualityInitCallback = adQualitySdkInit
};

IronSourceAdQuality.Initialize(appKey, adQualityConfig);

Note:   The time it takes s to initialize the Ad Quality SDK depends on the number of ad network SDKs integrated into your app. Network connectivity issues may also cause delays. On average, initializations take between 3 – 4 seconds.

Step 5 (optional): Report impression-level ad revenue to Ad Quality SDK

Note: If you’re using LevelPlay make sure you’ve init Ad Quality first to use the following functionalities 

Note:  The feature is support for fullscreen ads only. For LevelPlay, MAX and DT FairBid this data is being collected automatically

Ad Quality SDK 7.2.0+ supports impression-level ad revenue report:

To report Impression-level ad revenue in the Ad Quality SDK, add the code snippet below to your SDK integration.

Important! sendCustomMediationRevenue method should be called when the ad displayed, calling it out of ad lifecycle have no affect 

ISAdQualityCustomMediationRevenue customMediationRevenue = new ISAdQualityCustomMediationRevenue();
customMediationRevenue.MediationNetwork = ISAdQualityMediationNetwork.SELF_MEDIATED;
customMediationRevenue.AdType = ISAdQualityAdType.REWARDED_VIDEO;
customMediationRevenue.Revenue = 1.2;
IronSourceAdQuality.SendCustomMediationRevenue(customMediationRevenue);

If you’re using AdMob mediation, follow these steps:

  1. Ask your AdMob account manager to enable AdMob impression-level LTV (iLTV)
  2. Verify that you use GMA SDK 8.12.0 or higher for Android or iOS and that the version supports iLTV
  3. Add the following code snippet to your Ad Quality SDK integration:

RewardedAd rewardedAd;
public void HandleRewardedAdLoaded(object sender, EventArgs args)
{
    this.rewardedAd = args.rewardedAd;
}
private void HandleAdPaidEvent(object sender, AdValueEventArgs args)
{
   AdValue impressionData = args.AdValue;
   ISAdQualityCustomMediationRevenue customMediationRevenue = new ISAdQualityCustomMediationRevenue();
   customMediationRevenue.MediationNetwork = ISAdQualityMediationNetwork.ADMOB;
   customMediationRevenue.AdType = ISAdQualityAdType.REWARDED_VIDEO;
   customMediationRevenue.Revenue = impressionData.Value/1000000f;
   IronSourceAdQuality.SendCustomMediationRevenue(customMediationRevenue);
}