Skip to content

Commit

Permalink
add pubmatic placement id for US (#1674)
Browse files Browse the repository at this point in the history
* add pubmatic placement id for US

* add changeset
  • Loading branch information
dskamiotis authored Nov 21, 2024
1 parent 45491ac commit c5c0a0a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/giant-toes-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@guardian/commercial': patch
---

add US specific placement ID for pubmatic ad partner
23 changes: 16 additions & 7 deletions src/lib/header-bidding/prebid/bid-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,20 +493,29 @@ const getAdYouLikePlacementId = (sizes: HeaderBiddingSize[]) => {
return '';
};

const getPubmaticPlacementId = (
slotId: string,
slotSizes: HeaderBiddingSize[],
): string | undefined => {
if (
slotId === 'dfp-ad--inline2' &&
slotSizes.find((size) => size.width === 371 && size.height === 660)
) {
return isInUsa()
? 'seenthis_guardian_mweb_us'
: 'seenthis_guardian_371x660_mweb';
}
return undefined;
};

const pubmaticBidder = (slotSizes: HeaderBiddingSize[]): PrebidBidder => {
const defaultParams = {
name: 'pubmatic' as BidderCode,
switchName: 'prebidPubmatic',
bidParams: (slotId: string): PrebidPubmaticParams => ({
publisherId: getPubmaticPublisherId(),
adSlot: stripDfpAdPrefixFrom(slotId),
placementId:
slotId === 'dfp-ad--inline2' &&
slotSizes.find(
(size) => size.width === 371 && size.height === 660,
)
? 'seenthis_guardian_371x660_mweb'
: undefined,
placementId: getPubmaticPlacementId(slotId, slotSizes),
}),
};

Expand Down

0 comments on commit c5c0a0a

Please sign in to comment.