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

Vis X Bid Adapter : retrieve and send seller defined audiences #11638

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
48 changes: 34 additions & 14 deletions modules/visxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,16 @@ export const spec = {
config.getConfig('currency.adServerCurrency') ||
DEFAULT_CUR;

let request;
let reqId;
let payloadSchain;
let payloadUserId;
let payloadUserEids;
let timeout;
let payloadDevice;
let payloadSite;
let payloadRegs;
let payloadContent;

if (currencyWhiteList.indexOf(currency) === -1) {
logError(LOG_ERROR_MESS.notAllowedCurrency + currency);
Expand All @@ -80,9 +85,7 @@ export const spec = {
imp.push(impObj);
bidsMap[bid.bidId] = bid;
}

const { params: { uid }, schain, userId, userIdAsEids } = bid;

if (!payloadSchain && schain) {
payloadSchain = schain;
}
Expand All @@ -93,17 +96,15 @@ export const spec = {
if (!payloadUserId && userId) {
payloadUserId = userId;
}

auids.push(uid);
});

const payload = {};

if (bidderRequest) {
timeout = bidderRequest.timeout;
if (bidderRequest.refererInfo && bidderRequest.refererInfo.page) {
// TODO: is 'page' the right value here?
payload.u = bidderRequest.refererInfo.page;
}

if (bidderRequest.gdprConsent) {
if (bidderRequest.gdprConsent.consentString) {
payload.gdpr_consent = bidderRequest.gdprConsent.consentString;
Expand All @@ -112,6 +113,21 @@ export const spec = {
(typeof bidderRequest.gdprConsent.gdprApplies === 'boolean')
? Number(bidderRequest.gdprConsent.gdprApplies) : 1;
}

const { ortb2 } = bidderRequest;
const { device, site, regs, content } = ortb2;
if (device) {
payloadDevice = device;
}
if (site) {
payloadSite = site;
}
if (regs) {
payloadRegs = regs;
}
if (content) {
payloadContent = content;
}
}

const tmax = timeout;
Expand All @@ -131,21 +147,25 @@ export const spec = {
...(vads && { vads })
}
};
const regs = ('gdpr_applies' in payload) && {
ext: {
gdpr: payload.gdpr_applies
}
};
if (payloadRegs === undefined) {
payloadRegs = ('gdpr_applies' in payload) && {
ext: {
gdpr: payload.gdpr_applies
}
};
}

const request = {
request = {
id: reqId,
imp,
tmax,
cur: [currency],
source,
site: { page: payload.u },
...(Object.keys(user.ext).length && { user }),
...(regs && { regs })
...(payloadRegs && {regs: payloadRegs}),
...(payloadDevice && { device: payloadDevice }),
...(payloadSite && { site: payloadSite }),
...(payloadContent && { content: payloadContent }),
};

return {
Expand Down
Loading