Banners

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

Create an RTBBannerView Instance

let bannerAdView = RTBBannerView(size: .banner320x50)

You have to specify the banner sizearrow-up-right while initialising the RTBBannerView. It will be used later while loading a new banner ad.

Listen to Callbacks

Through the use of RTBBannerViewDelegatearrow-up-right, 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 RTBBannerRequestConfigurationarrow-up-right with placementIDand iTunesAppId. Please contact our supportenvelope 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 RTBBannerViewDelegatearrow-up-right

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 RTBUserTargetingarrow-up-right is optional.

Complete Code Example

Last updated