Skip to content

Commit

Permalink
Vis X Bid Adapter : retrieve and send seller defined audiences (#11638)
Browse files Browse the repository at this point in the history
* AF-3647 added device object to request in visxBidAdapter

* AF-3647 added user, regs, site and user agent data to request

* AF-3647 removed userAgentClientHints because of it is gotten from device object

* AF-3647 updated test scenarios with sda signals

* AF-3647 fixed to getting ortb2 and spec file

* AF-3647 reverted to get user data from cookie/local storage
  • Loading branch information
Goncakkd authored Jun 4, 2024
1 parent 1258c53 commit 402b524
Show file tree
Hide file tree
Showing 2 changed files with 725 additions and 55 deletions.
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

0 comments on commit 402b524

Please sign in to comment.