Skip to main content

Header Bidding

Header Bidding

HeaderBidding is supported through PrebidMobile and Amazon Publisher Services (APS). PrebidMobile was confirmed based on version 1.5. Please note that APS completed the sample development and QA verification based on version 3.4.6 provided by Amazon.

The guide below covers content related to GFPSDK integration. For more information about PrebidMobile, please refer to the official guide.

source 'https://github.com/CocoaPods/Specs.git'

target 'MyApplication' do
pod 'PrebidMobile', '1.5'
pod 'AmazonPublisherServicesSDK', '3.4.6'
end

PrebidMobile Integration

danger

Header bidding integration through PrebidMobile is supported only for banner ads with GFPSDK version 1.4.0 or higher.

The guide below covers content related to GFPSDK integration. For more information about PrebidMobile, please refer to the official guide

Prebid Settings

Prebid.shared.prebidServerAccountId = @"accountId 입력";
//testAccountId: "bfa84af2-bd16-4d35-96ad-31c6bb888df0"

let bannerAdUnit = BannerAdUnit(configId: "configId 입력", size: CGSize(width: 300, height: 250))
//testConfigId: "6ace8c7d-88c0-4623-8117-75bc3f0a2e45"

Prebid Information Request

  • Call fetchDemandWithAdObject:completion: with NSMutableDictionary as a parameter.
  • When the fetch is successful, data with the prefix “hb_“ will be added to the created Dictionary.
let requestPrebid = NSMutableDictionary.init()

bannerAdUnit.fetchDemand(adObject: requestPrebid) { (resultCode) in
if resultCode == ResultCode.prebidDemandFetchSuccess {
//TODO: load banner ad
}
}

AdParam Settings & Banner Loading

  • Set the Dictionary data obtained in step 2 to the prebidHBParam of AdParam.
  • Set the AdParam in GFPAdLoader or GFPBannerView, and request an advertisement.
  • For more information about AdParam, please refer to the Ad request information guide.
let adParam = GFPAdParam()
adParam.gender = .female
adParam.yearOfBirth = 1995

if let prebidParam = requestPrebid as? [String : String] {
adParam.prebidHBParam = prebidParam
}

//TODO: load ad

APS Integration

danger

GFPSDK 2.0.0-6.x.x | Only supported in banner ads

GFPSDK >=7.0.0 | Only supported in banner and rewarded ads (interstitial ad is not supported).

The guide below covers content related to GFPSDK integration. For more information about APS please refer to the official guide

APS Settings

MRAID 1.0, 2.0, and 3.0 specifications are supported in GFPSDK. Make sure to follow the MRAID settings below.

DTBAds.sharedInstance().setAppKey("appKey")
//testAppKey: "c5f20fe6e37146b08749d09bb2b6a4dd"

DTBAds.sharedInstance().mraidPolicy = CUSTOM_MRAID
DTBAds.sharedInstance().mraidCustomVersions = ["1.0", "2.0", "3.0"]

APS Information Request

For more information, please refer to the APS official guide

let dtbAdSize = DTBAdSize(bannerAdSizeWithWidth: 320, height: 50, andSlotUUID: "slotUUID 입력")
//testSlotUUID: "88e6293b-0bf0-43fc-947b-925babe7bf3f"

let dtbAdLoader = DTBAdLoader()
dtbAdLoader.setAdSizes([dtbAdSize])
dtbAdLoader.loadAd(self)
func onFailure(_ error: DTBAdError) {
/**Please implement the logic to send ad request without our parameters if you want to
show ads from other ad networks when Amazon ad request fails**/
}

func onSuccess(_ adResponse: DTBAdResponse!) {
/**Build the ad request to your ad server. This portion will differ depending on your
ad server**/
}

AdParam Setting & Banner Loading

  • When onSuccess was received for DTBAdCallback, set the APS information in GFPAPSAdParam and then set it up in apsParam of AdParam.
  • Set AdParam on each ad type call and then send an ad request.
danger

For each advertisement call, a new DTBAdResponse must be downloaded and set to GFPAdParam.GFPApsAdParam. When a DTBAdResponse is reused, the identical advertising materials may be exposed repeatedly.

func onSuccess(_ adResponse: DTBAdResponse!) {
let adParam = GFPAdParam()
adParam.gender = .female
adParam.yearOfBirth = 1995

let apsParam = GFPAPSAdParam()
apsParam.crid = adResponse.crid // required
apsParam.size = CGSize(width: adResponse.adSize.width, height: adResponse.adSize.height) // required
apsParam.mediationHints = adResponse.mediationHints() // required for GFPSDK >=7.0.0
apsParam.apsHBParam = adResponse.customTargeting
apsParam.skAdNetworkParams = adResponse.skAdNetworkParams

if let customTargeting = adResponse.customTargeting().map as? [String : NSObject] {
apsParam.apsHBParam = customTargeting
}

adParam.apsParam = apsParam;

//TODO: Load ad
}

MRAID 3.0 Unload

The following method has been added to GFPBannerViewDelegate to notify events that occur when Unload is called in MRAID 3.0.

func bannerShouldUnload(_ bannerView: GFPBannerView) {
// ...
}