From 8c7e2bcf8441addc1b499609ecb7d7505f0bffe0 Mon Sep 17 00:00:00 2001 From: Demetrios Skamiotis Date: Fri, 20 Dec 2024 09:57:12 +0000 Subject: [PATCH] refactor dynamic GumGum blocking logic for A9 fetchBids --- src/lib/header-bidding/a9/a9.ts | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/lib/header-bidding/a9/a9.ts b/src/lib/header-bidding/a9/a9.ts index 3cd450c60..6bc809ecd 100644 --- a/src/lib/header-bidding/a9/a9.ts +++ b/src/lib/header-bidding/a9/a9.ts @@ -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((resolve) => { - window.apstag?.fetchBids({ slots: filteredAdUnits }, () => { + window.apstag?.fetchBids({ slots: updatedAdUnits }, () => { window.googletag.cmd.push(() => { window.apstag?.setDisplayBids(); resolve();