Banner Integration for iOS

Banners are rectangular, system-initiated ads that can be either static or animated, and are served in a designated area around your live app content.

Before You Start

  • Make sure you have correctly integrated the ironSource SDK into your application. Integration is outlined here.
  • Banner Mediation is supported in ironSource SDK 6.6.0 and above.

Step 1. Implement the Delegate

The ironSource SDK fires several Delegates to inform you of Banner activity. The SDK will notify your Delegate of all possible events listed below:

#pragma mark - ISBannerDelegate
/** Called after a banner ad has been successfully loaded
 */
- (void)bannerDidLoad:(UIView *)bannerView;
/**
 Called after a banner has attempted to load an ad but failed.
 
 @param error The reason for the error
 */
- (void)bannerDidFailToLoadWithError:(NSError *)error;
/**
 Called after a banner has been clicked.
 */
- (void)didClickBanner;
/**
 Called when a banner is about to present a full screen content.
 */
- (void)bannerWillPresentScreen;
/**
 Called after a full screen content has been dismissed.
 */
- (void)bannerDidDismissScreen;
/**
 Called when a user would be taken out of the application context.
 */
- (void)bannerWillLeaveApplication;
/MARK: Banner Delegates
    
   /**
     Called after a banner ad has been successfully loaded
     */
    func bannerDidLoad(_ bannerView: ISBannerView!)
    
   /**
     Called after a banner has attempted to load an ad but failed.
     @param error The reason for the error
     */
    func bannerDidFailToLoadWithError(_ error: Error!)
   /**
     Called after a banner has been clicked.
     */
    func didClickBanner()
    
   /**
     Called when a banner is about to present a full screen content.
     */
    func bannerWillPresentScreen()
   /**
     Called after a full screen content has been dismissed.
     */
    func bannerDidDismissScreen()
    
   /**
     Called when a user would be taken out of the application context.
     */
    func bannerWillLeaveApplication()
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.

Step 2. Load Banner Ad

To load a banner ad, call the following method:

[IronSource loadBannerWithViewController:YOUR_VIEW_CONTROLLER size:YOUR_BANNER_AD_SIZE];
IronSource.loadBanner(with: YOUR_VIEW_CONTROLLER, size: .YOUR_BANNER_AD_SIZE)
Note: You must define one of banner sizes we support to call the loadBannermethod. See table below.
bannerSize Description Dimensions in points  Ad Network Support
IS_AD_SIZE_
BANNER
Standard Banner
Best for Phones & Tablets
50 x screen width Admob, AppLovin, Facebook, InMobi
 IS_AD_SIZE_LARGE_
BANNER
Large Banner 90 x screen width Admob, Facebook
IS_AD_SIZE_RECTANGLE_
BANNER
Large Rectangular Banner
Best for Scrollable Feeds or Between Game Levels
300 x screen width Admob, AppLovin, Facebook, InMobi
IS_AD_SIZE_SMART_
BANNER
Smart Banner
Renders ads that automatically resize to fit the device’s size and orientation
iPhone:
50 x screen width
iPad:
90 x screen width
Admob, Facebook, InMobi

We support placements for Banner Mediation, as well as capping and pacing for Banners on the ironSource dashboard. Learn how to set up placements, capping and pacing for Banners to optimize your app’s user experience here.

If you’ve set up placements for your Banner, call the following method to serve a Banner ad in a specific placement:

[IronSource loadBannerWithViewController:YOUR_VIEW_CONTROLLER size:YOUR_BANNER_SIZE placement:YOUR_PLACEMENT_NAME];
IronSource.loadBanner(with: YOUR_VIEW_CONTROLLER, size: YOUR_BANNER_SIZE, placement: YOUR_PLACEMENT_NAME)

Once you receive the below callback from your delegate, you will be able to show the ad to your users:

(void)bannerDidLoad:(ISBannerView *)bannerView
func bannerDidLoad(_ bannerView: ISBannerView!)

Step 3. Destroy the Banner Ad

Once you’ve successfully served a Banner, you must call the below function on the main thread to destroy the previous Banner. This is necessary to serve an additional Banner in the same view.

[IronSource destroyBanner: YOUR_IRONSOURCE_BANNER];
IronSource.destroyBanner(YOUR_IRONSOURCE_BANNER)

After you call this method, the Banner in question can no longer be used. In the case you want to serve it again, you will need to load a new Banner using the loadBanner method.

Step 4.  Integrate a Banner Provider

Next, integrate the ad network adapters to serve Banners through ironSource Mediation. We currently support Admob, AppLovinFacebook and Inmobi Banners.

 

Done!
You are now all set up to serve Banners in your application. Verify your integration with our Integration Helper.


What’s Next? 

Follow our integration guides to integrate additional ad units:

 

Interested in integrating more mediation adapters? Check out our supported Mediation Networks.