RTBSDK iOS Integration
Release Notes
  • Start
    • Setup
      • Cocoapods
      • Swift Package Manager
      • Configure RTBSDK
    • Consent
  • Formats
    • Banners
    • Fullscreen (Interstitial)
    • Native Ads
    • Advanced
      • Separate Loading and Rendering of Banner Ads
  • Other
    • AdMob Custom Events
    • AppLovin Custom Adapter
    • Reference
      • Classes
        • RTBSDKManager
        • RTBBannerView
        • RTBBannerAdProvider
        • RTBBannerBid
        • RTBBannerRequestConfiguration
        • RTBBannerSize
        • RTBFullscreenAd
        • RTBFullscreenRequestConfiguration
        • RTBNativeAdLoader
        • RTBNativeAd
        • RTBNativeAdRequestConfiguration
        • RTBUserTargeting
        • RTBBidInfo
      • Protocols
        • RTBBannerViewDelegate
        • RTBBannerAdLoadDelegate
        • RTBBannerAdInteractionDelegate
        • RTBFullscreenDelegate
        • RTBNativeAdLoaderDelegate
        • RTBNativeAdInteractionDelegate
      • Enumerations
        • RTBLogLevel
        • RTBGender
  • Sample App
Powered by GitBook
On this page
  • Create RTBFullscreenAd Instance
  • Listen to Callbacks
  • Request Ad
  • Optional - set user targeting
  • Show Ad
  • Complete Code Example
  1. Formats

Fullscreen (Interstitial)

Integrate fullscreen ads

Last updated 2 months ago

This guide shows you how to integrate fullscreen ads of RTBSDK into your app.

Create RTBFullscreenAd Instance

Create an instance of :

let fullscreenAd = RTBFullscreenAd()

Listen to Callbacks

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

fullscreenAd.delegate = self

Request Ad

To load a fullscreen ad, you will need to pass an instance of with placementID and the iTunesAppId. Please contact our for getting the needed IDs.

let configuration = RTBFullscreenRequestConfiguration(placementId: <PLACEMENT_ID>, iTunesAppId: <ITUNES_APP_ID>)
configuration.sellerId = "<SELLERID>"
configuration.bidFloor = <BID_FLOOR>
fullscreenAd.load(configuration: configuration)

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

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 is optional.

let configuration = RTBFullscreenRequestConfiguration(placementId: <PLACEMENT_ID>, iTunesAppId: <ITUNES_APP_ID>)
configuration.userTargeting = .init(userId: "<USER_ID>", gender: .male, yearOfBirth: 1999, keywords: ["keyword1", "keyword2"])
// yearOfBirth must be a 4-digit number, otherwise, it will be ignored

Show Ad

After the ad gets loaded, it can be presented by calling:

fullscreenAd.show(viewController: self)

The currency of bidFloor and priceCPM parameters is USD.

Complete Code Example

import RTBSDK

class ViewController: UIViewController {
    let fullscreenAd: RTBFullscreenAd = RTBFullscreenAd()

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.

    }
    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        
        // [Important] Set fullscreen ad delegate to listen to the callbacks
        fullscreenAd.delegate = self
        
        // Prepare request configurations
        let configuration = RTBFullscreenRequestConfiguration(placementId: <PLACEMENT_ID>, iTunesAppId: <ITUNES_APP_ID>)
        configuration.sellerId = "<SELLERID>"
        configuration.bidFloor = <BID_FLOOR>
        // Request a fullscreen ad using the placement ID and itunes app ID
        fullscreenAd.load(configuration: configuration)
    }
}

extension ViewController: RTBFullscreenDelegate {
    func fullscreenAdDidReceiveAd(_ fullscreenAd: RTBFullscreenAd, bidInfo: RTBBidInfo, networkName: String) {
        // A fullscreen ad has been loaded
        fullscreenAd.show(viewController: self)
    }

    func fullscreenAd(_ fullscreenAd: RTBFullscreenAd, didFailToReceiveAd errorMessage: String, networkName: String) {
        // Failed to load a fullscreen ad
    }

    func fullscreenAdDidRecordClick(_ fullscreenAd: RTBFullscreenAd, networkName: String) {
        // The fullscreen ad received a click
    }

    func fullscreenAdDidPauseForAd(_ fullscreenAd: RTBFullscreenAd, networkName: String) {
        // The app paused for displaying a fullscreen ad
    }

    func fullscreenAdDidResumeAfterAd(_ fullscreenAd: RTBFullscreenAd, networkName: String) {
        // The app resumed after dismissing a fullscreen ad
    }
}
RTBFullscreenAd
RTBFullscreenDelegate
RTBFullscreenRequestConfiguration
support
RTBFullscreenDelegate
RTBUserTargeting
complete example below