Skip to main content

Interstitial Ad Units

Create Interstitial Ad Unit#

info

If you miss to Initialize the SDK, this method will fail to return a response.

To create a new interstitial ad, create an MesonInterstitial object.

var interstitialAd: MesonInterstitial = MesonInterstitial.init(adUnitId: "AD_UNIT_ID", delegate: self)

Set the Delegate#

Track the ad lifecycle for interstitial ads. All the available events for interstitial ads are listed below.

extension <Class> : MesonInterstitialDelegate {
func mesonInterstitialDidLoad(_ interstitialAd: MesonInterstitial) {
}
func mesonInterstitialDidFailToLoad(_ interstitialAd: MesonInterstitial, error: Error) {
}
func mesonInterstitialImpression(_ interstitialAd: MesonInterstitial, impressionData: [String: Any]) {
}
func mesonInterstitialDidFailToDisplay(_ interstitialAd: MesonInterstitial, error: Error) {
}
func mesonInterstitialUserWillLeaveApplication(_ interstitialAd: MesonInterstitial) {
}
func mesonInterstitialWillDisplay(_ interstitialAd: MesonInterstitial) {
}
func mesonInterstitialDidDisplay(_ interstitialAd: MesonInterstitial) {
}
func mesonInterstitialWillDismiss(_ interstitialAd: MesonInterstitial) {
}
func mesonInterstitialDidDismiss(_ interstitialAd: MesonInterstitial) {
}
func mesonInterstitialDidClick(_ interstitial: MesonInterstitial, params: [String : Any]?) {
}
}

Load Ad#

The publisher can request for an interstitial ad by invoking this method. This will request an ad from all demand sources, select a winner, and make it available on the SDK.

interstitialAd.load()

Show Ad#

The ad is available when load is called. It is shown to the user when show method is called. It is recommended to call this method in the mesonInterstitialDidFinishLoading callback method or check isReady and then call show method.

interstitialAd.show(from: <UIViewController>)