LevelPlay Listener with Ad Info Integration

As part of ironSource SDK 7.2.3, you’ll be able to receive more data in ad callbacks, including network, segment, and A/B indication.

Implement the new ad unit listeners

Implement the new LevelPlay listeners, that support AdInfo callback.

The AdInfo represents the last ad that was loaded successfully, and is not included in Load Fail callbacks, as there’s no available ad.

We recommend you to unregister from the old listeners, to avoid data duplications.

Rewarded Video

Add the following code to register to the events:

//Add AdInfo Rewarded Video Events
IronSourceRewardedVideoEvents.onAdOpenedEvent += RewardedVideoOnAdOpenedEvent;
IronSourceRewardedVideoEvents.onAdClosedEvent += RewardedVideoOnAdClosedEvent;
IronSourceRewardedVideoEvents.onAdAvailableEvent += RewardedVideoOnAdAvailable;
IronSourceRewardedVideoEvents.onAdUnavailableEvent += RewardedVideoOnAdUnavailable;
IronSourceRewardedVideoEvents.onAdShowFailedEvent += RewardedVideoOnAdShowFailedEvent;
IronSourceRewardedVideoEvents.onAdRewardedEvent += RewardedVideoOnAdRewardedEvent;
IronSourceRewardedVideoEvents.onAdClickedEvent += RewardedVideoOnAdClickedEvent;

The Plugin will notify the Listener of all possible events listed below:

/************* RewardedVideo AdInfo Delegates *************/
// Indicates that there's an available ad. 
// The adInfo object includes information about the ad that was loaded successfully  
// This replaces the RewardedVideoAvailabilityChangedEvent(true) event
void RewardedVideoOnAdAvailable(IronSourceAdInfo adInfo) { 
} 

// Indicates that no ads are available to be displayed 
// This replaces the RewardedVideoAvailabilityChangedEvent(false) event 
void RewardedVideoOnAdUnavailable() {
}

// The Rewarded Video ad view has opened. Your activity will loose focus. 
void RewardedVideoOnAdOpenedEvent(IronSourceAdInfo adInfo){
}

// The Rewarded Video ad view is about to be closed. Your activity will regain its focus. 
void RewardedVideoOnAdClosedEvent(IronSourceAdInfo adInfo){
}

// The user completed to watch the video, and should be rewarded. 
// The placement parameter will include the reward data. 
// When using server-to-server callbacks, you may ignore this event and wait for the ironSource server callback.
void RewardedVideoOnAdRewardedEvent(IronSourcePlacement placement, IronSourceAdInfo adInfo){
}

// The rewarded video ad was failed to show.
void RewardedVideoOnAdShowFailedEvent(IronSourceError error, IronSourceAdInfo adInfo){
}
// Invoked when the video ad was clicked. 
// This callback is not supported by all networks, and we recommend using it only if  
// it's supported by all networks you included in your build. 
void RewardedVideoOnAdClickedEvent(IronSourcePlacement placement, IronSourceAdInfo adInfo){
}

Note: When updating your event implementation to IronSourceRewardedVideoEvents, use the events  onAdAvailableEvent and onAdUnavailableEvent , instead of using IronSourceEvents. onRewardedVideoAvailabilityChangedEvent

Rewarded Video Manual Load

When you’re implementing manual load of rewarded video, use the following events instead:

//Add AdInfo Rewarded Video Events
IronSourceRewardedVideoEvents.onAdReadyEvent += RewardedVideoOnAdReadyEvent;
IronSourceRewardedVideoEvents.onAdLoadFailedEvent += RewardedVideoOnAdLoadFailedEvent;
IronSourceRewardedVideoEvents.onAdOpenedEvent += RewardedVideoOnAdOpenedEvent;
IronSourceRewardedVideoEvents.onAdClosedEvent += RewardedVideoOnAdClosedEvent;
IronSourceRewardedVideoEvents.onAdShowFailedEvent += RewardedVideoOnAdShowFailedEvent;
IronSourceRewardedVideoEvents.onAdRewardedEvent += RewardedVideoOnAdRewardedEvent;
IronSourceRewardedVideoEvents.onAdClickedEvent += RewardedVideoOnAdClickedEvent;

The Plugin will notify the Listener of all possible events listed below:

/************* RewardedVideo AdInfo Delegates *************/
// Indicates that the Rewarded video ad was loaded successfully. 
// AdInfo parameter includes information about the loaded ad
void RewardedVideoOnAdReadyEvent(IronSourceAdInfo adInfo) { 
} 

// Indicates that the Rewarded video ad failed to be loaded 
void RewardedVideoOnAdLoadFailedEvent(IronSourceError error) { 
}

// The Rewarded Video ad view has opened. Your activity will loose focus. 
void RewardedVideoOnAdOpenedEvent(IronSourceAdInfo adInfo){
}
// The Rewarded Video ad view is about to be closed. Your activity will regain its focus. 
void RewardedVideoOnAdClosedEvent(IronSourceAdInfo adInfo){
}

// The user completed to watch the video, and should be rewarded. 
// The placement parameter will include the reward data. 
// When using server-to-server callbacks, you may ignore this event and wait for the ironSource server callback.
void RewardedVideoOnAdRewardedEvent(IronSourcePlacement placement, IronSourceAdInfo adInfo){
}
// The rewarded video ad was failed to show.
void RewardedVideoOnAdShowFailedEvent(IronSourceError error, IronSourceAdInfo adInfo){
}
// Invoked when the video ad was clicked. 
// This callback is not supported by all networks, and we recommend using it only if  
// it's supported by all networks you included in your build. 
void RewardedVideoOnAdClickedEvent(IronSourcePlacement placement, IronSourceAdInfo adInfo){
}

Interstitial

Add the following code to register to the events:

//Add AdInfo Interstitial Events
IronSourceInterstitialEvents.onAdReadyEvent += InterstitialOnAdReadyEvent;
IronSourceInterstitialEvents.onAdLoadFailedEvent += InterstitialOnAdLoadFailed;
IronSourceInterstitialEvents.onAdOpenedEvent += InterstitialOnAdOpenedEvent;
IronSourceInterstitialEvents.onAdClickedEvent += InterstitialOnAdClickedEvent;
IronSourceInterstitialEvents.onAdShowSucceededEvent += InterstitialOnAdShowSucceededEvent;
IronSourceInterstitialEvents.onAdShowFailedEvent += InterstitialOnAdShowFailedEvent;
IronSourceInterstitialEvents.onAdClosedEvent += InterstitialOnAdClosedEvent;

The Plugin will notify the Listener of all possible events listed below:

/************* Interstitial AdInfo Delegates *************/
// Invoked when the interstitial ad was loaded successfully.
void InterstitialOnAdReadyEvent(IronSourceAdInfo adInfo) {
}
// Invoked when the initialization process has failed.
void InterstitialOnAdLoadFailed(IronSourceError ironSourceError) {
}
// Invoked when the Interstitial Ad Unit has opened. This is the impression indication. 
void InterstitialOnAdOpenedEvent(IronSourceAdInfo adInfo) {
}
// Invoked when end user clicked on the interstitial ad
void InterstitialOnAdClickedEvent(IronSourceAdInfo adInfo) {
}
// Invoked when the ad failed to show.
void InterstitialOnAdShowFailedEvent(IronSourceError ironSourceError, IronSourceAdInfo adInfo) {
}
// Invoked when the interstitial ad closed and the user went back to the application screen.
void InterstitialOnAdClosedEvent(IronSourceAdInfo adInfo) {
}
// Invoked before the interstitial ad was opened, and before the InterstitialOnAdOpenedEvent is reported.
// This callback is not supported by all networks, and we recommend using it only if  
// it's supported by all networks you included in your build. 
void InterstitialOnAdShowSucceededEvent(IronSourceAdInfo adInfo) {
}

Banners

Add the following code to register to the events:

