Banners

Banner ads are displayed in RTBBannerView instances, so the first step towards integrating banner ads is to create an instance of RTBBannerView and add it to your view hierarchy.

Create an RTBBannerView Instance

let bannerAdView = RTBBannerView(size: .banner320x50)

You have to specify the banner size while initialising the RTBBannerView. It will be used later while loading a new banner ad.

Listen to Callbacks

Through the use of RTBBannerViewDelegate, you can listen to the different callbacks. Of course, your class must conform to its delegate methods (see the complete example below).

bannerAdView.delegate = self

Request Ad

To load a banner ad, you will need to pass an instance of RTBBannerRequestConfiguration with placementIDand iTunesAppId. Please contact our support for getting the needed IDs.

let configuration = RTBBannerRequestConfiguration(placementId: <PLACEMENT_ID>, iTunesAppId: <ITUNES_APP_ID>)
configuration.sellerId = "<SELLERID>" // Optional
configuration.bidFloor = <BID_FLOOR>  // Optional
bannerView.load(configuration: configuration)

You will be notified about the loading success/failure through the RTBBannerViewDelegate

The currency of bidFloor and priceCPM parameters is USD.

Optional - set user targeting

You can pass user targeting data to each request, allowing ads to be more relevant to your audience. Each field in RTBUserTargeting is optional.

Complete Code Example

Last updated