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
BrettBlox authored May 28, 2024
2 parents e197133 + 78f93cd commit b00cae9
Show file tree
Hide file tree
Showing 62 changed files with 1,808 additions and 478 deletions.
2 changes: 1 addition & 1 deletion modules/51DegreesRtdProvider.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ In order to use the module please first obtain a Resource Key using the [Configu
* ScreenInchesWidth
* PixelRatio (optional)

PixelRatio is desirable, but it's a paid property requiring a paid license. Also free API service is limited to 500,000 requests per month - consider picking a [51Degrees pricing plan](https://51degrees.com/pricing) that fits your needs.
PixelRatio is desirable, but it's a paid property requiring a paid license. Free API service is limited. Please check [51Degrees pricing](https://51degrees.com/pricing) to choose a plan that suits your needs.

#### User Agent Client Hint (UA-CH) Permissions

Expand Down
3 changes: 2 additions & 1 deletion modules/adkernelBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ export const spec = {
{code: 'adpluto'},
{code: 'headbidder'},
{code: 'digiad'},
{code: 'monetix'}
{code: 'monetix'},
{code: 'hyperbrainz'}
],
supportedMediaTypes: [BANNER, VIDEO, NATIVE],

Expand Down
86 changes: 53 additions & 33 deletions modules/adnuntiusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,31 +130,6 @@ const storageTool = (function () {
return (meta && meta.usi) ? meta.usi : false
}

const getSegmentsFromOrtb = function (ortb2) {
const userData = deepAccess(ortb2, 'user.data');
let segments = [];
if (userData) {
userData.forEach(userdat => {
if (userdat.segment) {
segments.push(...userdat.segment.map((segment) => {
if (isStr(segment)) return segment;
if (isStr(segment.id)) return segment.id;
}).filter((seg) => !!seg));
}
});
}
return segments
}

const getKvsFromOrtb = function (ortb2) {
const siteData = deepAccess(ortb2, 'site.ext.data');
if (siteData) {
return siteData
} else {
return null
}
}

return {
refreshStorage: function (bidderRequest) {
const ortb2 = bidderRequest.ortb2 || {};
Expand All @@ -171,25 +146,69 @@ const storageTool = (function () {
return voidAuId.auId;
});
}
metaInternal.segments = getSegmentsFromOrtb(ortb2);
metaInternal.kv = getKvsFromOrtb(ortb2);
},
saveToStorage: function (serverData, network) {
setMetaInternal(serverData, network);
},
getUrlRelatedData: function () {
// getting the URL information is theoretically not network-specific
const { segments, kv, usi, voidAuIdsArray } = metaInternal;
return { segments, kv, usi, voidAuIdsArray };
const { usi, voidAuIdsArray } = metaInternal;
return { usi, voidAuIdsArray };
},
getPayloadRelatedData: function (network) {
// getting the payload data should be network-specific
const { segments, kv, usi, userId, voidAuIdsArray, voidAuIds, ...payloadRelatedData } = getMetaDataFromLocalStorage(network).reduce((a, entry) => ({ ...a, [entry.key]: entry.value }), {});
const { segments, usi, userId, voidAuIdsArray, voidAuIds, ...payloadRelatedData } = getMetaDataFromLocalStorage(network).reduce((a, entry) => ({ ...a, [entry.key]: entry.value }), {});
return payloadRelatedData;
}
};
})();

const targetingTool = (function() {
const getSegmentsFromOrtb = function(bidderRequest) {
const userData = deepAccess(bidderRequest.ortb2 || {}, 'user.data');
let segments = [];
if (userData) {
userData.forEach(userdat => {
if (userdat.segment) {
segments.push(...userdat.segment.map((segment) => {
if (isStr(segment)) return segment;
if (isStr(segment.id)) return segment.id;
}).filter((seg) => !!seg));
}
});
}
return segments
};

const getKvsFromOrtb = function(bidderRequest) {
return deepAccess(bidderRequest.ortb2 || {}, 'site.ext.data');
};

return {
addSegmentsToUrlData: function (validBids, bidderRequest, existingUrlRelatedData) {
let segments = getSegmentsFromOrtb(bidderRequest || {});

for (let i = 0; i < validBids.length; i++) {
const bid = validBids[i];
const targeting = bid.params.targeting || {};
if (Array.isArray(targeting.segments)) {
segments = segments.concat(targeting.segments);
delete bid.params.targeting.segments;
}
}

existingUrlRelatedData.segments = segments;
},
mergeKvsFromOrtb: function(bidTargeting, bidderRequest) {
const kv = getKvsFromOrtb(bidderRequest || {});
if (!kv) {
return;
}
bidTargeting.kv = {...kv, ...bidTargeting.kv};
}
}
})();

