Redundancy Control
All types of ads loaded through GfpAdLoader can utilize the GfpDedupeManager class to prevent duplicate exposures and ensure that unique ads are displayed for consecutively requested ads. In other words, GfpDedupeManager provides a deduplication feature to deliver diverse ads to users.
Deduplication can only be applied to ads controlled by NAM, i.e., S2S ads processed through the NDA module.
1. GfpDedupeManager Configuration
To handle deduplicated ad requests supported by the NAM SDK, you first need to create a GfpDedupeManager. The following example demonstrates how to configure five ad units grouped into a single group called Chunk, ensuring that unique ads are displayed within the group without duplication. Here, Chunk refers to a group internally used by the SDK to manage and control duplication among ad units.
- Kotlin
- Java
val dedupeManager = GfpDedupeManager(5)
GfpDedupeManager dedupeManager = new GfpDedupeManager(5);
The numAdsDeduped value, which is the first argument of the GfpDedupeManager constructor, is recommended to be assigned a number between 2 and 5.
2. Load Ads
To load ads with deduplication enabled, you must handle ad loading through the pre-created GfpDedupeManager. To use the deduplication feature for loading ads, you need to call the loadAd() method of GfpDedupeManager. This method takes a GfpAdLoader object as an argument, which is used to load the ads. In other words, by creating a GfpAdLoader object and passing it as an argument to the loadAd() method, ads are loaded through the deduplication logic.
The GfpAdLoader objects passed to the loadAd() method are processed in the order they are passed. In other words, the ad loading result of the GfpAdLoader passed first may affect the deduplication logic of subsequent GfpAdLoader objects.
The deduplication feature can only be applied to GfpAdLoader objects loaded through the loadAd() method of GfpDedupeManager.
- Kotlin
- Java
val dedupeManager = GfpDedupeManager(5)
// . . .
val adLoader1 = GfpAdLoader.Builder(context, adParam)
.withAdListener(/* ... */)
.withNativeSimpleAd(/* ... */)
.build()
val adLoader2 = GfpAdLoader.Builder(context, adParam)
.withAdListener(/* ... */)
.withNativeSimpleAd(/* ... */)
.build()
// . . .
dedupeManager.loadAd(adLoader1)
dedupeManager.loadAd(adLoader2)
GfpDedupeManager dedupeManager = new GfpDedupeManager(5);
// . . .
GfpAdLoader adLoader1 = new GfpAdLoader.Builder(context, adParam)
.withAdListener(/* ... */)
.withNativeSimpleAd(/* ... */)
.build();
GfpAdLoader adLoader2 = new GfpAdLoader.Builder(context, adParam)
.withAdListener(/* ... */)
.withNativeSimpleAd(/* ... */)
.build();
// . . .
dedupeManager.loadAd(adLoader1)
dedupeManager.loadAd(adLoader2)
3. Ad Events
The GfpDedupeManager is responsible for handling ad requests by deduplicating the GfpAdLoader objects passed through the loadAd() method. Ad events (e.g., ad clicks, impressions) that occur after the ads are loaded should be handled using the appropriate event listener setup based on the loaded ad format. In other words, while the GfpDedupeManager manages ad deduplication, it operates independently of ad event handling.
4. Release Resources
The GfpAdLoader objects requested through the loadAd() method of GfpDedupeManager can have their resources released by calling the destroy() method of GfpDedupeManager. Additionally, calling the destroy() method resets the values used for deduplication, allowing all deduplication-related settings to be cleared.
- Kotlin
- Java
val dedupeManager = GfpDedupeManager(5)
...
dedupeManager.loadAd(adLoader1)
dedupeManager.loadAd(adLoader2)
...
dedupeManager.destroy()
GfpDedupeManager dedupeManager = new GfpDedupeManager(5);
...
dedupeManager.loadAd(adLoader1);
dedupeManager.loadAd(adLoader2);
...
dedupeManager.destroy();
Deduplication Behavior Explanation
The following image visually explains the deduplication behavior of GfpDedupeManager when the numAdsDeduped value is set to 5. This demonstrates how the deduplication logic manages to provide unique ads within a group of 5 ads grouped as a single Chunk.
Within the same Chunk, all ads are guaranteed to display unique ad creatives. However, based on the most recent ad call, up to numAdsDeduped * 2 ads may or may not display unique ad creatives. This is because the deduplication logic operates by processing the next request after receiving the response for the previous ad request. For example, in scenarios where multiple ads in a list are displayed at specific intervals and the user scrolls quickly, ad requests may be delayed. To prevent this, a mechanism is included to adjust ad requests to avoid excessive delays, improving the user experience.
At the 5th Ad Display
- Ads 1 to 5 are grouped into Chunk1, ensuring that all ads within this group display unique ad creatives.
At the 9th Ad Display
- Ads 6 to 9 are grouped into Chunk2, ensuring that all ads within this group display unique ad creatives.
- Ads 1 to 5 are deduplicated within their group, but there may or may not be duplicate ads between Ads 1 to 5 and Ads 6 to 9.
- In the best-case scenario, deduplication is applied across Ads 1 to 9.
At the 13th Ad Display
- Ads 11 to 13 are grouped into Chunk3, ensuring that all ads within this group display unique ad creatives.
- Ads 3 to 10 may or may not display unique ad creatives.
- In the best-case scenario, deduplication is applied across Ads 3 to 13.