//Add AdInfo Banner Events
IronSourceBannerEvents.onAdLoadedEvent += BannerOnAdLoadedEvent;
IronSourceBannerEvents.onAdLoadFailedEvent += BannerOnAdLoadFailedEvent;
IronSourceBannerEvents.onAdClickedEvent += BannerOnAdClickedEvent;
IronSourceBannerEvents.onAdScreenPresentedEvent += BannerOnAdScreenPresentedEvent;
IronSourceBannerEvents.onAdScreenDismissedEvent += BannerOnAdScreenDismissedEvent;
IronSourceBannerEvents.onAdLeftApplicationEvent += BannerOnAdLeftApplicationEvent;

The Plugin will notify the Listener of all possible events listed below:

/************* Banner AdInfo Delegates *************/
// Invoked each time a banner was loaded, either on refresh or on manual load
void BannerOnAdLoadedEvent(IronSourceAdInfo adInfo) 
{
}
// Invoked when the banner loading process has failed
// The callback will be sent both for manual and refreshed banner failures. 
void BannerOnAdLoadFailedEvent(IronSourceError ironSourceError) 
{
}
// Invoked when end user clicks on the banner ad
void BannerOnAdClickedEvent(IronSourceAdInfo adInfo) 
{
}
//Notifies the presentation of a full screen content following user click
void BannerOnAdScreenPresentedEvent(IronSourceAdInfo adInfo) 
{
}
//Notifies the presented screen has been dismissed
void BannerOnAdScreenDismissedEvent(IronSourceAdInfo adInfo) 
{
}
//Invoked when the user leaves the app
void BannerOnAdLeftApplicationEvent(IronSourceAdInfo adInfo) 
{
}

Note: The callbacks BannerOnAdLoadedEvent and BannerOnAdLoadFailedEvent will be sent both for manual load and refreshed banners.

Integrate the AdInfo data

Once you implement the LevelPlay Listeners with AdInfo, you’ll be able to use the data as part of your app’s data.

If the AdInfo data is not available, the adInfo string params will return an empty string, and the numeric params will return 0 value.

// Implementation example 
IronSourceInterstitialEvents.onAdReadyEvent += InterstitialOnAdReadyEvent;
void InterstitialOnAdReadyEvent(IronSourceAdInfo adInfo) {
 
   String  auctionID = adInfo.auctionId;
   String  adUnit = adInfo.adUnit;
   String  country = adInfo.country;
   String  ab = adInfo.ab;
   String  segmentName = adInfo.segmentName;
   String  adNetwork = adInfo.adNetwork;
   String  instanceName = adInfo.instanceName;
   String  instanceId = adInfo.instanceId;
   Double? revenue = adInfo.revenue;
   String  precision = adInfo.precision;
   String  encryptedCPM = adInfo.encryptedCPM;
   
}

Ad Info fields

Here’s a list of the relevant data fields, including description and type that are being returned as part of the new AdInfo object:

Parameter Name Description Data Type
auctionId Unique identifier for the auction String
adUnit The ad unit displayed (Rewarded Video/Interstitial/Banner) String
adNetwork The ad network name that served the ad String
instanceName The ad network instance name as defined on the platform. For bidding sources, the instance name will be ‘Bidding’ String
instanceId Identifier per network, this includes the ad network’s
instanceID/placement/zone/etc.
String
country Country code ISO 3166-1 format String
revenue The revenue generated for the impression (USD). The revenue value is either estimated or exact, according to the precision (see precision field description) Double
precision The source value of the revenue field:
BID – The revenue provided as part of the real-time auction (Not supported by FAN bidders)
RATE – manual price the publisher assigned to an instance in the LevelPlay platform
CPM – Calculation based on historical instance performance, performed by LevelPlay platform
String
ab Indication if A/B test was activated via LevelPlay platform String
segmentName The segment the user is related to as defined based on the segmentation method String
encryptedCPM Relevant for ads provided by Meta Audience Network only, and will be reported to publishers approved by Meta Audience Network within the closed beta String