Skip to content
Closed
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: 52 additions & 6 deletions modules/adagioAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ const cache = {
getAuction: function(auctionId, adUnitCode) {
return this.auctions[auctionId][adUnitCode];
},
getBiddersFromAuction: function(auctionId, adUnitCode) {
return this.getAuction(auctionId, adUnitCode).bdrs.split(',');
},
getAllAdUnitCodes: function(auctionId) {
return Object.keys(this.auctions[auctionId]);
},
updateAuction: function(auctionId, adUnitCode, values) {
this.auctions[auctionId][adUnitCode] = {
...this.auctions[auctionId][adUnitCode],
Expand Down Expand Up @@ -74,7 +80,8 @@ const adagioEnqueue = function adagioEnqueue(action, data) {

const guard = {
adagio: (value) => isAdagio(value),
bidTracked: (auctionId, adUnitCode) => deepAccess(cache, `auctions.${auctionId}.${adUnitCode}`, false)
bidTracked: (auctionId, adUnitCode) => deepAccess(cache, `auctions.${auctionId}.${adUnitCode}`, false),
auctionTracked: (auctionId) => deepAccess(cache, `auctions.${auctionId}`, false)
};

function removeDuplicates(arr, getKey) {
Expand Down Expand Up @@ -105,6 +112,19 @@ function getMediaTypeAlias(mediaType) {
return mediaTypesMap[mediaType] || mediaType;
};

function addKeyPrefix(obj, prefix) {
return Object.keys(obj).reduce((acc, key) => {
// We don't want to prefix already prefixed keys.
if (key.startsWith(prefix)) {
acc[key] = obj[key];
return acc;
}

acc[`${prefix}${key}`] = obj[key];
return acc;
}, {});
}

/**
* sendRequest to Adagio. It filter null values and encode each query param.
* @param {Object} qp
Expand Down Expand Up @@ -146,6 +166,7 @@ function getTargetedAuctionId(bid) {
* HANDLERS
* - handlerAuctionInit
* - handlerBidResponse
* - handlerAuctionEnd
* - handlerBidWon
* - handlerAdRender
*
Expand Down Expand Up @@ -227,11 +248,10 @@ function handlerAuctionInit(event) {
auct_id: adagioAuctionId,
adu_code: adUnitCode,
url_dmn: w.location.hostname,
dvc: params.environment,
pgtyp: params.pagetype,
plcmt: params.placement,
tname: params.testName || null,
tvname: params.testVariationName || null,
t_n: params.testName || null,
t_v: params.testVersion || null,
mts: mediaTypesKeys.join(','),
ban_szs: bannerSizes.join(','),
bdrs: bidders.map(bidder => getAdapterNameForAlias(bidder.bidder)).sort().join(','),
Expand All @@ -257,11 +277,33 @@ function handlerBidResponse(event) {
return;
}

if (!event.pba) {
return;
}

cache.updateAuction(event.auctionId, event.adUnitCode, {
adg_sid: event.seatId || null
...addKeyPrefix(event.pba, 'e_')
});
};

function handlerAuctionEnd(event) {
const { auctionId } = event;

if (!guard.auctionTracked(auctionId)) {
return;
}

const adUnitCodes = cache.getAllAdUnitCodes(auctionId);
adUnitCodes.forEach(adUnitCode => {
const mapper = (bidder) => event.bidsReceived.find(bid => bid.adUnitCode === adUnitCode && bid.bidder === bidder) ? '1' : '0';

cache.updateAuction(auctionId, adUnitCode, {
bdrs_bid: cache.getBiddersFromAuction(auctionId, adUnitCode).map(mapper).join(',')
});
sendNewBeacon(auctionId, adUnitCode);
});
}

function handlerBidWon(event) {
let auctionId = getTargetedAuctionId(event);

Expand Down Expand Up @@ -340,10 +382,14 @@ let adagioAdapter = Object.assign(adapter({ emptyUrl, analyticsType }), {
case CONSTANTS.EVENTS.BID_RESPONSE:
handlerBidResponse(args);
break;
case CONSTANTS.EVENTS.AUCTION_END:
handlerAuctionEnd(args);
break;
case CONSTANTS.EVENTS.BID_WON:
handlerBidWon(args);
break;
case CONSTANTS.EVENTS.AD_RENDER_SUCCEEDED:
// AD_RENDER_SUCCEEDED seems redundant with BID_WON.
// case CONSTANTS.EVENTS.AD_RENDER_SUCCEEDED:
case CONSTANTS.EVENTS.AD_RENDER_FAILED:
handlerAdRender(args, eventType === CONSTANTS.EVENTS.AD_RENDER_SUCCEEDED);
break;
Expand Down
4 changes: 2 additions & 2 deletions modules/browsiRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export function collectData() {
let predictorData = {
...{
sk: _moduleParams.siteKey,
pk: _moduleParams.pubKey,
sw: (win.screen && win.screen.width) || -1,
sh: (win.screen && win.screen.height) || -1,
url: `${doc.location.protocol}//${doc.location.host}${doc.location.pathname}`,
Expand Down Expand Up @@ -134,7 +135,6 @@ function getRTD(auc) {
const adSlot = getSlotByCode(uc);
const identifier = adSlot ? getMacroId(_browsiData['pmd'], adSlot) : uc;
const _pd = _bp[identifier];
rp[uc] = getKVObject(-1);
if (!_pd) {
return rp
}
Expand Down Expand Up @@ -275,7 +275,7 @@ function getPredictionsFromServer(url) {
if (req.status === 200) {
try {
const data = JSON.parse(response);
if (data && data.p && data.kn) {
if (data) {
setData({p: data.p, kn: data.kn, pmd: data.pmd, bet: data.bet});
} else {
setData({});
Expand Down
2 changes: 2 additions & 0 deletions modules/deepintentBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { generateUUID, deepSetValue, deepAccess, isArray, isInteger, logError, l
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER, VIDEO} from '../src/mediaTypes.js';
const BIDDER_CODE = 'deepintent';
const GVL_ID = 541;
const BIDDER_ENDPOINT = 'https://prebid.deepintent.com/prebid';
const USER_SYNC_URL = 'https://cdn.deepintent.com/syncpixel.html';
const DI_M_V = '1.0.0';
Expand Down Expand Up @@ -32,6 +33,7 @@ export const ORTB_VIDEO_PARAMS = {
};
export const spec = {
code: BIDDER_CODE,
gvlid: GVL_ID,
supportedMediaTypes: [BANNER, VIDEO],
aliases: [],

Expand Down
4 changes: 2 additions & 2 deletions modules/growthCodeRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ function callServer(configParams, items, expiresAt, userConsent) {
url = tryAppendQueryString(url, 'pid', configParams.pid);
url = tryAppendQueryString(url, 'u', window.location.href);
url = tryAppendQueryString(url, 'gcid', gcid);
if ((userConsent !== null) && (userConsent.gdpr !== null) && (userConsent.gdpr.consentData.getTCData.tcString)) {
url = tryAppendQueryString(url, 'tcf', userConsent.gdpr.consentData.getTCData.tcString)
if ((userConsent !== null) && (userConsent.gdpr !== null) && (userConsent.gdpr.consentString)) {
url = tryAppendQueryString(url, 'tcf', userConsent.gdpr.consentString)
}

ajax.ajaxBuilder()(url, {
Expand Down
40 changes: 37 additions & 3 deletions modules/nextMillenniumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
triggerPixel,
} from '../src/utils.js';

import {getGlobal} from '../src/prebidGlobal.js';
import CONSTANTS from '../src/constants.json';
import {BANNER, VIDEO} from '../src/mediaTypes.js';
import {config} from '../src/config.js';
Expand All @@ -22,7 +23,7 @@ import * as events from '../src/events.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {getRefererInfo} from '../src/refererDetection.js';

const NM_VERSION = '3.0.0';
const NM_VERSION = '3.1.0';
const GVLID = 1060;
const BIDDER_CODE = 'nextMillennium';
const ENDPOINT = 'https://pbs.nextmillmedia.com/openrtb2/auction';
Expand All @@ -47,6 +48,7 @@ const ALLOWED_ORTB2_PARAMETERS = [
'site.pagecat',
'site.content.cat',
'site.content.language',
'device.sua',
];

const sendingDataStatistic = initSendingDataStatistic();
Expand Down Expand Up @@ -93,6 +95,7 @@ export const spec = {

nextMillennium: {
nm_version: NM_VERSION,
pbjs_version: getGlobal()?.version || undefined,
refresh_count: window.nmmRefreshCounts[bid.adUnitCode]++,
elOffsets: getBoundingClient(bid),
scrollTop: window.pageYOffset || document.documentElement.scrollTop,
Expand All @@ -107,6 +110,7 @@ export const spec = {
postBody.imp.push(getImp(bid, id));
setConsentStrings(postBody, bidderRequest);
setOrtb2Parameters(postBody, bidderRequest?.ortb2);
setEids(postBody, bid);

const urlParameters = parseUrl(getWindowTop().location.href).search;
const isTest = urlParameters['pbs'] && urlParameters['pbs'] === 'test';
Expand Down Expand Up @@ -312,6 +316,12 @@ export function setOrtb2Parameters(postBody, ortb2 = {}) {
}
}

export function setEids(postBody, bid) {
if (!isArray(bid.userIdAsEids) || !bid.userIdAsEids.length) return;

deepSetValue(postBody, 'user.eids', bid.userIdAsEids);
}

export function replaceUsersyncMacros(url, gdprConsent = {}, uspConsent = '', gppConsent = {}, type = '') {
const { consentString = '', gdprApplies = false } = gdprConsent;
const gdpr = Number(gdprApplies);
Expand Down Expand Up @@ -391,25 +401,49 @@ function getAd(bid) {
} else if (bid.nurl) {
adUrl = bid.nurl;
};
}
};

return {ad, adUrl, vastXml, vastUrl};
}

function getSiteObj() {
const refInfo = (getRefererInfo && getRefererInfo()) || {};

let language = navigator.language;
let content;
if (language) {
// get ISO-639-1-alpha-2 (2 character language)
language = language.split('-')[0];
content = {
language,
};
};

return {
page: refInfo.page,
ref: refInfo.ref,
domain: refInfo.domain
domain: refInfo.domain,
content,
};
}

function getDeviceObj() {
return {
w: window.innerWidth || window.document.documentElement.clientWidth || window.document.body.clientWidth || 0,
h: window.innerHeight || window.document.documentElement.clientHeight || window.document.body.clientHeight || 0,
ua: window.navigator.userAgent || undefined,
sua: getSua(),
};
}

function getSua() {
let {brands, mobile, platform} = (window?.navigator?.userAgentData || {});
if (!(brands && platform)) return undefined;

return {
brands,
mobile: Number(!!mobile),
platform: (platform && {brand: platform}) || undefined,
};
}

Expand Down
30 changes: 23 additions & 7 deletions modules/pubmaticAnalyticsAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {_each, isArray, isStr, logError, logWarn, pick} from '../src/utils.js';
import {_each, isArray, isStr, logError, logWarn, pick, generateUUID} from '../src/utils.js';
import adapter from '../libraries/analyticsAdapter/AnalyticsAdapter.js';
import adapterManager from '../src/adapterManager.js';
import CONSTANTS from '../src/constants.json';
Expand Down Expand Up @@ -286,7 +286,7 @@ function gatherPartnerBidsForAdUnitForLogger(adUnit, adUnitId, highestBid) {
'ocpm': bid.bidResponse ? (bid.bidResponse.originalCpm || 0) : 0,
'ocry': bid.bidResponse ? (bid.bidResponse.originalCurrency || CURRENCY_USD) : CURRENCY_USD,
'piid': bid.bidResponse ? (bid.bidResponse.partnerImpId || EMPTY_STRING) : EMPTY_STRING,
'frv': (bid.bidResponse ? (bid.bidResponse.floorData ? bid.bidResponse.floorData.floorRuleValue : undefined) : undefined),
'frv': bid.bidResponse ? bid.bidResponse.floorData?.floorRuleValue : undefined,
'md': bid.bidResponse ? getMetadata(bid.bidResponse.meta) : undefined
});
});
Expand Down Expand Up @@ -337,11 +337,10 @@ function executeBidsLoggerCall(e, highestCpmBids) {
let auctionId = e.auctionId;
let referrer = config.getConfig('pageUrl') || cache.auctions[auctionId].referer || '';
let auctionCache = cache.auctions[auctionId];
let floorData = auctionCache.floorData;
let floorData = auctionCache?.floorData;
let floorFetchStatus = getFloorFetchStatus(auctionCache?.floorData);
let outputObj = { s: [] };
let pixelURL = END_POINT_BID_LOGGER;
// will return true if floor data is present.
let fetchStatus = getFloorFetchStatus(auctionCache.floorData);

if (!auctionCache) {
return;
Expand All @@ -364,7 +363,7 @@ function executeBidsLoggerCall(e, highestCpmBids) {
outputObj['tgid'] = getTgId();
outputObj['pbv'] = getGlobal()?.version || '-1';

if (floorData && fetchStatus) {
if (floorData && floorFetchStatus) {
outputObj['fmv'] = floorData.floorRequestData ? floorData.floorRequestData.modelVersion || undefined : undefined;
outputObj['ft'] = floorData.floorResponseData ? (floorData.floorResponseData.enforcements.enforceJS == false ? 0 : 1) : undefined;
}
Expand All @@ -379,8 +378,25 @@ function executeBidsLoggerCall(e, highestCpmBids) {
'mt': getAdUnitAdFormats(origAdUnit),
'sz': getSizesForAdUnit(adUnit, adUnitId),
'ps': gatherPartnerBidsForAdUnitForLogger(adUnit, adUnitId, highestCpmBids.filter(bid => bid.adUnitCode === adUnitId)),
'fskp': (floorData && fetchStatus) ? (floorData.floorRequestData ? (floorData.floorRequestData.skipped == false ? 0 : 1) : undefined) : undefined,
'fskp': floorData && floorFetchStatus ? (floorData.floorRequestData ? (floorData.floorRequestData.skipped == false ? 0 : 1) : undefined) : undefined,
'sid': generateUUID()
};
if (floorData?.floorRequestData) {
const { location, fetchStatus, floorProvider } = floorData?.floorRequestData;
slotObject.ffs = {
[CONSTANTS.FLOOR_VALUES.SUCCESS]: 1,
[CONSTANTS.FLOOR_VALUES.ERROR]: 2,
[CONSTANTS.FLOOR_VALUES.TIMEOUT]: 4,
undefined: 0
}[fetchStatus];
slotObject.fsrc = {
[CONSTANTS.FLOOR_VALUES.FETCH]: 2,
[CONSTANTS.FLOOR_VALUES.NO_DATA]: 2,
[CONSTANTS.FLOOR_VALUES.AD_UNIT]: 1,
[CONSTANTS.FLOOR_VALUES.SET_CONFIG]: 1
}[location];
slotObject.fp = floorProvider;
}
slotsArray.push(slotObject);
return slotsArray;
}, []);
Expand Down
47 changes: 46 additions & 1 deletion modules/userId/eids.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ userIdAsEids = [
uids: [{
id: 'the-ids-object-stringified',
atype: 1
}]
},

{
Expand Down Expand Up @@ -116,7 +117,51 @@ userIdAsEids = [
}
}]
},


{
source: 'liveintent.indexexchange.com',
uids: [{
id: 'some-random-id-value',
atype: 3,
ext: {
provider: 'liveintent.com'
}
}]
},

{
source: 'liveintent.sovrn.com'',
uids: [{
id: 'some-random-id-value',
atype: 3,
ext: {
provider: 'liveintent.com'
}
}]
},

{
source: 'openx.net'',
uids: [{
id: 'some-random-id-value',
atype: 3,
ext: {
provider: 'liveintent.com'
}
}]
},

{
source: 'pubmatic.com'',
uids: [{
id: 'some-random-id-value',
atype: 3,
ext: {
provider: 'liveintent.com'
}
}]
},

{
source: 'media.net',
uids: [{
Expand Down
Loading