Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-nsk authored May 11, 2022
2 parents 76afe9b + 14c9bc7 commit 2e6c2ac
Show file tree
Hide file tree
Showing 85 changed files with 3,848 additions and 839 deletions.
12 changes: 12 additions & 0 deletions integrationExamples/gpt/userId_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"301": true, // zeotapIdPlus
"91": true, // criteo
"737": true, // amxId
"58": true, // 33acrossId
}
}
}
Expand Down Expand Up @@ -128,6 +129,17 @@
"expires": 30
}
},
{
"name": "33acrossId",
"params": {
"pid": '0'
},
"storage": {
"type": 'html5',
"name": '33acrossId',
"expires": 90
}
},
{
"name": "intentIqId",
"params": {
Expand Down
3 changes: 3 additions & 0 deletions modules/.submodules.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"userId": [
"33acrossIdSystem",
"admixerIdSystem",
"adtelligentIdSystem",
"akamaiDAPIdSystem",
"amxIdSystem",
"britepoolIdSystem",
"connectIdSystem",
"cpexIdSystem",
"criteoIdSystem",
"dacIdSystem",
"deepintentDpesIdSystem",
Expand Down Expand Up @@ -48,6 +50,7 @@
"dfpAdServerVideo"
],
"rtdModule": [
"airgridRtdProvider",
"browsiRtdProvider",
"dgkeywordRtdProvider",
"geoedgeRtdProvider",
Expand Down
115 changes: 115 additions & 0 deletions modules/33acrossIdSystem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
/**
* This module adds 33acrossId to the User ID module
* The {@link module:modules/userId} module is required
* @module modules/33acrossIdSystem
* @requires module:modules/userId
*/

import { logMessage, logError } from '../src/utils.js';
import { ajaxBuilder } from '../src/ajax.js';
import { submodule } from '../src/hook.js';
import { uspDataHandler } from '../src/adapterManager.js';

const MODULE_NAME = '33acrossId';
const API_URL = 'https://lexicon.33across.com/v1/envelope';
const AJAX_TIMEOUT = 10000;

function getEnvelope(response) {
if (!response.succeeded) {
logError(`${MODULE_NAME}: Unsuccessful response`);

return;
}

if (!response.data.envelope) {
logMessage(`${MODULE_NAME}: No envelope was received`);

return;
}

return response.data.envelope;
}

function calculateQueryStringParams(pid, gdprConsentData) {
const uspString = uspDataHandler.getConsentData();
const gdprApplies = Boolean(gdprConsentData?.gdprApplies);
const params = {
pid,
gdpr: Number(gdprApplies),
};

if (uspString) {
params.us_privacy = uspString;
}

if (gdprApplies) {
params.gdpr_consent = gdprConsentData.consentString || '';
}

return params;
}

/** @type {Submodule} */
export const thirthyThreeAcrossIdSubmodule = {
/**
* used to link submodule with config
* @type {string}
*/
name: MODULE_NAME,

gvlid: 58,

/**
* decode the stored id value for passing to bid requests
* @function
* @param {string} id
* @returns {{'33acrossId':{ envelope: string}}}
*/
decode(id) {
return {
[MODULE_NAME]: {
envelope: id
}
};
},

/**
* performs action to obtain id and return a value in the callback's response argument
* @function
* @param {SubmoduleConfig} [config]
* @returns {IdResponse|undefined}
*/
getId({ params = { } }, gdprConsentData) {
if (typeof params.pid !== 'string') {
logError(`${MODULE_NAME}: Submodule requires a partner ID to be defined`);

return;
}

const { pid, apiUrl = API_URL } = params;

return {
callback(cb) {
ajaxBuilder(AJAX_TIMEOUT)(apiUrl, {
success(response) {
let envelope;

try {
envelope = getEnvelope(JSON.parse(response))
} catch (err) {
logError(`${MODULE_NAME}: ID reading error:`, err);
}
cb(envelope);
},
error(err) {
logError(`${MODULE_NAME}: ID error response`, err);

cb();
}
}, calculateQueryStringParams(pid, gdprConsentData), { method: 'GET', withCredentials: true });
}
};
}
};

submodule('userId', thirthyThreeAcrossIdSubmodule);
53 changes: 53 additions & 0 deletions modules/33acrossIdSystem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# 33ACROSS ID

For help adding this submodule, please contact [[email protected]]([email protected]).

### Prebid Configuration

You can configure this submodule in your `userSync.userIds[]` configuration:

```javascript
pbjs.setConfig({
userSync: {
userIds: [
{
name: "33acrossId",
storage: {
name: "33acrossId",
type: "html5",
expires: 90,
refreshInSeconds: 8*3600
},
params: {
pid: "0010b00002GYU4eBAH",
},
},
],
},
});
```

| Parameters under `userSync.userIds[]` | Scope | Type | Description | Example |
| ---| --- | --- | --- | --- |
| name | Required | String | Name for the 33Across ID submodule | `"33acrossId"` | |
| storage | Required | Object | Configures how to cache User IDs locally in the browser | See [storage settings](#storage-settings) |
| params | Required | Object | Parameters for 33Across ID submodule | See [params](#params) |

### Storage Settings

The following settings are available for the `storage` property in the `userSync.userIds[]` object:

| Param name | Scope | Type | Description | Example |
| --- | --- | --- | --- | --- |
| name | Required | String| Name of the cookie or HTML5 local storage where the user ID will be stored | `"33acrossId"` |
| type | Required | String | `"html5"` (preferred) or `"cookie"` | `"html5"` |
| expires | Strongly Recommended | Number | How long (in days) the user ID information will be stored. 33Across recommends `90`. | `90` |
| refreshInSeconds | Strongly Recommended | Number | The interval (in seconds) for refreshing the user ID. 33Across recommends no more than 8 hours between refreshes. | `8*3600` |

### Params

The following settings are available in the `params` property in `userSync.userIds[]` object:

| Param name | Scope | Type | Description | Example |
| --- | --- | --- | --- | --- |
| pid | Required | String | Partner ID provided by 33Across | `"0010b00002GYU4eBAH"` |
50 changes: 45 additions & 5 deletions modules/adagioBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {createEidsArray} from './userId/eids.js';
import {BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
import {Renderer} from '../src/Renderer.js';
import {OUTSTREAM} from '../src/video.js';
import { getGlobal } from '../src/prebidGlobal.js';

const BIDDER_CODE = 'adagio';
const LOG_PREFIX = 'Adagio:';
Expand All @@ -46,7 +47,6 @@ const MAX_SESS_DURATION = 30 * 60 * 1000;
const ADAGIO_PUBKEY = 'AL16XT44Sfp+8SHVF1UdC7hydPSMVLMhsYknKDdwqq+0ToDSJrP0+Qh0ki9JJI2uYm/6VEYo8TJED9WfMkiJ4vf02CW3RvSWwc35bif2SK1L8Nn/GfFYr/2/GG/Rm0vUsv+vBHky6nuuYls20Og0HDhMgaOlXoQ/cxMuiy5QSktp';
const ADAGIO_PUBKEY_E = 65537;
const CURRENCY = 'USD';
const DEFAULT_FLOOR = 0.1;

// This provide a whitelist and a basic validation
// of OpenRTB 2.5 options used by the Adagio SSP.
Expand Down Expand Up @@ -589,13 +589,13 @@ function _getFloors(bidRequest) {
const info = bidRequest.getFloor({
currency: CURRENCY,
mediaType,
size: []
size
});

floors.push(cleanObj({
mt: mediaType,
s: isArray(size) ? `${size[0]}x${size[1]}` : undefined,
f: (!isNaN(info.floor) && info.currency === CURRENCY) ? info.floor : DEFAULT_FLOOR
f: (!isNaN(info.floor) && info.currency === CURRENCY) ? info.floor : undefined
}));
}

Expand Down Expand Up @@ -869,7 +869,9 @@ function storeRequestInAdagioNS(bidRequest) {
}],
auctionId: bidRequest.auctionId,
pageviewId: internal.getPageviewId(),
printNumber
printNumber,
localPbjs: '$$PREBID_GLOBAL$$',
localPbjsRef: getGlobal()
});

// (legacy) Store internal adUnit information
Expand Down Expand Up @@ -937,7 +939,45 @@ export const spec = {
});

// Handle priceFloors module
bidRequest.floors = _getFloors(bidRequest);
const computedFloors = _getFloors(bidRequest);
if (isArray(computedFloors) && computedFloors.length) {
bidRequest.floors = computedFloors

if (deepAccess(bidRequest, 'mediaTypes.banner')) {
const bannerObj = bidRequest.mediaTypes.banner

const computeNewSizeArray = (sizeArr = []) => {
const size = { size: sizeArr, floor: null }
const bannerFloors = bidRequest.floors.filter(floor => floor.mt === BANNER)
const BannerSizeFloor = bannerFloors.find(floor => floor.s === sizeArr.join('x'))
size.floor = (bannerFloors) ? (BannerSizeFloor) ? BannerSizeFloor.f : bannerFloors[0].f : null
return size
}

// `bannerSizes`, internal property name
bidRequest.mediaTypes.banner.bannerSizes = (isArray(bannerObj.sizes[0]))
? bannerObj.sizes.map(sizeArr => {
return computeNewSizeArray(sizeArr)
})
: computeNewSizeArray(bannerObj.sizes)
}

if (deepAccess(bidRequest, 'mediaTypes.video')) {
const videoObj = bidRequest.mediaTypes.video
const videoFloors = bidRequest.floors.filter(floor => floor.mt === VIDEO);
const playerSize = (videoObj.playerSize && isArray(videoObj.playerSize[0])) ? videoObj.playerSize[0] : videoObj.playerSize
const videoSizeFloor = (playerSize) ? videoFloors.find(floor => floor.s === playerSize.join('x')) : undefined

bidRequest.mediaTypes.video.floor = (videoFloors) ? videoSizeFloor ? videoSizeFloor.f : videoFloors[0].f : null
}

if (deepAccess(bidRequest, 'mediaTypes.native')) {
const nativeFloors = bidRequest.floors.filter(floor => floor.mt === NATIVE);
if (nativeFloors.length) {
bidRequest.mediaTypes.native.floor = nativeFloors[0].f
}
}
}

if (deepAccess(bidRequest, 'mediaTypes.video')) {
_buildVideoBidRequest(bidRequest);
Expand Down
5 changes: 5 additions & 0 deletions modules/adfBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@ export const spec = {
request.is_debug = !!test;
request.test = 1;
}

if (config.getConfig('coppa')) {
deepSetValue(request, 'regs.coppa', 1);
}

if (deepAccess(bidderRequest, 'gdprConsent.gdprApplies') !== undefined) {
deepSetValue(request, 'user.ext.consent', bidderRequest.gdprConsent.consentString);
deepSetValue(request, 'regs.ext.gdpr', bidderRequest.gdprConsent.gdprApplies & 1);
Expand Down
1 change: 1 addition & 0 deletions modules/admanBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export const spec = {
if (bid.userId) {
getUserId(placement.eids, bid.userId.uid2 && bid.userId.uid2.id, 'uidapi.com');
getUserId(placement.eids, bid.userId.lotamePanoramaId, 'lotame.com');
getUserId(placement.eids, bid.userId.idx, 'idx.lat');
}
if (traff === VIDEO) {
placement.playerSize = bid.mediaTypes[VIDEO].playerSize;
Expand Down
10 changes: 1 addition & 9 deletions modules/adyoulikeBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,14 +350,6 @@ function getTrackers(eventsArray, jsTrackers) {
return result;
}

function getVideoAd(response) {
var adJson = {};
if (typeof response.Ad === 'string' && response.Ad.indexOf('\/\*PREBID\*\/') > 0) {
adJson = JSON.parse(response.Ad.match(/\/\*PREBID\*\/(.*)\/\*PREBID\*\//)[1]);
return deepAccess(adJson, 'Content.MainVideo.Vast');
}
}

function getNativeAssets(response, nativeConfig) {
if (typeof response.Native === 'object') {
return response.Native;
Expand Down Expand Up @@ -486,7 +478,7 @@ function createBid(response, bidRequests) {
};

// retreive video response if present
const vast64 = response.Vast || getVideoAd(response);
const vast64 = response.Vast;
if (vast64) {
bid.width = response.Width;
bid.height = response.Height;
Expand Down
Loading

0 comments on commit 2e6c2ac

Please sign in to comment.