Introduction

Banners are rectangle ads appearing either at the top or bottom of the screen when the user interacts with your app. The user can view them but cannot dismiss them.

Banners are automatically refreshed by the after 20 seconds.

Important

Banner Refreshing
The refreshes banners automatically. To avoid discrepancies with 's and 3rd-party network's reporting, any automatic or manual banner refresh settings on 3rd-party network SDKs must be disabled.

Make an Ad Request

Banner sizes must be configured before they are shown. Once you have set the required size, you must make a request to show the banner.

Implement the code below to make an Ad Request:

#import <FairBidSDK/FairBid.h> 

FYBBanner.delegate = [[MyBannerDelegate alloc] init];

NSString *placementId = @"1234";
FYBBannerOptions *bannerOptions = [[FYBBannerOptions alloc] init];
bannerOptions.placementId = placementId;
 
[FYBBanner showBannerInView:self.view
                   position:FYBBannerAdViewPositionBottom      
                    options:bannerOptions];
FYBBanner.delegate = MyBannerDelegate()

let placementId = "1234" 
let bannerOptions = FYBBannerOptions()
bannerOptions.placementId = placementId as NSString

FYBBanner.show(in: self.view, position: .bottom, options: bannerOptions)

Destroying the Banner

Once you have decided that you no longer want to use the banner, you must destroy it.

To destroy the banner, implement the code below:

NSString *placementId = @"1234";
[FYBBanner destroy:placementId];
let placementId = "1234"
FYBBanner.destroy(placementId)

Adding Callbacks

The callback code below is required for the SDK to properly track the activity of your ad

#import <FairBidSDK/FairBid.h> 
 
@interface MyBannerDelegate : NSObject <FYBBannerDelegate>
@end
 
@implementation MyBannerDelegate
 
- (void)bannerDidLoad:(FYBBannerAdView *)banner {
//    Called when an ad is loaded
}
 
- (void)bannerDidFailToLoad:(NSString *)placementId withError:(NSError *)error {
//    Called when an error arises when loading an ad
}
 
- (void)bannerDidShow:(FYBBannerAdView *)banner {
//    Called when banner shows up
}
 
- (void)bannerDidClick:(FYBBannerAdView *)banner {
//    Called when banner is clicked
}
 
- (void)bannerWillPresentModalView:(FYBBannerAdView *)banner {
//    Called when banner presents modal view
}
 
- (void)bannerDidDismissModalView:(FYBBannerAdView *)banner {
//    Called when banner hides presented modal view
}
 
- (void)bannerWillLeaveApplication:(FYBBannerAdView *)banner {
//    Called after banner redirects to other application
}
 
- (void)banner:(FYBBannerAdView *)banner didResizeToFrame:(CGRect)frame {
//    Called after banner changes its size to desired frame
}
 
@end
class MyBannerDelegate: NSObject, FYBBannerDelegate {
    
    func bannerDidLoad(_ banner: FYBBannerAdView) {}
    
    func bannerDidFail(toLoad placementId: String, withError error: Error) {}
    
    func bannerDidShow(_ banner: FYBBannerAdView) {}
    
    func bannerDidClick(_ banner: FYBBannerAdView) {}
    
    func bannerWillPresentModalView(_ banner: FYBBannerAdView) {}
    
    func bannerDidDismissModalView(_ banner: FYBBannerAdView) {}
    
    func bannerWillLeaveApplication(_ banner: FYBBannerAdView) {}
    
    func banner(_ banner: FYBBannerAdView, didResizeToFrame frame: CGRect) {}
}

Banner


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.