Ad Deduplication
The deduplication feature is supported for ads (banner / native simple / native general type ads) loaded using the unified loader (= GFPAdLoader).
Create GFPAdDedupeManager
Declare a GFPAdDedupeManager property and create an instance to manage deduplication.
numAdsDedupe refers to the number of ads subject to deduplication control. It guarantees non-duplicate ad exposure for n consecutive ads.
It is recommended to set this parameter to a value between 2 and 5.
- Swift
- Objective-C
var dedupeManager : GFPAdDedupeManager?
@property (nonatomic, strong) GFPAdDedupeManager *dedupeManager;
- Swift
- Objective-C
self.dedupeManager = GFPAdDedupeManager(numAdsDeduped: 3) //Number of ads for which deduplication is guaranteed.
self.dedupeManager = [[GFPAdDedupeManager alloc] initWithNumAdsDeduped:3]; //Number of ads for which deduplication is guaranteed.
Create GFPAdLoader
Create a GFPAdLoader object to load ads.
For guidance on creating a GFPAdLoader object for each ad type, refer to the following:
Ad Request via GFPAdDedupeManager
Request ads through GFPAdDedupeManager. Pass a GFPAdLoader as a parameter when making the ad request.
Ads are requested in the order of the provided loaders, and the load success or failure is delivered to the delegate of the respective loader.
- Swift
- Objective-C
self.dedupeManager?.loadAd(with: self.loader)
[self.dedupeManager loadAdWith:self.loader];
Deduplication is also available for
GFPAdLoaderobjects with different Unit IDs.
- Swift
- Objective-C
self.loader2 = GFPAdLoader.init(unitID: "INPUT_YOUR_UNIT_ID2", rootViewController: self, adParam: adParam)
...(omitted)... //option configuration and registration
self.loader2.delegate = self;
self.loader3 = GFPAdLoader.init(unitID: "INPUT_YOUR_UNIT_ID3", rootViewController: self, adParam: adParam)
...(omitted)... //option configuration and registration
self.loader3.delegate = self;
self.dedupeManager?.loadAd(with: loader2)
self.dedupeManager?.loadAd(with: loader3)
self.loader2 = [[GFPAdLoader alloc] initWithUnitID: @"INPUT_YOUR_UNIT_ID2"
rootViewController: self
adParam: adParam];
...(omitted)... //option configuration and registration
self.loader2.delegate = self;
self.loader3 = [[GFPAdLoader alloc] initWithUnitID: @"INPUT_YOUR_UNIT_ID3"
rootViewController: self
adParam: adParam];
...(omitted)... //option configuration and registration
self.loader3.delegate = self;
[self.dedupeManager loadAdWith:self.loader2];
[self.dedupeManager loadAdWith:self.loader3];
GFPAdLoaderDelegate
By implementing GFPAdLoaderDelegate, you can receive ad loading-related events through the corresponding methods.
For handling GFPAdLoaderDelegate for each ad type, refer to the following guides: