Skip to main content

Splash Ad Units

Create Splash Ad Unit#

info

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

To create a splash ad, first create an MesonSplash object.

var splashAd = MesonSplash.init(adUnitId: "AD_UNIT_ID", adSize: CGSize, delegate: self)

Set the Listener#

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

extension <class> : MesonSplashDelegate {
func mesonSplashDidLoad(_ splashAd: MesonSplash) {
}
func mesonSplashDidLoadFail(_ splashAd: MesonSplash, error: Error) {
}
func mesonSplashDidClick(_ splashAd: MesonSplash, params: [String : Any]?) {
}
func mesonSplashImpression(_ splashAd: MesonSplash, impressionData: [String: Any]) {
}
func mesonSplashWillPresentScreen(_ splashAd: MesonSplash) {
}
func mesonSplashDidPresentScreen(_ splashAd: MesonSplash) {
}
func mesonSplashWillCollapseScreen(_ splashAd: MesonSplash) {
}
func mesonSplashDidCollapseScreen(_ splashAd: MesonSplash) {
}
func mesonSplashUserWillLeaveApplication(_ splashAd: MesonSplash) {
}
}

Load Ad#

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

splashAd.load()

Get Ad View#

The ad is returned to the user when getAdView method is called. It is recommended to call this method in the mesonSplashDidLoad callback.

let adConfig = MesonSplashAdViewConfiguration(size: <CGSize>, window: <UIWindow>, topViewController: <UIViewController>)
splashAd.getAdView(configuration: adConfig)