Skip to content

Commit

Permalink
adds logic to request ads for network or section fronts providing dif…
Browse files Browse the repository at this point in the history
…ferent slotId for each
  • Loading branch information
dskamiotis committed Dec 4, 2024
1 parent 9a0fbe5 commit b0389b1
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/lib/header-bidding/a9/a9.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,23 @@ const requestBids = async (
return requestQueue;
}

const section = window.guardian.config.page.section;

const isNetworkFront =
section === 'uk' || section === 'us' || section === 'au';

const filteredAdUnits = adUnits.filter((adUnit) => {
if (isNetworkFront) {
return adUnit.slotID === 'dfp-ad--inline1--mobile';
}
return adUnit.slotID === 'dfp-ad--top-above-nav';
});

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

0 comments on commit b0389b1

Please sign in to comment.