Interstitial Integration for Unity Plugin

Get up and running with the Interstitial Ad Unit in 4 easy steps:

  1. Implement the Interstitial Listener
  2. Initialize the Interstitial Unit
  3. Load Interstitial Ad
  4. Check Ad Availability
  5. Show Interstitial Ad
Before You Start
Make sure you have correctly integrated the ironSource Unity Plugin. Integration is outlined here.

Step 1. Implement the Interstitial Listener

The ironSource Unity plugin fires several events to inform you of Interstitial Activity. To receive these events, create an empty game object in each of your Unity scenes and drag the SupersonicEvents.cs into it.

Add the following code to register to the events:

void OnEnable () {
SupersonicEvents.onInterstitialInitSuccessEvent += InterstitialInitSuccessEvent;
SupersonicEvents.onInterstitialInitFailedEvent += InterstitialInitFailEvent; 
SupersonicEvents.onInterstitialReadyEvent += InterstitialReadyEvent;
SupersonicEvents.onInterstitialLoadFailedEvent += InterstitialLoadFailedEvent;
SupersonicEvents.onInterstitialShowSuccessEvent += InterstitialShowSuccessEvent; 
SupersonicEvents.onInterstitialShowFailedEvent += InterstitialShowFailEvent; 
SupersonicEvents.onInterstitialClickEvent += InterstitialAdClickedEvent;
SupersonicEvents.onInterstitialOpenEvent += InterstitialAdOpenedEvent;
SupersonicEvents.onInterstitialCloseEvent += InterstitialAdClosedEvent;
}

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

/*
 * Invoked when Interstitial initialization process completes successfully.
 */
 void InterstitialInitSuccessEvent () {
        Debug.Log ("InterstitialInitSuccessEvent");
}
/* 
 * Invoked when the initialization process has failed.
 * @param description - string - contains information about the failure.
 */
void InterstitialLoadFailedEvent (SupersonicError error) {
        Debug.Log ("InterstitialLoadFailedEvent, code: " + error.getCode()+ ", description : " +error.getDescription());
}
/* 
 * Invoked right before the Interstitial screen is about to open.
 */
void InterstitialShowSuccessEvent() {
        Debug.Log ("InterstitialShowSuccessEvent");
}
/* 
 * Invoked when the ad fails to show.
 * @param description - string - contains information about the failure.
 */
void InterstitialShowFailEvent(SupersonicError error) {
        Debug.Log ("InterstitialShowFailEvent, code :  " +error.getCode() + ", description : " +error.getDescription());
}
/* 
 * Invoked upon ad availability change.
 * @param available - bool - true when interstitial ad is ready to be presented or false
 * otherwise.
 */
void ISAvailability (bool available) {
//Show the Ad if available value is true
}
/* 
 * Invoked when end user clicked on the interstitial ad
 */
 void InterstitialAdClickedEvent () {
        Debug.Log ("InterstitialAdClickedEvent");
}
/* 
 * Invoked when the interstitial ad closed and the user goes back to the application screen.
 */
  void InterstitialAdClosedEvent () {
        Debug.Log ("InterstitialAdClosedEvent");
}
/* 
 * Invoked when the interstitial initialization process fails
 */
  void InterstitialInitFailEvent(SupersonicError error){
        Debug.Log ("InterstitialInitFailEvent, code :  " +error.getCode()+ ", description : " +error.getDescription());
    }
/*
 * Invoked when the Interstitial is Ready to shown after load function is called
 */
  void InterstitialReadyEvent()
    {
        Debug.Log ("InterstitialReadyEvent");
    }
/*
 * Invoked when the Interstitial Ad Unit has opened
 */
  void InterstitialAdOpenedEvent()
    {
        Debug.Log ("InterstitialAdOpenedEvent");
    }
Note: Note: Do not assume the callbacks are always running on the main thread. Any UI interaction or updates resulting from Supersonic callbacks need to be passed to the main thread before executing.

Step 2. Initialize the Interstitial Unit

You should initialize the Interstitial Ad Unit as early as possible to allow time for the Interstitial to load. We recommend doing so on app launch.

Supersonic.Agent.initInterstitial("supersonic_app_key", "unique_user_id");
Note: Note:
  1. Supersonic_APPLICATION_KEY is the unique ID of your Application in your ironSource account.
    ironsource-platform-app-key
  2. unique_User_Id is the unique ID of your end user. We support NSString from 1 to 64 characters. Common practice is to use the Apple Advertising ID (IDFA) or Google Advertising ID (GAID).
    Important! You must enter a unique user ID for each individual user.  Neglecting this field will cause a significant decrease in fill rate and ad performance for your app. Find more information on User IDs and how to generate them here.
     

Step 3. 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. Before calling the load method, make sure you received InterstitialInitSuccessEvent first. 
To request an interstitial ad, call the following method:

Supersonic.Agent.loadInterstitial();
Note:  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 4. Check Ad Availability

After you have received the InterstitialInitSuccessEvent callback and you’ve called the loadInterstitial in Step 3, you will be notified when the ad is loaded and ready to be shown to your user. The onInterstitialReady() will inform you about ad availability.

public void onInterstitialReady(){}

Alternatively, you can request the ad availability directly by calling the following function:

Supersonic.Agent.isInterstitialReady()

Once the Interstitial ad is available you will be able to show the ad to your users. With ironSource’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 ironSource’s Ad Placements, you can now configure capping and pacing settings for selected placements. Capping and pacing improves the user experience in your app by limiting the amount of ads served within a defined timeframe. Read more about capping and pacing here.

Step 5. Show Interstitial Ad

Once you receive the onInterstitialReady callback, you are ready to show an Interstitial Ad to your users. Invoke the following method on your Supersonic Instance to serve an Interstitial ad to your users:

Supersonic.Agent.showInterstitial();

Important! Once you’ve successfully completed step 5, you will have shown your user an Interstitial Ad. In the case you want to serve another Interstitial ad, you must repeat Step 3 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 ironSource 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.
Supersonic Switch App to Live Mode Rewarded Video Ad Unitironsource-go-live-with-rewarded-video

Done!
You can now deliver ironSource 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: