Skip to content

Commit

Permalink
Merge pull request #117 from guardian/permutive-rtb
Browse files Browse the repository at this point in the history
Add Permutive module & bump version to 4.38
  • Loading branch information
mxdvl authored May 19, 2021
2 parents 6e9ccf8 + a6d34e7 commit a209e29
Show file tree
Hide file tree
Showing 60 changed files with 1,266 additions and 196 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12.16.1
14.17.0
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ To run the unit tests:
gulp test
```

To run the unit tests for a perticular file (example for pubmaticBidAdapter_spec.js):
To run the unit tests for a particular file (example for pubmaticBidAdapter_spec.js):
```bash
gulp test --file "test/spec/modules/pubmaticBidAdapter_spec.js"
```
Expand Down
38 changes: 20 additions & 18 deletions build/dist/prebid.js

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions gulpHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,17 @@ module.exports = {
message: 'failed reading: ' + moduleFile
});
}

// we need to forcefully include the parentModule if the subModule is present
Object.keys(submodules).forEach(parentModule => {
if (
!modules.includes(parentModule) &&
modules.some(module => submodules[parentModule].includes(module))
) {
modules.unshift(parentModule);
}
});

return modules;
},
/* gu-mod-end */
Expand Down
8 changes: 8 additions & 0 deletions integrationExamples/gpt/userId_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,14 @@
{
"name": "uid2"
}
,{
name: "flocId",
params: {
// Default sharedid.org token : "A3dHTSoNUMjjERBLlrvJSelNnwWUCwVQhZ5tNQ+sll7y+LkPPVZXtB77u2y7CweRIxiYaGwGXNlW1/dFp8VMEgIAAAB+eyJvcmlnaW4iOiJodHRwczovL3NoYXJlZGlkLm9yZzo0NDMiLCJmZWF0dXJlIjoiSW50ZXJlc3RDb2hvcnRBUEkiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9"
// To get new token, register https://developer.chrome.com/origintrials/#/trials/active for Federated Learning of Cohorts
token: "A3dHTSoNUMjjERBLlrvJSelNnwWUCwVQhZ5tNQ+sll7y+LkPPVZXtB77u2y7CweRIxiYaGwGXNlW1/dFp8VMEgIAAAB+eyJvcmlnaW4iOiJodHRwczovL3NoYXJlZGlkLm9yZzo0NDMiLCJmZWF0dXJlIjoiSW50ZXJlc3RDb2hvcnRBUEkiLCJleHBpcnkiOjE2MjYyMjA3OTksImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9"
}
}
],
"syncDelay": 5000,
"auctionDelay": 1000
Expand Down
15 changes: 8 additions & 7 deletions modules.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
[
"adyoulikeBidAdapter",
"appnexusBidAdapter",
"consentManagement",
"consentManagementUsp",
"pubCommonId",
"guAnalyticsAdapter",
"adyoulikeBidAdapter",
"appnexusBidAdapter",
"improvedigitalBidAdapter",
"ixBidAdapter",
"prebidServerBidAdapter",
"sonobiBidAdapter",
"trustxBidAdapter",
"openxBidAdapter",
"ozoneBidAdapter",
"permutiveRtdProvider",
"prebidServerBidAdapter",
"pubCommonId",
"pubmaticBidAdapter",
"tripleliftBidAdapter"
"sonobiBidAdapter",
"tripleliftBidAdapter",
"trustxBidAdapter"
]
7 changes: 5 additions & 2 deletions modules/.submodules.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,21 @@
"tapadIdSystem",
"novatiqIdSystem",
"uid2IdSystem",
"admixerIdSystem"
"admixerIdSystem",
"dmdIdSystem",
"flocIdSystem"
],
"adpod": [
"freeWheelAdserverVideo",
"dfpAdServerVideo"
],
"rtdModule": [
"browsiRtdProvider",
"geoedgeRtdProvider",
"haloRtdProvider",
"jwplayerRtdProvider",
"permutiveRtdProvider",
"reconciliationRtdProvider",
"geoedgeRtdProvider",
"sirdataRtdProvider"
]
}
21 changes: 20 additions & 1 deletion modules/adkernelAdnBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ function buildImp(bidRequest) {
id: bidRequest.bidId,
tagid: bidRequest.adUnitCode
};
let mediaType;
let bannerReq = utils.deepAccess(bidRequest, `mediaTypes.banner`);
let videoReq = utils.deepAccess(bidRequest, `mediaTypes.video`);
if (bannerReq) {
let sizes = canonicalizeSizesArray(bannerReq.sizes);
imp.banner = {
format: utils.parseSizesInput(sizes)
}
};
mediaType = BANNER;
} else if (videoReq) {
let size = canonicalizeSizesArray(videoReq.playerSize)[0];
imp.video = {
Expand All @@ -34,6 +36,11 @@ function buildImp(bidRequest) {
protocols: videoReq.protocols || DEFAULT_PROTOCOLS,
api: videoReq.api || DEFAULT_APIS
};
mediaType = VIDEO;
}
let bidFloor = getBidFloor(bidRequest, mediaType, '*');
if (bidFloor) {
imp.bidfloor = bidFloor;
}
return imp;
}
Expand Down Expand Up @@ -113,6 +120,18 @@ function buildBid(tag) {
return bid;
}

function getBidFloor(bid, mediaType, sizes) {
var floor;
var size = sizes.length === 1 ? sizes[0] : '*';
if (typeof bid.getFloor === 'function') {
const floorInfo = bid.getFloor({currency: 'USD', mediaType, size});
if (typeof floorInfo === 'object' && floorInfo.currency === 'USD' && !isNaN(parseFloat(floorInfo.floor))) {
floor = parseFloat(floorInfo.floor);
}
}
return floor;
}

export const spec = {
code: 'adkernelAdn',
gvlid: GVLID,
Expand Down
39 changes: 33 additions & 6 deletions modules/adkernelBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {config} from '../src/config.js';
const VIDEO_TARGETING = Object.freeze(['mimes', 'minduration', 'maxduration', 'protocols',
'startdelay', 'linearity', 'boxingallowed', 'playbackmethod', 'delivery',
'pos', 'api', 'ext']);
const VERSION = '1.5';
const VERSION = '1.6';
const SYNC_IFRAME = 1;
const SYNC_IMAGE = 2;
const SYNC_TYPES = Object.freeze({
Expand Down Expand Up @@ -197,6 +197,18 @@ function dispatchImps(bidRequests, refererInfo) {
}, {});
}

function getBidFloor(bid, mediaType, sizes) {
var floor;
var size = sizes.length === 1 ? sizes[0] : '*';
if (typeof bid.getFloor === 'function') {
const floorInfo = bid.getFloor({currency: 'USD', mediaType, size});
if (typeof floorInfo === 'object' && floorInfo.currency === 'USD' && !isNaN(parseFloat(floorInfo.floor))) {
floor = parseFloat(floorInfo.floor);
}
}
return floor;
}

/**
* Builds rtb imp object for single adunit
* @param bidRequest {BidRequest}
Expand All @@ -207,27 +219,42 @@ function buildImp(bidRequest, secure) {
'id': bidRequest.bidId,
'tagid': bidRequest.adUnitCode
};
var mediaType;
var sizes = [];

if (utils.deepAccess(bidRequest, `mediaTypes.banner`)) {
let sizes = utils.getAdUnitSizes(bidRequest);
if (utils.deepAccess(bidRequest, 'mediaTypes.banner')) {
sizes = utils.getAdUnitSizes(bidRequest);
imp.banner = {
format: sizes.map(wh => utils.parseGPTSingleSizeArrayToRtbSize(wh)),
topframe: 0
};
mediaType = BANNER;
} else if (utils.deepAccess(bidRequest, 'mediaTypes.video')) {
let sizes = bidRequest.mediaTypes.video.playerSize || [];
imp.video = utils.parseGPTSingleSizeArrayToRtbSize(sizes[0]) || {};
let video = utils.deepAccess(bidRequest, 'mediaTypes.video');
imp.video = {};
if (video.playerSize) {
sizes = video.playerSize[0];
imp.video = Object.assign(imp.video, utils.parseGPTSingleSizeArrayToRtbSize(sizes) || {});
}
if (bidRequest.params.video) {
Object.keys(bidRequest.params.video)
.filter(key => includes(VIDEO_TARGETING, key))
.forEach(key => imp.video[key] = bidRequest.params.video[key]);
}
mediaType = VIDEO;
} else if (utils.deepAccess(bidRequest, 'mediaTypes.native')) {
let nativeRequest = buildNativeRequest(bidRequest.mediaTypes.native);
imp.native = {
ver: '1.1',
request: JSON.stringify(nativeRequest)
}
};
mediaType = NATIVE;
} else {
throw new Error('Unsupported bid received');
}
let floor = getBidFloor(bidRequest, mediaType, sizes);
if (floor) {
imp.bidfloor = floor;
}
if (secure) {
imp.secure = 1;
Expand Down
31 changes: 28 additions & 3 deletions modules/appnexusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,10 @@ function hasPurpose1Consent(bidderRequest) {

function formatRequest(payload, bidderRequest) {
let request = [];
let options = {};
let options = {
withCredentials: true
};

let endpointUrl = URL;

if (!hasPurpose1Consent(bidderRequest)) {
Expand Down Expand Up @@ -709,8 +712,9 @@ function bidToTag(bid) {
tag.use_pmt_rule = bid.params.usePaymentRule || false
tag.prebid = true;
tag.disable_psa = true;
if (bid.params.reserve) {
tag.reserve = bid.params.reserve;
let bidFloor = getBidFloor(bid);
if (bidFloor) {
tag.reserve = bidFloor;
}
if (bid.params.position) {
tag.position = { 'above': 1, 'below': 2 }[bid.params.position] || 0;
Expand Down Expand Up @@ -745,6 +749,11 @@ function bidToTag(bid) {
tag.keywords = keywords;
}

let gpid = utils.deepAccess(bid, 'ortb2Imp.ext.data.pbadslot');
if (gpid) {
tag.gpid = gpid;
}

if (bid.mediaType === NATIVE || utils.deepAccess(bid, `mediaTypes.${NATIVE}`)) {
tag.ad_types.push(NATIVE);
if (tag.sizes.length === 0) {
Expand Down Expand Up @@ -1042,4 +1051,20 @@ function addUserId(eids, id, source, rti) {
return eids;
}

function getBidFloor(bid) {
if (!utils.isFn(bid.getFloor)) {
return (bid.params.reserve) ? bid.params.reserve : null;
}

let floor = bid.getFloor({
currency: 'USD',
mediaType: '*',
size: '*'
});
if (utils.isPlainObject(floor) && !isNaN(floor.floor) && floor.currency === 'USD') {
return floor.floor;
}
return null;
}

registerBidder(spec);
25 changes: 12 additions & 13 deletions modules/axonixBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as utils from '../src/utils.js';
import { ajax } from '../src/ajax.js';

const BIDDER_CODE = 'axonix';
const BIDDER_VERSION = '1.0.1';
const BIDDER_VERSION = '1.0.2';

const CURRENCY = 'USD';
const DEFAULT_REGION = 'us-east-1';
Expand Down Expand Up @@ -140,15 +140,17 @@ export const spec = {
},

interpretResponse: function(serverResponse) {
if (!utils.isArray(serverResponse)) {
const response = serverResponse ? serverResponse.body : [];

if (!utils.isArray(response)) {
return [];
}

const responses = [];

for (const response of serverResponse) {
if (response.requestId) {
responses.push(Object.assign(response, {
for (const resp of response) {
if (resp.requestId) {
responses.push(Object.assign(resp, {
ttl: config.getConfig('_bidderTimeout')
}));
}
Expand All @@ -171,15 +173,12 @@ export const spec = {
}
},

onBidWon: function(bids) {
for (const bid of bids) {
const { nurl } = bid || {};
onBidWon: function(bid) {
const { nurl } = bid || {};

if (bid.nurl) {
utils.replaceAuctionPrice(nurl, bid.cpm)
utils.triggerPixel(nurl);
};
}
if (bid.nurl) {
utils.triggerPixel(utils.replaceAuctionPrice(nurl, bid.cpm));
};
}
}

Expand Down
2 changes: 1 addition & 1 deletion modules/axonixBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
```
Module Name : Axonix Bidder Adapter
Module Type : Bidder Adapter
Maintainer : support-prebid@axonix.com
Maintainer : support+prebid@axonix.com
```

# Description
Expand Down
4 changes: 4 additions & 0 deletions modules/bridgewellBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ export const spec = {
bidResponse.currency = matchedResponse.currency;
bidResponse.mediaType = matchedResponse.mediaType;

if (matchedResponse.adomain) {
utils.deepSetValue(bidResponse, 'meta.advertiserDomains', Array.isArray(matchedResponse.adomain) ? matchedResponse.adomain : [matchedResponse.adomain]);
}

// check required parameters by matchedResponse.mediaType
switch (matchedResponse.mediaType) {
case BANNER:
Expand Down
2 changes: 1 addition & 1 deletion modules/criteoBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Module Name: Criteo Bidder Adapter
Module Type: Bidder Adapter
Maintainer: pi-direct@criteo.com
Maintainer: prebid@criteo.com

# Description

Expand Down
Loading

0 comments on commit a209e29

Please sign in to comment.