Interstitial Integration for Unity Plugin

Before you start Make sure you have correctly integrated the ironSource Unity Plugin. Integration is outlined here.

Step 1. Implement the Interstitial Events

The ironSource Unity Plugin fires several events to inform you of ad availability.

Add the following code to register to the events:

void OnEnable () {
  IronSourceEvents.onInterstitialAdReadyEvent += InterstitialAdReadyEvent;
  IronSourceEvents.onInterstitialAdLoadFailedEvent += InterstitialAdLoadFailedEvent;        
  IronSourceEvents.onInterstitialAdShowSucceededEvent += InterstitialAdShowSucceededEvent; 
  IronSourceEvents.onInterstitialAdShowFailedEvent += InterstitialAdShowFailedEvent; 
  IronSourceEvents.onInterstitialAdClickedEvent += InterstitialAdClickedEvent;
  IronSourceEvents.onInterstitialAdOpenedEvent += InterstitialAdOpenedEvent;
  IronSourceEvents.onInterstitialAdClosedEvent += InterstitialAdClosedEvent;
}

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

// Invoked when the initialization process has failed.
// @param description - string - contains information about the failure.
void InterstitialAdLoadFailedEvent (IronSourceError error) {
}
// Invoked when the ad fails to show.
// @param description - string - contains information about the failure.
void InterstitialAdShowFailedEvent(IronSourceError error) {
}
// Invoked when end user clicked on the interstitial ad
void InterstitialAdClickedEvent () {
}
// Invoked when the interstitial ad closed and the user goes back to the application screen.
void InterstitialAdClosedEvent () {
}
// Invoked when the Interstitial is Ready to shown after load function is called
void InterstitialAdReadyEvent() {
}
// Invoked when the Interstitial Ad Unit has opened
void InterstitialAdOpenedEvent() {
}
// Invoked right before the Interstitial screen is about to open.
// NOTE - This event is available only for some of the networks. 
// You should not treat this event as an interstitial impression, but rather use InterstitialAdOpenedEvent
void InterstitialAdShowSucceededEvent() {
}
Note: Do not assume the callbacks are always running on the main thread. Any UI interaction or updates resulting from ironSource callbacks need to be passed to the main thread before executing.

Events with AdInfo

As part of ironSource SDK 7.2.3 you can use a new set of listeners to get more data in ad callbacks, including network, segment, and A/B indication. Check out the full list of available Ad Info data, including APIs, field description and types, here.

Important!

When using these listeners, we recommend you unregister from any other interstitial listeners, to avoid any data duplications. 

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 succesfully.
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) {
}

Step 2. Load Interstitial Ad

We recommend requesting an Interstitial Ad a short while before you plan on showing it to your users as the loading process can take time. To request an interstitial ad, call the following method:

IronSource.Agent.loadInterstitial();
Note:  If you’d like to serve several Interstitial Ads in your application, you must repeat this step after you’ve shown and closed the previous Interstitial Ad. Once the InterstitialAdClosedEvent function is fired, you will be able to load a new Interstitial ad.

Step 3. Check Ad Availability

After you’ve called the loadInterstitial in Step 2, you will be notified when the ad is loaded and ready to be shown to your user. The InterstitialAdReadyEvent will inform you about ad availability.

public void InterstitialAdReadyEvent(){}

In addition, you have the possibility to request the ad availability directly by calling the following function:

IronSource.Agent.isInterstitialReady()
We don’t recommend making consecutive requests for an interstitial ad in a short timespan. Numerous requests in a short period of time have no added value as the chance of available inventory at this time is unlikely.

Step 4. Show Interstitial Ad

Once you receive the onInterstitialAdReadyEvent callback, you are ready to show an Interstitial Ad to your users. To provide the best experience for your users, make sure to pause any game action, including audio, during the time the ad is displayed.

Invoke the following method to serve an Interstitial ad to your users:

IronSource.Agent.showInterstitial();

With LevelPlay‘s Ad Placements, you can customize and optimize the Interstitial experience. This tool enables you to present Interstitial ads to your users in different places, i.e. app launch, between levels, etc. You can use the below function to define the exact placement to show an ad from. Navigate to the Ad Placement document for more details.

void showInterstitial(string placementName);

In addition to LevelPlay’s Ad Placements, you can now configure capping and pacing settings for selected placements. Capping and pacing improve the user experience in your app by limiting the number of ads served within a defined timeframe. Read more about capping and pacing here.

We recommend calling the following to verify if a placement is capped before you serve the Interstitial to your user:

IronSource.Agent.isInterstitialPlacementCapped(placementName)

Important! Once you’ve successfully completed step 4, you will have shown your user an Interstitial Ad. In the case you want to serve another Interstitial ad, you must repeat Step 2 to request an additional Interstitial.

First Time Integration Tip

If this is a new integration for your application, your app will by default be in ‘Test Mode‘ on your LevelPlay dashboard. While your app is in Test Mode, the ironSource SDK will print more logs to the console in order to provide greater visibility into the SDK processes. To test your ad inventory, set up your Test Devices. Until you turn on live ad inventory, you will receive test campaigns that don’t generate revenue. Make sure to select Go Live! on the Ad Units page when your app is ready for live ad inventory.
ironsource-go-live-with-rewarded-video

Done!
You can now deliver LevelPlay Interstitial Ads through the Interstitial Mediation platform!


What’s Next?
Follow our integration guides to integrate additional Interstitial Ad networks or configure additional Ad Units: