Skip to main content

Banner Ad Units

Create Banner Ad Unit#


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

To create a new banner ad, create an MesonBanner object.

var bannerAd: MesonBanner = MesonBanner.init(adUnitId: "AD_UNIT_ID", adSize: "<CGSize>", delegate: self)

Set Banner Animation#

Additional APIs to control the transition of the banner ads.

bannerAd.animationTransition = .flipFromLeft

Register Delegate#

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

extension <#Class> : MesonBannerDelegate {
func viewControllerForMesonBannerFullScreen() -> UIViewController? {
return <UIViewController>
func mesonBannerDidLoad(_ bannerAd: MesonBanner) {
func mesonBannerDidFailToLoad(_ bannerAd: MesonBanner, error: Error?) {
func mesonBannerImpression(_ bannerAd: MesonBanner, impressionData: [String: Any]) {
func mesonBannerDidPresentScreen(_ bannerAd: MesonBanner) {
func mesonBannerDidCollapseScreen(_ bannerAd: MesonBanner) {
func mesonBannerWillPresentScreen(_ bannerAd: MesonBanner) {
func mesonBannerWillCollapseScreen(_ bannerAd: MesonBanner) {
func mesonBannerDidClick(_ banner: MesonBanner, params: [String : Any]?) {
func mesonBannerUserWillLeaveApplication(_ bannerAd: MesonBanner) {

Load and Show#

The publisher can request for a banner ad by invoking this method. This will request an ad from all demand sources, select a winner, and once the ad is available show the ad to the user in the registered ad container.