Ad Quality SDK integration guides

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.

Step 1: Import the Ad Quality SDK to your app

CocoaPods

CocoaPods is a dependency manager for Objective-C and Swift; it automates and simplifies the SDK integration process. See the CocoaPods Guide on Getting Started and Using CocoaPods for more information.

To integrate our SDK with Cocoapods, enter the following line in your podfile:

pod 'IronSourceAdQualitySDK','7.4.0'

Step 2: Initialize the SDK

  1. Initialize the Ad Quality SDK using your ironSource app key, which can be found in the platform under Settings.
  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 viewDidLoad method of your main ViewController:

#import "IronSourceAdQuality.h"
 
@implementation ViewController 
- (void)viewDidLoad { 
    [super viewDidLoad]; 
    // Initialize 
    [[IronSourceAdQuality getInstance] initializeWithAppKey:appKey]; 
} 
@end

Step 3: Advanced SDK Initialization

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.

Note: All of the following attributes are optional

ISAdQualityConfig *adQualityConfig = [ISAdQualityConfig config];

User ID

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.

Test Mode

adQualityConfig.testMode = YES;
// The default is NO - set to true only to test your Ad Quality integration

Log level

adQualityConfig.logLevel = IS_AD_QUALITY_LOG_LEVEL_INFO;
// There are 5 different log levels:
// IS_AD_QUALITY_LOG_LEVEL_ERROR,
// IS_AD_QUALITY_LOG_LEVEL_WARNING,
// IS_AD_QUALITY_LOG_LEVEL_INFO,
// IS_AD_QUALITY_LOG_LEVEL_DEBUG,
// IS_AD_QUALITY_LOG_LEVEL_VERBOSE
// The default is IS_AD_QUALITY_LOG_LEVEL_INFO

[[IronSourceAdQuality getInstance] initializeWithAppKey:appKey andConfig:adQualityConfig];

Configure your user IDs

Using your existing user IDs will streamline the way you manage users across platforms.
If you initialize the Ad Quality SDK without your user IDs, Ad Quality will set default user IDs.

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 setUserId:userId];

2.Change the default user IDs after initializing the Ad Quality SDK:

[[IronSourceAdQuality getInstance] changeUserId:userId];

Step 4: Configure SDK callback events

In the same place where the Ad Quality SDK was initialized, implement iOS callbacks in a separate class.

ISAdQualityInitDelegate:

#import "IronSourceAdQuality.h"

@interface ViewController () : NSObject<ISAdQualityInitDelegate>
@end

@implementation ViewController
- (void)viewDidLoad {
  [super viewDidLoad];
  ISAdQualityConfig *config = [ISAdQualityConfig config];
  [config setAdQualityInitDelegate:self];

  // Initialize
  [[IronSourceAdQuality getInstance] initializeWithAppKey:appKey
  andConfig:config];
}
- (void)adQualitySdkInitSuccess {
   NSLog(@"adQualitySdkInitSuccess");
}
- (void)adQualitySdkInitFailed:(ISAdQualityInitError) error withMessage:(NSString *)message {
   NSLog(@"adQualitySdkInitFailed %u message: %@", error, message);
}

@end

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:  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.Builder builder = new ISAdQualityCustomMediationRevenue.Builder()                                                 
.setMediationNetwork(ISAdQualityMediationNetwork.SELF_MEDIATED)                                                 
.setAdType(ISAdQualityAdType.REWARDED_VIDEO)
.setPlacement("placement")
.setRevenue(0.12);
IronSourceAdQuality.getInstance().sendCustomMediationRevenue(builder.build());

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 mRewardedAd;
@Override
public void onAdLoaded(@NonNull RewardedAd rewardedAd) {
   mRewardedAd = rewardedAd;
   // Set paid event listener
   mRewardedAd.setOnPaidEventListener(new OnPaidEventListener() {
   @Override
   public void onPaidEvent(AdValue adValue) {
ISAdQualityCustomMediationRevenue.Builder builder = new ISAdQualityCustomMediationRevenue.Builder()                                                                                                         
.setMediationNetwork(ISAdQualityMediationNetwork.ADMOB)                                                                                                 
.setAdType(ISAdQualityAdType.REWARDED_VIDEO)                                                      
.setPlacement(mRewardedAd.getAdUnitId())                                                          
.setRevenue(adValue.getValueMicros()/1000000.0);
       IronSourceAdQuality.getInstance().sendCustomMediationRevenue(builder.build());
       }
  });
}

Step 6 (optional): Managing GDPR consent

The Ad Quality SDK supports publisher communication of a user’s consent choice in accordance with GDPR regulations.
Use the following function to update a user’s consent status using the Ad Quality API:
If the user-provided consent, set the flag to true:

[[IronSourceAdQuality getInstance] setUserConsent:true];