Banner Ad Options
Ad Rendering Type (Default: GFPDisplayAgentTypeInApp)
displayAgent is deprecated. Use the S2S Click Handler or the default in-app browser instead.
This setting controls the behavior when an ad is clicked — navigating to Safari, staying in-app, or using a custom scheme. Configure this after setting the Banner, Native, or Video ad options.
After setting the Scheme type, provide the corresponding String value for AppScheme.
- Swift
- Objective-C
// Option to navigate to Safari.
let displayAgent = GFPRenderDisplayAgent(type: .displayAgentTypeNativeSafari)
GFPAdManager.adConfiguration().displayAgent = displayAgent
// Option to use a custom app scheme.
let displayAgent = GFPRenderDisplayAgent(type: .displayAgentTypeScheme, scheme: "AppScheme")
GFPAdManager.adConfiguration().displayAgent = displayAgent
// Option to navigate to Safari.
GFPRenderDisplayAgent *displayAgent = [[GFPRenderDisplayAgent alloc] initWithType: GFPDisplayAgentTypeNativeSafari];
[GFPAdManager adConfiguration].displayAgent = displayAgent;
// Option to use a custom app scheme.
GFPRenderDisplayAgent *displayAgent = [[GFPRenderDisplayAgent alloc] initWithType: GFPDisplayAgentTypeScheme scheme: @"AppScheme"];
[GFPAdManager adConfiguration].displayAgent = displayAgent;
Ad Request Timeout (Default: 60 seconds)
If no ad response is received within the specified time (in seconds) after the ad request, the existing request is invalidated and the adLoader:didFailWithError:responseInfo: method of GFPAdLoaderDelegate is called.
- Swift
- Objective-C
self.adLoader?.requestTimeoutInterval = ...
self.adLoader.requestTimeoutInterval = ...
Simultaneous Native Ad Loading
When loading a banner ad, you can configure it to receive either a banner or a native ad in the response.
- Swift
- Objective-C
let nativeOption = GFPAdNativeOptions()
nativeOption.renderingSetting = ... // Rendering settings for the native standard ad to be loaded
self.adLoader?.setNativeDelegate(self, nativeOptions: nativeOption)
let nativeSimpleOption = GFPAdNativeSimpleOptions()
nativeSimpleOption.simpleAdRenderingSetting = ... // Rendering settings for the native simple ad to be loaded
self.adLoader?.setNativeSimpleDelegate(self, nativeSimpleOptions: nativeSimpleOption)
self.adLoader?.delegate = self
self.adLoader?.loadAd()
GFPAdNativeOptions *nativeOptions = [[GFPAdNativeOptions alloc] init];
nativeOptions.renderingSetting = ...; // Rendering settings for the native standard ad to be loaded
[self.adLoader setNativeDelegate:self nativeOptions:nativeOptions];
GFPAdNativeSimpleOptions *nativeSimpleOptions = [[GFPAdNativeSimpleOptions alloc] init];
nativeSimpleOptions.simpleAdRenderingSetting = ...; // Rendering settings for the native simple ad to be loaded
[self.adLoader setNativeSimpleDelegate:self nativeSimpleOptions:nativeSimpleOptions];
self.adLoader.delegate = self;
[self.adLoader loadAd];
When a native standard ad is loaded, the adLoader:didReceiveNativeAd: method of GFPAdLoaderDelegate is called.
When a native simple ad is loaded, the adLoader:didReceiveNativeSimpleAd: method of GFPAdLoaderDelegate is called.
Banner Layout Type Configuration
If no layout is configured, the default value is Fixed (GFPBannerViewLayoutTypeFixed).
- You can get the size information of the ad creative via
GFPBannerView.adSize.- When setting a layout type other than Fixed (i.e., fluid types), using the fluid-width layout is recommended.
Fixed Layout Configuration
- The ad area size is fixed regardless of the ad container size set by the service.
- Swift
- Objective-C
let bannerOption = GFPAdBannerOptions()
bannerOption.layoutType = GFPBannerViewLayoutType(rawValue: 0)
GFPAdBannerOptions *bannerOptions = [[GFPAdBannerOptions alloc] init];
bannerOptions.layoutType = GFPBannerViewLayoutTypeFixed;
Fluid Width Layout Configuration
- You can set the banner ad's width manually.
- Swift
- Objective-C
let bannerOption = GFPAdBannerOptions()
bannerOption.layoutType = .fluidWidth
GFPAdBannerOptions *bannerOptions = [[GFPAdBannerOptions alloc] init];
bannerOptions.layoutType = GFPBannerViewLayoutTypeFluidWidth;
- Request an ad with the fluid-width layout type set, and on success adjust the width of the received GFPBannerView to the desired size.
- Swift
- Objective-C
self.bannerView?.translatesAutoresizingMaskIntoConstraints = false
self.bannerView?.widthAnchor.constraint(equalToConstant: SUPERVIEW_SIZE.width).isActive = true
/*
Set the bannerView frame to the desired width.
*/
let frame = CGRect(x: /*desired X coordinate*/, y: /*desired Y coordinate*/, width: /*desired width*/, height: /*desired height*/)
self.bannerView?.frame = frame
self.bannerView.translatesAutoresizingMaskIntoConstraints = NO;
[self.bannerView.widthAnchor constraintEqualToConstant:SUPERVIEW_SIZE.width].active = YES;
/*
Set the bannerView frame to the desired width.
*/
CGRect frame = CGRectMake(/*desired X coordinate*/, /*desired Y coordinate*/, /*desired width*/, /*desired height*/);
[self.bannerView setFrame: frame];
- If an ad that supports fluid width is loaded, it will be drawn to fill the specified width of GFPBannerView. If a fixed-size ad is loaded, the remaining space on both sides will be drawn as padding (centered).
Fluid Height Layout Configuration
- You can set the banner ad's height manually by configuring the fluid-height layout type.
- Swift
- Objective-C
let bannerOption = GFPAdBannerOptions()
bannerOption.layoutType = .fluidHeight
GFPAdBannerOptions *bannerOptions = [[GFPAdBannerOptions alloc] init];
bannerOptions.layoutType = GFPBannerViewLayoutTypeFluidHeight;
Fluid Layout Configuration
- You can set the banner ad's width and height manually by configuring the fluid layout type.
- Swift
- Objective-C
let bannerOption = GFPAdBannerOptions()
bannerOption.layoutType = .fluid
GFPAdBannerOptions *bannerOptions = [[GFPAdBannerOptions alloc] init];
bannerOptions.layoutType = GFPBannerViewLayoutTypeFluid;
Ad Delivery Data Configuration
Set hostMeta (data agreed upon between the publisher and the ad creative) to pass data required by the ad creative. Both Key and Value of hostMeta are String types.
You can configure the ad style using hostMeta. Separately from the InterfaceStyle global setting, you can apply individual settings when the UI mode differs on a specific screen to match the icon style. The priority order is 'per-ad setting > global setting'. If no per-ad style setting exists, the global setting is followed.
- Swift
- Objective-C
//example
let bannerOption = GFPAdBannerOptions()
bannerOption.hostMeta = ["light":"theme"]
bannerOption.hostMeta = ["dark":"theme"]
bannerOption.hostMeta = ["system":"theme"] // Follows the style set in iPhone settings.
//example
GFPAdBannerOptions *bannerOptions = [[GFPAdBannerOptions alloc] init];
bannerOptions.hostMeta = [NSDictionary dictionaryWithObjectsAndKeys:@"light", @"theme", nil];
bannerOptions.hostMeta = [NSDictionary dictionaryWithObjectsAndKeys:@"dark", @"theme", nil];
bannerOptions.hostMeta = [NSDictionary dictionaryWithObjectsAndKeys:@"system", @"theme", nil]; // Follows the style set in iPhone settings.
MRAID Feature Support Configuration
Specify the additional features available for MRAID ad creatives in NS_OPTIONS format. The default value is GFPMraidSupportNone (0).
| Value | Description |
|---|---|
GFPMraidSupportNone | No additional features (default) |
GFPMraidSupportSMS | SMS sending |
GFPMraidSupportTel | Phone call |
GFPMraidSupportCalendar | Add calendar event |
GFPMraidSupportInlineVideo | Inline video playback |
GFPMraidSupportPicture | Save photo |
GFPMraidSupportLocation | Location access |
GFPMraidSupportVPAID | VPAID support |
GFPMraidSupportDefault | Default feature set |
- Swift
- Objective-C
let bannerOption = GFPAdBannerOptions()
bannerOption.mraidSupportType = [.sms, .tel, .calendar]
GFPAdBannerOptions *bannerOptions = [[GFPAdBannerOptions alloc] init];
bannerOptions.mraidSupportType = GFPMraidSupportSMS | GFPMraidSupportTel | GFPMraidSupportCalendar;
WebView Options Configuration
Configure the scroll inset and initial offset for the banner WebView using GFPAdBannerWebViewOptions.
| Property | Type | Description |
|---|---|---|
contentInsetAdjustmentBehavior | UIScrollViewContentInsetAdjustmentBehavior | Scroll view inset adjustment behavior |
defaultContentOffset | CGPoint | Initial content offset |
- Swift
- Objective-C
let webViewOption = GFPAdBannerWebViewOptions()
webViewOption.contentInsetAdjustmentBehavior = .never
webViewOption.defaultContentOffset = .zero
let bannerOption = GFPAdBannerOptions()
bannerOption.webViewOption = webViewOption
GFPAdBannerWebViewOptions *webViewOption = [[GFPAdBannerWebViewOptions alloc] init];
webViewOption.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
webViewOption.defaultContentOffset = CGPointZero;
GFPAdBannerOptions *bannerOptions = [[GFPAdBannerOptions alloc] init];
bannerOptions.webViewOption = webViewOption;
OMSDK FriendlyObstruction Configuration
Register views that overlap the ad area but do not obstruct ad visibility (such as close buttons or media controls) via omFriendlyObstructions. The OMSDK will exclude views in this list from viewability measurement.
| Purpose Type | Description |
|---|---|
GFPFriendlyObstructionTypeMediaControls | Media controls |
GFPFriendlyObstructionTypeCloseAd | Close button |
GFPFriendlyObstructionTypeNotVisible | Views not visible on screen |
GFPFriendlyObstructionTypeOther | Other |
- Swift
- Objective-C
let obstruction = GFPOMFriendlyObstruction(with: closeButton, purpose: .closeAd, reason: "close button")
let bannerOption = GFPAdBannerOptions()
bannerOption.omFriendlyObstructions = [obstruction]
GFPOMFriendlyObstruction *obstruction = [[GFPOMFriendlyObstruction alloc]
initWith:self.closeButton
purpose:GFPFriendlyObstructionTypeCloseAd
reason:@"close button"];
GFPAdBannerOptions *bannerOptions = [[GFPAdBannerOptions alloc] init];
bannerOptions.omFriendlyObstructions = @[obstruction];