Skip to main content

Banner Ad Options

Ad Rendering Type (Default: GFPDisplayAgentTypeInApp)

deprecated

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.

// 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

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.

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.

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()

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.

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.
let bannerOption = GFPAdBannerOptions()
bannerOption.layoutType = GFPBannerViewLayoutType(rawValue: 0)

Fluid Width Layout Configuration

  • You can set the banner ad's width manually.
let bannerOption = GFPAdBannerOptions()
bannerOption.layoutType = .fluidWidth
  • Request an ad with the fluid-width layout type set, and on success adjust the width of the received GFPBannerView to the desired size.
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
  • 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.
let bannerOption = GFPAdBannerOptions()
bannerOption.layoutType = .fluidHeight

Fluid Layout Configuration

  • You can set the banner ad's width and height manually by configuring the fluid layout type.
let bannerOption = GFPAdBannerOptions()
bannerOption.layoutType = .fluid

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.

//example
let bannerOption = GFPAdBannerOptions()
bannerOption.hostMeta = ["light":"theme"]
bannerOption.hostMeta = ["dark":"theme"]
bannerOption.hostMeta = ["system":"theme"] // 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).

ValueDescription
GFPMraidSupportNoneNo additional features (default)
GFPMraidSupportSMSSMS sending
GFPMraidSupportTelPhone call
GFPMraidSupportCalendarAdd calendar event
GFPMraidSupportInlineVideoInline video playback
GFPMraidSupportPictureSave photo
GFPMraidSupportLocationLocation access
GFPMraidSupportVPAIDVPAID support
GFPMraidSupportDefaultDefault feature set
let bannerOption = GFPAdBannerOptions()
bannerOption.mraidSupportType = [.sms, .tel, .calendar]

WebView Options Configuration

Configure the scroll inset and initial offset for the banner WebView using GFPAdBannerWebViewOptions.

PropertyTypeDescription
contentInsetAdjustmentBehaviorUIScrollViewContentInsetAdjustmentBehaviorScroll view inset adjustment behavior
defaultContentOffsetCGPointInitial content offset
let webViewOption = GFPAdBannerWebViewOptions()
webViewOption.contentInsetAdjustmentBehavior = .never
webViewOption.defaultContentOffset = .zero

let bannerOption = GFPAdBannerOptions()
bannerOption.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 TypeDescription
GFPFriendlyObstructionTypeMediaControlsMedia controls
GFPFriendlyObstructionTypeCloseAdClose button
GFPFriendlyObstructionTypeNotVisibleViews not visible on screen
GFPFriendlyObstructionTypeOtherOther
let obstruction = GFPOMFriendlyObstruction(with: closeButton, purpose: .closeAd, reason: "close button")

let bannerOption = GFPAdBannerOptions()
bannerOption.omFriendlyObstructions = [obstruction]