Skip to content

Commit

Permalink
relevantBidAdapter: support s2s
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Lindström committed Oct 13, 2023
1 parent 2b3426d commit b69eed3
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion modules/relevantdigitalBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,14 @@ export const spec = {
isBidRequestValid: (bid) => bid.params?.placementId && getBidderConfig([bid]).complete,

/** Trigger impression-pixel */
onBidWon: ({pbsWurl}) => pbsWurl && triggerPixel(pbsWurl),
onBidWon(bid) {
if (bid.pbsWurl) {
triggerPixel(bid.pbsWurl)
}
if (bid.burl) {
triggerPixel(bid.burl)
}
},

/** Build BidRequest for PBS */
buildRequests(bidRequests, bidderRequest) {
Expand Down Expand Up @@ -193,6 +200,24 @@ export const spec = {
});
return syncs;
},

/** If server side, transform bid params if needed */
transformBidParams(params, isOrtb, adUnit, bidRequests) {
if (!params.placementId) {
return;
}
const bid = bidRequests.flatMap(req => req.adUnitsS2SCopy || []).flatMap((adUnit) => adUnit.bids).find((bid) => bid.params?.placementId === params.placementId);
if (!bid) {
return;
}
const cfg = getBidderConfig([bid]);
FIELDS.forEach(({ name }) => {
if (cfg[name] && !params[name]) {
params[name] = cfg[name];
}
});
return params;
},
};

registerBidder(spec);

0 comments on commit b69eed3

Please sign in to comment.