Skip to main content

Header bidding application guide

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"

BannerAdUnit *bannerAdUnit = [[BannerAdUnit alloc] initWithConfigId:@"configId 입력" size:CGSizeMake(300, 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.
NSMutableDictionary *requestPrebid = [NSMutableDictionary dictionary];
[bannerAdUnit fetchDemandWithAdObject:requestPrebid completion:^(enum ResultCode result) {
if(result == ResultCodePrebidDemandFetchSuccess) {
//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.
GFPAdParam *adParam = [[GFPAdParam alloc] init];
adParam.gender = GFPAdParamGenderTypeFemale;
adParam.yearOfBirth = 1995;

adParam.prebidHBParam = requestPrebid;

//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] setMraidPolicy:CUSTOM_MRAID];
[[DTBAds sharedInstance] setMraidCustomVersions:@[@"1.0", @"2.0", @"3.0"]];

APS Information Request

For more information, please refer to the APS official guide

DTBAdSize *dtbAdSize = [[DTBAdSize alloc] initBannerAdSizeWithWidth:320 height:50 andSlotUUID:@"slotUUID"];
//testSlotUUID: "88e6293b-0bf0-43fc-947b-925babe7bf3f"

DTBAdLoader *adLoader = [DTBAdLoader new];
[adLoader setSizes:dtbAdSize, nil];
[adLoader loadAd:self];
#pragma mark - DTBAdCallback
- (void)onFailure: (DTBAdError)error {
NSLog(@"Failed to load ad :(");
/**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**/
}

- (void)onSuccess: (DTBAdResponse *)adResponse {
/**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.

- (void)onSuccess: (DTBAdResponse *)adResponse {
GFPAdParam *adParam = [[GFPAdParam alloc] init];
adParam.gender = GFPAdParamGenderTypeFemale;
adParam.yearOfBirth = 1995;

GFPAPSAdParam *apsParam = [[GFPAPSAdParam alloc] init];
apsParam.crid = adResponse.crid; // required
apsParam.size = CGSizeMake(adResponse.adSize.width, adResponse.adSize.height); // required
apsParam.mediationHints = adResponse.mediationHints(); // required for GFPSDK >=7.0.0
apsParam.apsHBParam = adResponse.customTargeting;
apsParam.skAdNetworkParams = adResponse.skAdNetworkParams;

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.

- (void)bannerShouldUnload:(GFPBannerView *)bannerView{
// ...
}