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

New Bidder: dexerto #12182

Merged
merged 4 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
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
48 changes: 29 additions & 19 deletions libraries/audUtils/bidderUtils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
deepAccess,
deepSetValue,
generateUUID,
logError
Expand Down Expand Up @@ -50,23 +51,23 @@ export const getBannerResponse = (bidResponse, mediaType) => {
let responseArray = [];
if (bidResponse) {
try {
let bidResp = bidResponse.body && bidResponse.body.seatbid && bidResponse.body.seatbid[0] ? bidResponse.body.seatbid[0].bid : [];
let bidResp = deepAccess(bidResponse, 'body.seatbid', []);
if (bidResp) {
bidResp.forEach(bidReq => {
bidResp[0].bid.forEach(bidReq => {
let response = {};
response.requestId = bidReq.impid ? bidReq.impid : undefined;
response.cpm = bidReq.price ? bidReq.price : 0.0;
response.width = bidReq.w ? bidReq.w : 0;
response.height = bidReq.h ? bidReq.h : 0;
response.ad = bidReq.adm ? bidReq.adm : '';
response.requestId = bidReq.impid;
response.cpm = bidReq.price;
response.width = bidReq.w;
response.height = bidReq.h;
response.ad = bidReq.adm;
response.meta = {
advertiserDomains: bidReq.adomain ? bidReq.adomain : []
advertiserDomains: bidReq.adomain
};
response.creativeId = bidReq.crid ? bidReq.crid : undefined;
response.creativeId = bidReq.crid;
response.netRevenue = false;
response.currency = bidReq.cur ? bidReq.cur : 'USD';
response.currency = 'USD';
response.ttl = 300;
response.dealId = bidReq.dealId ? bidReq.dealId : undefined;
response.dealId = bidReq.dealId;
response.mediaType = mediaType;
responseArray.push(response);
});
Expand Down Expand Up @@ -107,23 +108,32 @@ const getBannerDetails = (bidReq) => {
}
// Function to get floor price
const getFloorPrice = (bidReq) => {
let bidfloor = bidReq.params && bidReq.params.bid_floor ? bidReq.params.bid_floor : 0
let bidfloor = deepAccess(bidReq, 'params.bid_floor', 0);
return bidfloor;
}
// Function to get site object
const getSiteDetails = (bidderRequest) => {
let page = bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.page ? bidderRequest.refererInfo.page : '';
let name = bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.domain ? bidderRequest.refererInfo.domain : '';
let page = '';
let name = '';
if (bidderRequest && bidderRequest.refererInfo) {
page = bidderRequest.refererInfo.page;
name = bidderRequest.refererInfo.domain;
}
return {page: page, name: name};
}
// Function to build the user object
const getUserDetails = (bidReq) => {
let user = {};
if (bidReq.params) {
user.id = bidReq.params.user_id ? bidReq.params.user_id : '';
user.buyeruid = bidReq.params.buyeruid ? bidReq.params.buyeruid : ''; ;
user.keywords = bidReq.params.keywords ? bidReq.params.keywords : '';
user.customdata = bidReq.params.customdata ? bidReq.params.customdata : '';
if (bidReq && bidReq.ortb2 && bidReq.ortb2.user) {
user.id = bidReq.ortb2.user.id ? bidReq.ortb2.user.id : '';
user.buyeruid = bidReq.ortb2.user.buyeruid ? bidReq.ortb2.user.buyeruid : '';
user.keywords = bidReq.ortb2.user.keywords ? bidReq.ortb2.user.keywords : '';
user.customdata = bidReq.ortb2.user.customdata ? bidReq.ortb2.user.customdata : '';
} else {
user.id = '';
user.buyeruid = '';
user.keywords = '';
user.customdata = '';
ncolletti marked this conversation as resolved.
Show resolved Hide resolved
}
return user;
}
3 changes: 1 addition & 2 deletions modules/dexertoBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ Module that connects to dexerto's demand sources.
placement_id: 110003, // Required parameter
ncolletti marked this conversation as resolved.
Show resolved Hide resolved
width: 300, // Optional parameter
height: 250, // Optional parameter
domain: '', // Optional parameter
bid_floor: 0.1 // Optional parameter
bid_floor: 0.1 // Optional parameter
}
}
]
Expand Down