Skip to content

Commit

Permalink
refactor dynamic GumGum blocking logic for A9 fetchBids
Browse files Browse the repository at this point in the history
  • Loading branch information
dskamiotis committed Dec 20, 2024
1 parent 33222ab commit 8c7e2bc
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/lib/header-bidding/a9/a9.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,23 +92,26 @@ const requestBids = async (
* @param adUnits - The array of ad units to be filtered.
* @returns The filtered array of ad units based on the page context.
*/
const filteredAdUnits = adUnits.filter((adUnit) => {
if (isNetworkFront) {
return adUnit.slotID === 'dfp-ad--inline1--mobile';
}
if (isSectionFront) {
return adUnit.slotID === 'dfp-ad--top-above-nav';
}
if (!window.guardian.config.page.isFront) {
return true;
const updatedAdUnits = adUnits.map((adUnit) => {
let blockedBidders: string[] = [];

if (isNetworkFront && adUnit.slotID === 'dfp-ad--inline1--mobile') {
blockedBidders = ['1lsxjb4']; // Block GumGum for network front condition
} else if (
isSectionFront &&
adUnit.slotID === 'dfp-ad--top-above-nav'
) {
blockedBidders = ['1lsxjb4']; // Block GumGum for section front condition
}

return { ...adUnit, params: { blockedBidders } };
});

requestQueue = requestQueue
.then(
() =>
new Promise<void>((resolve) => {
window.apstag?.fetchBids({ slots: filteredAdUnits }, () => {
window.apstag?.fetchBids({ slots: updatedAdUnits }, () => {
window.googletag.cmd.push(() => {
window.apstag?.setDisplayBids();
resolve();
Expand Down

0 comments on commit 8c7e2bc

Please sign in to comment.