Interstitials
This page is describes how to implement interstitial ads though the Bidon SDK.
Loading an Interstitial Ad
To load an interstitial ad, instantiate an BDNInterstitial
with placement
configured in the app settings.
Implement BDNFullscreenAdDelegate
that you are notified when your ad is ready and of other ad-related events.
In the load method you will need to specify the pricefloor. This argument can be ad revenue value from mediaton.
- Swift
- Objective-C
class ViewController: UIViewController {
var interstitialAd: Bidon.Interstitial!
func loadInterstitialAd() {
interstitialAd = Bidon.Interstitial(
// Auction Keys correspond to the Auction Configurations that you can create in the Bidon Admin Panel
auctionKey: String? = nil
)
interstitialAd.delegate = self
interstitialAd.loadAd(with: 0.1)
}
}
extension ViewController: Bidon.FullscreenAdDelegate {
func adObject(_ adObject: Bidon.AdObject, didLoadAd ad: Bidon.Ad) {}
func adObject(_ adObject: Bidon.AdObject, didFailToLoadAd error: Error) {}
func adObject(_ adObject: Bidon.AdObject, didFailToPresentAd error: Error) {}
func fullscreenAd(_ fullscreenAd: Bidon.FullscreenAdObject, willPresentAd ad: Bidon.Ad) {}
func fullscreenAd(_ fullscreenAd: Bidon.FullscreenAdObject, didDismissAd ad: Bidon.Ad) {}
}
#import "ViewController.h"
#import <Bidon/Bidon-Swift.h>
@interface ViewController() <BDNFullscreenAdDelegate>
@property (nonatomic, strong) BDNInterstitial *interstitial;
@end
@implementation ViewController
- (void)loadInterstitialAd {
// Auction Keys correspond to the Auction Configurations that you can create in the Bidon Admin Panel
self.interstitial = [[BDNInterstitial alloc] initWithAuctionKey:@"AUCTION_KEY"]; // @"AUCTION_KEY" optional
self.interstitial.delegate = self;
[self.interstitial loadAdWith:0.1];
}
#pragma mark - BDNFullscreenAdDelegate
- (void)adObject:(id<BDNAdObject>)adObject didFailToLoadAd:(NSError *)error {}
- (void)adObject:(id<BDNAdObject>)adObject didLoadAd:(id<BDNAd>)ad {}
- (void)adObject:(id<BDNAdObject>)fullscreenAd didFailToPresentAd:(NSError *)error {}
- (void)fullscreenAd:(id<BDNFullscreenAd>)fullscreenAd didDismissAd:(id<BDNAd>)ad {}
- (void)fullscreenAd:(id<BDNFullscreenAd>)fullscreenAd willPresentAd:(id<BDNAd>)ad {}
@end
Showing an Interstitial Ad
- Swift
- Objective-C
func showInterstitialAd() {
guard interstitialAd.isReady else { return }
interstitialAd.showAd(from: self)
}
- (void)showInterstitialAd {
if ([self.interstitial isReady]) {
[self.interstitial showAdFrom:self];
}
}