const validateBidType = function (bidTypeOption) {
return VALID_BID_TYPES.indexOf(bidTypeOption || '') > -1 ? bidTypeOption : 'bid';
}
Expand Down Expand Up @@ -227,6 +246,7 @@ export const spec = {
storageTool.refreshStorage(bidderRequest);

const urlRelatedMetaData = storageTool.getUrlRelatedData();
targetingTool.addSegmentsToUrlData(validBidRequests, bidderRequest, urlRelatedMetaData);
if (urlRelatedMetaData.segments.length > 0) queryParamsAndValues.push('segments=' + urlRelatedMetaData.segments.join(','));
if (urlRelatedMetaData.usi) queryParamsAndValues.push('userId=' + urlRelatedMetaData.usi);

Expand Down Expand Up @@ -261,9 +281,9 @@ export const spec = {
networks[network].metaData = payloadRelatedData;
}

const targeting = bid.params.targeting || {};
if (urlRelatedMetaData.kv) targeting.kv = urlRelatedMetaData.kv;
const adUnit = { ...targeting, auId: bid.params.auId, targetId: bid.params.targetId || bid.bidId };
const bidTargeting = {...bid.params.targeting || {}};
targetingTool.mergeKvsFromOrtb(bidTargeting, bidderRequest);
const adUnit = { ...bidTargeting, auId: bid.params.auId, targetId: bid.params.targetId || bid.bidId };
const maxDeals = Math.max(0, Math.min(bid.params.maxDeals || 0, MAXIMUM_DEALS_LIMIT));
if (maxDeals > 0) {
adUnit.maxDeals = maxDeals;
Expand Down
18 changes: 9 additions & 9 deletions modules/aidemBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const converter = ortbConverter({
const request = buildRequest(imps, bidderRequest, context);
deepSetValue(request, 'at', 1);
setPrebidRequestEnvironment(request);
deepSetValue(request, 'regs', getRegs());
deepSetValue(request, 'regs', getRegs(bidderRequest));
deepSetValue(request, 'site.publisher.id', bidderRequest.bids[0].params.publisherId);
deepSetValue(request, 'site.id', bidderRequest.bids[0].params.siteId);
return request;
Expand Down Expand Up @@ -106,22 +106,22 @@ function recur(obj) {
return result;
}

function getRegs() {
function getRegs(bidderRequest) {
let regs = {};
const consentManagement = config.getConfig('consentManagement');
const euConsentManagement = bidderRequest.gdprConsent;
const usConsentManagement = bidderRequest.uspConsent;
const coppa = config.getConfig('coppa');
if (consentManagement && !!(consentManagement.gdpr)) {
deepSetValue(regs, 'gdpr_applies', !!consentManagement.gdpr);
if (euConsentManagement && euConsentManagement.consentString) {
deepSetValue(regs, 'gdpr_applies', !!euConsentManagement.consentString);
} else {
deepSetValue(regs, 'gdpr_applies', false);
}
if (consentManagement && deepAccess(consentManagement, 'usp.cmpApi') === 'static') {
deepSetValue(regs, 'usp_applies', !!deepAccess(consentManagement, 'usp'));
deepSetValue(regs, 'us_privacy', deepAccess(consentManagement, 'usp.consentData.getUSPData.uspString'));
if (usConsentManagement) {
deepSetValue(regs, 'usp_applies', true);
deepSetValue(regs, 'us_privacy', bidderRequest.uspConsent);
} else {
deepSetValue(regs, 'usp_applies', false);
}

if (isBoolean(coppa)) {
deepSetValue(regs, 'coppa_applies', !!coppa);
} else {
Expand Down
4 changes: 2 additions & 2 deletions modules/beachfrontBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {Renderer} from '../src/Renderer.js';
import {BANNER, VIDEO} from '../src/mediaTypes.js';
import {find, includes} from '../src/polyfill.js';

const ADAPTER_VERSION = '1.20';
const ADAPTER_VERSION = '1.21';
const ADAPTER_NAME = 'BFIO_PREBID';
const OUTSTREAM = 'outstream';
const CURRENCY = 'USD';
Expand All @@ -26,7 +26,7 @@ export const OUTSTREAM_SRC = 'https://player-cdn.beachfrontmedia.com/playerapi/l
export const SYNC_IFRAME_ENDPOINT = 'https://sync.bfmio.com/sync_iframe';
export const SYNC_IMAGE_ENDPOINT = 'https://sync.bfmio.com/syncb';

export const VIDEO_TARGETING = ['mimes', 'playbackmethod', 'maxduration', 'placement', 'skip', 'skipmin', 'skipafter'];
export const VIDEO_TARGETING = ['mimes', 'playbackmethod', 'maxduration', 'placement', 'plcmt', 'skip', 'skipmin', 'skipafter'];
export const DEFAULT_MIMES = ['video/mp4', 'application/javascript'];

export const SUPPORTED_USER_IDS = [
Expand Down
13 changes: 13 additions & 0 deletions modules/browsiRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* @property {string} pubKey
* @property {string} url
* @property {?string} keyName
* @property {?string} splitKey
*/

import {deepClone, deepSetValue, isFn, isGptPubadsDefined, isNumber, logError, logInfo, generateUUID} from '../src/utils.js';
Expand All @@ -33,6 +34,7 @@ import {MODULE_TYPE_RTD} from '../src/activities/modules.js';
const MODULE_NAME = 'browsi';

const storage = getStorageManager({moduleType: MODULE_TYPE_RTD, moduleName: MODULE_NAME});
const RANDOM = Math.floor(Math.random() * 10) + 1;

/** @type {ModuleParams} */
let _moduleParams = {};
Expand All @@ -58,12 +60,22 @@ export function addBrowsiTag(data) {
script.setAttribute('id', 'browsi-tag');
script.setAttribute('src', data.u);
script.prebidData = deepClone(typeof data === 'string' ? Object(data) : data)
script.brwRandom = RANDOM;
if (_moduleParams.keyName) {
script.prebidData.kn = _moduleParams.keyName;
}
return script;
}

export function setKeyValue(key) {
if (!key || typeof key !== 'string') return false;
window.googletag = window.googletag || {cmd: []};
window.googletag.cmd = window.googletag.cmd || [];
window.googletag.cmd.push(() => {
window.googletag.pubads().setTargeting(key, RANDOM.toString());
});
}

export function sendPageviewEvent(eventType) {
if (eventType === 'PAGEVIEW') {
window.addEventListener('browsi_pageview', () => {
Expand Down Expand Up @@ -380,6 +392,7 @@ function init(moduleConfig) {
_moduleParams = moduleConfig.params;
if (_moduleParams && _moduleParams.siteKey && _moduleParams.pubKey && _moduleParams.url) {
collectData();
setKeyValue(_moduleParams.splitKey);
} else {
logError('missing params for Browsi provider');
}
Expand Down
11 changes: 6 additions & 5 deletions modules/cadentApertureMXBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,13 @@ export const spec = {
};

// adding gpid support
let gpid = deepAccess(bid, 'ortb2Imp.ext.data.adserver.adslot');
if (!gpid) {
gpid = deepAccess(bid, 'ortb2Imp.ext.data.pbadslot');
}
let gpid =
deepAccess(bid, 'ortb2Imp.ext.gpid') ||
deepAccess(bid, 'ortb2Imp.ext.data.adserver.adslot') ||
deepAccess(bid, 'ortb2Imp.ext.data.pbadslot');

if (gpid) {
data.ext = {gpid: gpid.toString()};
data.ext = { gpid: gpid.toString() };
}
let typeSpecifics = isVideo ? { video: cadentAdapter.buildVideo(bid) } : { banner: cadentAdapter.buildBanner(bid) };
let bidfloorObj = bidfloor > 0 ? { bidfloor, bidfloorcur: DEFAULT_CUR } : {};
Expand Down
62 changes: 62 additions & 0 deletions modules/ceeIdSystem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* This module adds ceeId to the User ID module
* The {@link module:modules/userId} module is required
* @module modules/ceeId
* @requires module:modules/userId
*/

import { MODULE_TYPE_UID } from '../src/activities/modules.js';
import { getStorageManager } from '../src/storageManager.js';
import { submodule } from '../src/hook.js';
import {domainOverrideToRootDomain} from '../libraries/domainOverrideToRootDomain/index.js';

/**
* @typedef {import('../modules/userId/index.js').Submodule} Submodule
* @typedef {import('../modules/userId/index.js').IdResponse} IdResponse
*/

const MODULE_NAME = 'ceeId';
const ID_TOKEN = 'WPxid';
export const storage = getStorageManager({ moduleName: MODULE_NAME, moduleType: MODULE_TYPE_UID });

/**
* Reads the ID token from local storage or cookies.
* @returns {string|undefined} The ID token, or undefined if not found.
*/
export const readId = () => storage.getDataFromLocalStorage(ID_TOKEN) || storage.getCookie(ID_TOKEN);

/** @type {Submodule} */
export const ceeIdSubmodule = {
name: MODULE_NAME,
gvlid: 676,

/**
* decode the stored id value for passing to bid requests
* @function decode
* @param {string} value
* @returns {(Object|undefined)}
*/
decode(value) {
return typeof value === 'string' ? { 'ceeId': value } : undefined;
},

/**
* performs action to obtain id and return a value
* @function
* @returns {(IdResponse|undefined)}
*/
getId() {
const ceeIdToken = readId();

return ceeIdToken ? { id: ceeIdToken } : undefined;
},
domainOverride: domainOverrideToRootDomain(storage, MODULE_NAME),
eids: {
'ceeId': {
source: 'ceeid.eu',
atype: 1
},
},
};

submodule('userId', ceeIdSubmodule);
27 changes: 27 additions & 0 deletions modules/ceeIdSystem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Overview

Module Name: ceeIdSystem
Module Type: UserID Module
Maintainer: [email protected]

# Description

User identification system for WPM

### Prebid Params example

```
pbjs.setConfig({
userSync: {
userIds: [{
name: 'ceeId',
storage: {
type: 'cookie',
name: 'ceeIdToken',
expires: 7,
refreshInSeconds: 360
}
}]
}
});
```
Loading

0 comments on commit b00cae9

Please sign in to comment.