Skip to content

Nexx360 Bid Adapter: placement support added #12953

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

Merged
merged 1 commit into from
Apr 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
58 changes: 25 additions & 33 deletions modules/nexx360BidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const OUTSTREAM_RENDERER_URL = 'https://acdn.adnxs.com/video/outstream/ANOutstre
const BIDDER_CODE = 'nexx360';
const REQUEST_URL = 'https://fast.nexx360.io/booster';
const PAGE_VIEW_ID = generateUUID();
const BIDDER_VERSION = '4.3';
const BIDDER_VERSION = '5.0';
const GVLID = 965;
const NEXXID_KEY = 'nexx360_storage';

Expand All @@ -35,7 +35,7 @@ const ALIASES = [
{ code: 'pubtech' },
{ code: '1accord', gvlid: 965 },
{ code: 'easybid', gvlid: 1068 },
{ code: 'prismassp', gvlid: 965 },
{ code: 'prismassp', gvlid: 965 }
];

export const storage = getStorageManager({
Expand Down Expand Up @@ -66,15 +66,9 @@ export function getNexx360LocalStorage() {
}
}

function getAdContainer(container) {
if (document.getElementById(container)) {
return document.getElementById(container);
}
}

/**
* Get the AMX ID
* @return {string | false } false if localstorageNotEnabled
* @return { string | false } false if localstorageNotEnabled
*/
export function getAmxId() {
if (!storage.localStorageIsEnabled()) {
Expand All @@ -91,40 +85,36 @@ const converter = ortbConverter({
ttl: 90, // default bidResponse.ttl (when not specified in ORTB response.seatbid[].bid[].exp)
},
imp(buildImp, bidRequest, context) {
// console.log(bidRequest, context);
const imp = buildImp(bidRequest, context);
const tagid = bidRequest.params.adUnitName ? bidRequest.params.adUnitName : bidRequest.adUnitCode;
deepSetValue(imp, 'tagid', tagid);
deepSetValue(imp, 'tagid', bidRequest.adUnitCode);
deepSetValue(imp, 'ext.adUnitCode', bidRequest.adUnitCode);
const divId = bidRequest.params.divId ? bidRequest.params.divId : bidRequest.adUnitCode;
if (bidRequest.params.adUnitPath) deepSetValue(imp, 'ext.adUnitPath', bidRequest.params.adUnitPath);
if (bidRequest.params.adUnitName) deepSetValue(imp, 'ext.adUnitName', bidRequest.params.adUnitName);
const divId = bidRequest.params.divId || bidRequest.adUnitCode;
deepSetValue(imp, 'ext.divId', divId);
const slotEl = getAdContainer(divId);
const slotEl = document.getElementById(divId);
if (slotEl) {
deepSetValue(imp, 'ext.dimensions.slotW', slotEl.offsetWidth);
deepSetValue(imp, 'ext.dimensions.slotH', slotEl.offsetHeight);
deepSetValue(imp, 'ext.dimensions.cssMaxW', slotEl.style?.maxWidth);
deepSetValue(imp, 'ext.dimensions.cssMaxH', slotEl.style?.maxHeight);
}
deepSetValue(imp, 'ext.nexx360', bidRequest.params.tagId);
deepSetValue(imp, 'ext.nexx360.tagId', bidRequest.params.tagId);
deepSetValue(imp, 'ext.nexx360.videoTagId', bidRequest.params.videoTagId);
deepSetValue(imp, 'ext.nexx360.allBids', bidRequest.params.allBids);
if (bidRequest.params.tagId) deepSetValue(imp, 'ext.nexx360.tagId', bidRequest.params.tagId);
if (bidRequest.params.placement) deepSetValue(imp, 'ext.nexx360.placement', bidRequest.params.placement);
if (bidRequest.params.videoTagId) deepSetValue(imp, 'ext.nexx360.videoTagId', bidRequest.params.videoTagId);
if (bidRequest.params.allBids) deepSetValue(imp, 'ext.nexx360.allBids', bidRequest.params.allBids);
if (imp.video) {
const playerSize = deepAccess(bidRequest, 'mediaTypes.video.playerSize');
const videoContext = deepAccess(bidRequest, 'mediaTypes.video.context');
deepSetValue(imp, 'video.ext.playerSize', playerSize);
deepSetValue(imp, 'video.ext.context', videoContext);
}

if (bidRequest.params.adUnitName) deepSetValue(imp, 'ext.adUnitName', bidRequest.params.adUnitName);
if (bidRequest.params.adUnitPath) deepSetValue(imp, 'ext.adUnitPath', bidRequest.params.adUnitPath);
return imp;
},
request(buildRequest, imps, bidderRequest, context) {
const request = buildRequest(imps, bidderRequest, context);
const nexx360LocalStorage = getNexx360LocalStorage();
if (nexx360LocalStorage) {
deepSetValue(request, 'ext.nexx360Id', nexx360LocalStorage.nexx360Id);
deepSetValue(request, 'ext.localStorage.nexx360Id', nexx360LocalStorage.nexx360Id);
}
const amxId = getAmxId();
Expand Down Expand Up @@ -174,8 +164,8 @@ function isBidRequestValid(bid) {
logError('bid.params.allBids needs to be a boolean');
return false;
}
if (!bid.params.tagId && !bid.params.videoTagId && !bid.params.nativeTagId) {
logError('bid.params.tagId or bid.params.videoTagId or bid.params.nativeTagId must be defined');
if (!bid.params.tagId && !bid.params.videoTagId && !bid.params.nativeTagId && !bid.params.placement) {
logError('bid.params.tagId or bid.params.videoTagId or bid.params.nativeTagId or bid.params.placement must be defined');
return false;
}
return true;
Expand Down Expand Up @@ -212,16 +202,17 @@ function interpretResponse(serverResponse) {
const { bidderSettings } = getGlobal();
const allowAlternateBidderCodes = bidderSettings && bidderSettings.standard ? bidderSettings.standard.allowAlternateBidderCodes : false;

let bids = [];
respBody.seatbid.forEach(seatbid => {
bids = [...bids, ...seatbid.bid.map(bid => {
let responses = [];
for (let i = 0; i < respBody.seatbid.length; i++) {
const seatbid = respBody.seatbid[i];
for (let j = 0; j < seatbid.bid.length; j++) {
const bid = seatbid.bid[j];
const response = {
requestId: bid.impid,
cpm: bid.price,
width: bid.w,
height: bid.h,
creativeId: bid.crid,
dealId: bid.dealid,
currency: respBody.cur,
netRevenue: true,
ttl: 120,
Expand All @@ -231,6 +222,7 @@ function interpretResponse(serverResponse) {
demandSource: bid.ext.ssp,
},
};
if (bid.dealid) response.dealid = bid.dealid;
if (allowAlternateBidderCodes) response.bidderCode = `n360_${bid.ext.ssp}`;

if (bid.ext.mediaType === BANNER) {
Expand All @@ -244,7 +236,7 @@ function interpretResponse(serverResponse) {

if (bid.ext.mediaType === OUTSTREAM) {
response.renderer = createRenderer(bid, OUTSTREAM_RENDERER_URL);
response.divId = bid.ext.divId
if (bid.ext.divId) response.divId = bid.ext.divId
};
if (bid.ext.mediaType === NATIVE) {
try {
Expand All @@ -253,10 +245,10 @@ function interpretResponse(serverResponse) {
}
} catch (e) {}
}
return response;
})];
});
return bids;
responses.push(response);
}
}
return responses;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion modules/nexx360BidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Maintainer: [email protected]

Connects to Nexx360 network for bids.

To use us as a bidder you must have an account and an active "tagId" on our Nexx360 platform.
To use us as a bidder you must have an account and an active "tagId" or "placement" on our Nexx360 platform.

# Test Parameters

Expand Down
Loading