Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OMS Adapter: add gpid support #11238

Merged
merged 3 commits into from
Mar 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why put this on imp.banner.ext when it belongs where you pulled it from, on imp.ext?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patmmccann good catch, thank you, fixed

}
},
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 Down