Skip to content

Commit

Permalink
OMS Adapter: add gpid support
Browse files Browse the repository at this point in the history
  • Loading branch information
prBigBrother committed Mar 19, 2024
1 parent 4b4648e commit ef5327a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion modules/omsBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ function buildRequests(bidReqs, bidderRequest) {
const minSize = _getMinSize(processedSizes);
const viewabilityAmount = _isViewabilityMeasurable(element) ? _getViewability(element, getWindowTop(), minSize) : 'na';
const viewabilityAmountRounded = isNaN(viewabilityAmount) ? viewabilityAmount : Math.round(viewabilityAmount);
const gpidData = _extractGpidData(bid);

const imp = {
id: bid.bidId,
banner: {
format: processedSizes,
ext: {
viewability: viewabilityAmountRounded
viewability: viewabilityAmountRounded,
...gpidData
}
},
tagid: String(bid.adUnitCode)
Expand Down Expand Up @@ -241,6 +243,15 @@ function _getViewability(element, topWin, {w, h} = {}) {
return getWindowTop().document.visibilityState === 'visible' ? percentInView(element, topWin, {w, h}) : 0;
}

function _extractGpidData(bid) {
return {
gpid: bid?.ortb2Imp?.ext?.gpid,
adserverName: bid?.ortb2Imp?.ext?.data?.adserver?.name,
adslot: bid?.ortb2Imp?.ext?.data?.adserver?.adslot,
pbadslot: bid?.ortb2Imp?.ext?.data?.pbadslot,
}
}

function _isIframe() {
try {
return getWindowSelf() !== getWindowTop();
Expand All @@ -267,4 +278,6 @@ function _getBidFloor(bid) {
return null;
}



registerBidder(spec);

0 comments on commit ef5327a

Please sign in to comment.