Skip to content

Commit

Permalink
Merge branch 'prebid:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinGumGum authored Apr 9, 2024
2 parents fb0b3cc + beeb901 commit 91c6808
Show file tree
Hide file tree
Showing 14 changed files with 157 additions and 156 deletions.
113 changes: 14 additions & 99 deletions modules/adkernelBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
_each,
cleanObj,
contains,
createTrackPixelHtml,
deepAccess,
Expand All @@ -20,7 +19,6 @@ import {BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {find} from '../src/polyfill.js';
import {config} from '../src/config.js';
import {convertOrtbRequestToProprietaryNative} from '../src/native.js';
import {getAdUnitSizes} from '../libraries/sizeUtils/sizeUtils.js';

/**
Expand All @@ -39,7 +37,7 @@ const VIDEO_FPD = ['battr', 'pos'];
const NATIVE_FPD = ['battr', 'api'];
const BANNER_PARAMS = ['pos'];
const BANNER_FPD = ['btype', 'battr', 'pos', 'api'];
const VERSION = '1.6';
const VERSION = '1.7';
const SYNC_IFRAME = 1;
const SYNC_IMAGE = 2;
const SYNC_TYPES = {
Expand All @@ -48,29 +46,6 @@ const SYNC_TYPES = {
};
const GVLID = 14;

const NATIVE_MODEL = [
{name: 'title', assetType: 'title'},
{name: 'icon', assetType: 'img', type: 1},
{name: 'image', assetType: 'img', type: 3},
{name: 'body', assetType: 'data', type: 2},
{name: 'body2', assetType: 'data', type: 10},
{name: 'sponsoredBy', assetType: 'data', type: 1},
{name: 'phone', assetType: 'data', type: 8},
{name: 'address', assetType: 'data', type: 9},
{name: 'price', assetType: 'data', type: 6},
{name: 'salePrice', assetType: 'data', type: 7},
{name: 'cta', assetType: 'data', type: 12},
{name: 'rating', assetType: 'data', type: 3},
{name: 'downloads', assetType: 'data', type: 5},
{name: 'likes', assetType: 'data', type: 4},
{name: 'displayUrl', assetType: 'data', type: 11}
];

const NATIVE_INDEX = NATIVE_MODEL.reduce((acc, val, idx) => {
acc[val.name] = {id: idx, ...val};
return acc;
}, {});

const MULTI_FORMAT_SUFFIX = '__mf';
const MULTI_FORMAT_SUFFIX_BANNER = 'b' + MULTI_FORMAT_SUFFIX;
const MULTI_FORMAT_SUFFIX_VIDEO = 'v' + MULTI_FORMAT_SUFFIX;
Expand Down Expand Up @@ -139,9 +114,6 @@ export const spec = {
* @returns {ServerRequest[]}
*/
buildRequests: function (bidRequests, bidderRequest) {
// convert Native ORTB definition to old-style prebid native definition
bidRequests = convertOrtbRequestToProprietaryNative(bidRequests);

let impGroups = groupImpressionsByHostZone(bidRequests, bidderRequest.refererInfo);
let requests = [];
let schain = bidRequests[0].schain;
Expand Down Expand Up @@ -199,7 +171,9 @@ export const spec = {
prBid.height = imp.video.h;
} else if ('native' in imp) {
prBid.mediaType = NATIVE;
prBid.native = buildNativeAd(JSON.parse(rtbBid.adm));
prBid.native = {
ortb: buildNativeAd(rtbBid.adm)
};
}
if (isStr(rtbBid.dealid)) {
prBid.dealId = rtbBid.dealid;
Expand Down Expand Up @@ -345,11 +319,9 @@ function buildImps(bidRequest, secure) {
} else {
typedImp = imp;
}
let nativeRequest = buildNativeRequest(mediaTypes.native);
typedImp.native = {
...getDefinedParamsOrEmpty(bidRequest.ortb2Imp, NATIVE_FPD),
ver: '1.1',
request: JSON.stringify(nativeRequest)
request: JSON.stringify(bidRequest.nativeOrtbRequest)
};
initImpBidfloor(typedImp, bidRequest, sizes, isMultiformat ? '*' : NATIVE);
result.push(typedImp);
Expand All @@ -371,51 +343,6 @@ function getDefinedParamsOrEmpty(object, params) {
return getDefinedParams(object, params);
}

/**
* Builds native request from native adunit
*/
function buildNativeRequest(nativeReq) {
let request = {ver: '1.1', assets: []};
for (let k of Object.keys(nativeReq)) {
let v = nativeReq[k];
let desc = NATIVE_INDEX[k];
if (desc === undefined) {
continue;
}
let assetRoot = {
id: desc.id,
required: ~~v.required,
};
if (desc.assetType === 'img') {
assetRoot[desc.assetType] = buildImageAsset(desc, v);
} else if (desc.assetType === 'data') {
assetRoot.data = cleanObj({type: desc.type, len: v.len});
} else if (desc.assetType === 'title') {
assetRoot.title = {len: v.len || 90};
} else {
return;
}
request.assets.push(assetRoot);
}
return request;
}

/**
* Builds image asset request
*/
function buildImageAsset(desc, val) {
let img = {
type: desc.type
};
if (val.sizes) {
[img.w, img.h] = val.sizes;
} else if (val.aspect_ratios) {
img.wmin = val.aspect_ratios[0].min_width;
img.hmin = val.aspect_ratios[0].min_height;
}
return cleanObj(img);
}

/**
* Checks if configuration allows specified sync method
* @param syncRule {Object}
Expand Down Expand Up @@ -540,12 +467,11 @@ function makeRegulations(bidderRequest) {
* @returns
*/
function makeBaseRequest(bidderRequest, imps, fpd) {
let {timeout} = bidderRequest;
let request = {
'id': bidderRequest.bidderRequestId,
'imp': imps,
'at': 1,
'tmax': parseInt(timeout)
'tmax': parseInt(bidderRequest.timeout)
};
if (!isEmpty(fpd.bcat)) {
request.bcat = fpd.bcat;
Expand Down Expand Up @@ -665,26 +591,15 @@ function validateNativeImageSize(img) {
}

/**
* Creates native ad for native 1.1 response
* Creates native ad for native 1.2 response
*/
function buildNativeAd(nativeResp) {
const {assets, link, imptrackers, jstracker, privacy} = nativeResp.native;
let nativeAd = {
clickUrl: link.url,
impressionTrackers: imptrackers,
javascriptTrackers: jstracker ? [jstracker] : undefined,
privacyLink: privacy,
};
_each(assets, asset => {
let assetName = NATIVE_MODEL[asset.id].name;
let assetType = NATIVE_MODEL[asset.id].assetType;
nativeAd[assetName] = asset[assetType].text || asset[assetType].value || cleanObj({
url: asset[assetType].url,
width: asset[assetType].w,
height: asset[assetType].h
});
});
return cleanObj(nativeAd);
function buildNativeAd(adm) {
let resp = JSON.parse(adm);
// temporary workaround for top-level native object wrapper
if ('native' in resp) {
resp = resp.native;
}
return resp;
}

function stripMultiformatSuffix(impid) {
Expand Down
5 changes: 4 additions & 1 deletion modules/agmaAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { config } from '../src/config.js';
const GVLID = 1122;
const ModuleCode = 'agma';
const analyticsType = 'endpoint';
const scriptVersion = '1.7.1';
const scriptVersion = '1.8.0';
const batchDelayInMs = 1000;
const agmaURL = 'https://pbc.agma-analytics.de/v1';
const pageViewId = generateUUID();
Expand Down Expand Up @@ -127,6 +127,7 @@ export const getPayload = (auctionIds, options) => {
};

if (useExtendedPayload) {
const device = config.getConfig('device') || {};
const { x, y } = getScreen();
const userIdsAsEids = getUserIDs();
payload = {
Expand All @@ -141,6 +142,8 @@ export const getPayload = (auctionIds, options) => {
pageUrl: ri.page,
screenWidth: x,
screenHeight: y,
deviceWidth: device.w || screen.width,
deviceHeight: device.h || screen.height,
userIdsAsEids,
};
}
Expand Down
1 change: 1 addition & 0 deletions modules/appnexusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export const spec = {
aliases: [
{ code: 'appnexusAst', gvlid: 32 },
{ code: 'emxdigital', gvlid: 183 },
{ code: 'emetriq', gvlid: 213 },
{ code: 'pagescience', gvlid: 32 },
{ code: 'gourmetads', gvlid: 32 },
{ code: 'matomy', gvlid: 32 },
Expand Down
4 changes: 2 additions & 2 deletions modules/criteoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ export const spec = {
if (slot.ext?.meta?.networkName) {
bid.meta = Object.assign({}, bid.meta, { networkName: slot.ext.meta.networkName })
}
if (slot.ext?.dsa?.adrender) {
bid.meta = Object.assign({}, bid.meta, { adrender: slot.ext.dsa.adrender })
if (slot.ext?.dsa) {
bid.meta = Object.assign({}, bid.meta, { dsa: slot.ext.dsa })
}
if (slot.native) {
if (bidRequest.params.nativeCallback) {
Expand Down
41 changes: 21 additions & 20 deletions modules/kargoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,56 +359,57 @@ function getUserIds(tdidAdapter, usp, gdpr, eids, gpp) {
crbIDs: crb.syncIds || {}
};

// Pull Trade Desk ID from adapter
if (tdidAdapter) {
userIds.tdID = tdidAdapter;
}

// Pull Trade Desk ID from our storage
// Pull Trade Desk ID
if (!tdidAdapter && crb.tdID) {
userIds.tdID = crb.tdID;
} else if (tdidAdapter) {
userIds.tdID = tdidAdapter;
}

// USP
if (usp) {
userIds.usp = usp;
}

try {
if (gdpr) {
userIds['gdpr'] = {
consent: gdpr.consentString || '',
applies: !!gdpr.gdprApplies,
}
}
} catch (e) {
// GDPR
if (gdpr) {
userIds.gdpr = {
consent: gdpr.consentString || '',
applies: !!gdpr.gdprApplies,
};
}

// Kargo ID
if (crb.lexId != null) {
userIds.kargoID = crb.lexId;
}

// Client ID
if (crb.clientId != null) {
userIds.clientID = crb.clientId;
}

// Opt Out
if (crb.optOut != null) {
userIds.optOut = crb.optOut;
}

// User ID Sub-Modules (userIdAsEids)
if (eids != null) {
userIds.sharedIDEids = eids;
}

// GPP
if (gpp) {
const parsedGPP = {}
if (gpp && gpp.consentString) {
parsedGPP.gppString = gpp.consentString
const parsedGPP = {};
if (gpp.consentString) {
parsedGPP.gppString = gpp.consentString;
}
if (gpp && gpp.applicableSections) {
parsedGPP.applicableSections = gpp.applicableSections
if (gpp.applicableSections) {
parsedGPP.applicableSections = gpp.applicableSections;
}
if (!isEmpty(parsedGPP)) {
userIds.gpp = parsedGPP
userIds.gpp = parsedGPP;
}
}

Expand Down
13 changes: 11 additions & 2 deletions modules/lassoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export const spec = {
url: encodeURIComponent(window.location.href),
bidderRequestId: bidRequest.bidderRequestId,
adUnitCode: bidRequest.adUnitCode,
// TODO: fix auctionId leak: https://github.com/prebid/Prebid.js/issues/9781
auctionId: bidRequest.auctionId,
bidId: bidRequest.bidId,
transactionId: bidRequest.ortb2Imp?.ext?.tid,
Expand All @@ -48,11 +47,20 @@ export const spec = {
params: JSON.stringify(bidRequest.params),
crumbs: JSON.stringify(bidRequest.crumbs),
prebidVersion: '$prebid.version$',
version: 3,
version: 4,
coppa: config.getConfig('coppa') == true ? 1 : 0,
ccpa: bidderRequest.uspConsent || undefined
}

if (
bidderRequest &&
bidderRequest.gppConsent &&
bidderRequest.gppConsent.gppString
) {
payload.gpp = bidderRequest.gppConsent.gppString;
payload.gppSid = bidderRequest.gppConsent.applicableSections;
}

return {
method: 'GET',
url: getBidRequestUrl(aimXR, bidRequest.params),
Expand All @@ -74,6 +82,7 @@ export const spec = {

const bidResponse = {
requestId: response.bidid,
bidId: response.bidid,
cpm: response.bid.price,
currency: response.cur,
width: response.bid.w,
Expand Down
2 changes: 2 additions & 0 deletions modules/sirdataRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const partnerIds = {
'appnexus': 27446,
'appnexusAst': 27446,
'brealtime': 27446,
'emetriq': 27446,
'emxdigital': 27446,
'pagescience': 27446,
'gourmetads': 33394,
Expand Down Expand Up @@ -353,6 +354,7 @@ export function addSegmentData(reqBids, data, moduleConfig, onDone) {
case 'appnexus':
case 'appnexusAst':
case 'brealtime':
case 'emetriq':
case 'emxdigital':
case 'pagescience':
case 'gourmetads':
Expand Down
7 changes: 2 additions & 5 deletions modules/sonobiBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ export const spec = {
const fpd = bidderRequest.ortb2;

if (fpd) {
delete fpd.experianRtidData; // Omit the experian data since we already pass this through a dedicated query param
delete fpd.experianRtidKey
payload.fpd = JSON.stringify(fpd);
}

Expand Down Expand Up @@ -156,11 +158,6 @@ export const spec = {
payload.coppa = 0;
}

if (deepAccess(bidderRequest, 'ortb2.experianRtidData') && deepAccess(bidderRequest, 'ortb2.experianRtidKey')) {
payload.expData = deepAccess(bidderRequest, 'ortb2.experianRtidData');
payload.expKey = deepAccess(bidderRequest, 'ortb2.experianRtidKey');
}

// If there is no key_maker data, then don't make the request.
if (isEmpty(data)) {
return null;
Expand Down
Loading

0 comments on commit 91c6808

Please sign in to comment.