Skip to content

Commit

Permalink
Merge upstream/master into Prebid_1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
IX Prebid Support committed Jun 21, 2018
2 parents 08da6e7 + ead7aa9 commit d23b8e8
Show file tree
Hide file tree
Showing 40 changed files with 988 additions and 268 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ When you are adding code to Prebid.js, or modifying code that isn't covered by a
Prebid.js already has many tests. Read them to see how Prebid.js is tested, and for inspiration:

- Look in `test/spec` and its subdirectories
- Tests for bidder adaptors are located in `test/spec/adapters`
- Tests for bidder adaptors are located in `test/spec/modules`

A test module might have the following general structure:

Expand Down
15 changes: 15 additions & 0 deletions RELEASE_SCHEDULE.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,21 @@ Announcements regarding releases will be made to the #headerbidding-dev channel
git push
```

## Beta Releases

Prebid.js features may be released as Beta or as Generally Available (GA).

Characteristics of a `Beta` release:
- May be a partial implementation (e.g. more work needed to flesh out the feature)
- May not be fully tested with other features
- Limited documentation, focused on technical aspects
- Few users

Characteristics of a `GA` release:
- Complete set of functionality
- Significant user base with no major issues for at least a month
- Decent documentation that includes business need, use cases, and examples


## FAQs

Expand Down
16 changes: 0 additions & 16 deletions browsers.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,5 @@
"browser_version": "8.0",
"device": null,
"os": "OS X"
},
"bs_ios_9": {
"base": "BrowserStack",
"os": "ios",
"os_version": "9.1",
"browser": "iphone",
"device": "iPhone 6S",
"browser_version": null
},
"bs_ios_8": {
"base": "BrowserStack",
"os": "ios",
"os_version": "8.3",
"browser": "iphone",
"device": "iPhone 6",
"browser_version": null
}
}
7 changes: 7 additions & 0 deletions integrationExamples/gpt/pbjs_example_gpt.html
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,13 @@
placement_id: 0
}
},
{
bidder: 'weborama',
params: {
placementId: 0,
traffic: 'banner'
}
},
{
bidder: 'pollux',
params: {
Expand Down
2 changes: 1 addition & 1 deletion modules/admixerBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const spec = {
buildRequests: function (bidderRequest) {
const payload = {
imps: [],
referrer: utils.getTopWindowUrl(),
referrer: encodeURIComponent(utils.getTopWindowUrl()),
};
bidderRequest.forEach((bid) => {
if (bid.bidder === BIDDER_CODE) {
Expand Down
2 changes: 1 addition & 1 deletion modules/adyoulikeBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const spec = {

const data = JSON.stringify(payload);
const options = {
withCredentials: false
withCredentials: true
};

return {
Expand Down
8 changes: 6 additions & 2 deletions modules/audienceNetworkBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ const url = 'https://an.facebook.com/v2/placementbid.json';
const supportedMediaTypes = ['banner', 'video'];
const netRevenue = true;
const hb_bidder = 'fan';
const pbv = '$prebid.version$';
const platver = '$prebid.version$';
const platform = '241394079772386';
const adapterver = '1.0.0';

/**
* Does this bid request contain valid parameters?
Expand Down Expand Up @@ -166,7 +168,9 @@ const buildRequests = bids => {
testmode,
pageurl,
sdk,
pbv
adapterver,
platform,
platver
};
const video = findIndex(adformats, isVideo);
if (video !== -1) {
Expand Down
36 changes: 21 additions & 15 deletions modules/consentManagement.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ function lookupIabConsent(cmpSuccess, cmpError, hookConfig) {
f = f.parent;
}

if (!cmpFrame) {
return cmpError('CMP not found.', hookConfig);
}

callCmpWhileInIframe('getConsentData', cmpFrame, callbackHandler.consentDataCallback);
callCmpWhileInIframe('getVendorConsents', cmpFrame, callbackHandler.vendorConsentsCallback);
}
Expand Down Expand Up @@ -124,12 +128,6 @@ function lookupIabConsent(cmpSuccess, cmpError, hookConfig) {
/* Setup up a __cmp function to do the postMessage and stash the callback.
This function behaves (from the caller's perspective identicially to the in-frame __cmp call */
window.__cmp = function(cmd, arg, callback) {
if (!cmpFrame) {
removePostMessageListener();

let errmsg = 'CMP not found';
return cmpError(errmsg, hookConfig);
}
let callId = Math.random() + '';
let msg = {__cmpCall: {
command: cmd,
Expand Down Expand Up @@ -219,11 +217,17 @@ export function requestBidsHook(reqBidsConfigObj, fn) {
* @param {object} hookConfig contains module related variables (see comment in requestBidsHook function)
*/
function processCmpData(consentObject, hookConfig) {
let gdprApplies = consentObject && consentObject.getConsentData && consentObject.getConsentData.gdprApplies;
if (
!utils.isPlainObject(consentObject) ||
(!utils.isPlainObject(consentObject.getVendorConsents) || Object.keys(consentObject.getVendorConsents).length === 0) ||
(!utils.isPlainObject(consentObject.getConsentData) || Object.keys(consentObject.getConsentData).length === 0)) {
cmpFailed(`CMP returned unexpected value during lookup process; returned value was (${consentObject}).`, hookConfig);
(typeof gdprApplies !== 'boolean') ||
(gdprApplies === true &&
!(utils.isStr(consentObject.getConsentData.consentData) &&
utils.isPlainObject(consentObject.getVendorConsents) &&
Object.keys(consentObject.getVendorConsents).length > 1
)
)
) {
cmpFailed(`CMP returned unexpected value during lookup process.`, hookConfig, consentObject);
} else {
clearTimeout(hookConfig.timer);
storeConsentData(consentObject);
Expand All @@ -243,15 +247,16 @@ function cmpTimedOut(hookConfig) {
* This function contains the controlled steps to perform when there's a problem with CMP.
* @param {string} errMsg required; should be a short descriptive message for why the failure/issue happened.
* @param {object} hookConfig contains module related variables (see comment in requestBidsHook function)
* @param {object} extraArgs contains additional data that's passed along in the error/warning messages for easier debugging
*/
function cmpFailed(errMsg, hookConfig) {
function cmpFailed(errMsg, hookConfig, extraArgs) {
clearTimeout(hookConfig.timer);

// still set the consentData to undefined when there is a problem as per config options
if (allowAuction) {
storeConsentData(undefined);
}
exitModule(errMsg, hookConfig);
exitModule(errMsg, hookConfig, extraArgs);
}

/**
Expand Down Expand Up @@ -282,8 +287,9 @@ function storeConsentData(cmpConsentObject) {
* 3. bad exit with auction canceled (error message is logged).
* @param {string} errMsg optional; only to be used when there was a 'bad' exit. String is a descriptive message for the failure/issue encountered.
* @param {object} hookConfig contains module related variables (see comment in requestBidsHook function)
* @param {object} extraArgs contains additional data that's passed along in the error/warning messages for easier debugging
*/
function exitModule(errMsg, hookConfig) {
function exitModule(errMsg, hookConfig, extraArgs) {
if (hookConfig.haveExited === false) {
hookConfig.haveExited = true;

Expand All @@ -293,10 +299,10 @@ function exitModule(errMsg, hookConfig) {

if (errMsg) {
if (allowAuction) {
utils.logWarn(errMsg + ' Resuming auction without consent data as per consentManagement config.');
utils.logWarn(errMsg + ' Resuming auction without consent data as per consentManagement config.', extraArgs);
nextFn.apply(context, args);
} else {
utils.logError(errMsg + ' Canceling auction as per consentManagement config.');
utils.logError(errMsg + ' Canceling auction as per consentManagement config.', extraArgs);
if (typeof hookConfig.bidsBackHandler === 'function') {
hookConfig.bidsBackHandler();
} else {
Expand Down
16 changes: 16 additions & 0 deletions modules/eplanningBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ export const spec = {
isBidRequestValid: function(bid) {
return Boolean(bid.params.ci) || Boolean(bid.params.t);
},

buildRequests: function(bidRequests) {
const method = 'GET';
const dfpClientId = '1';
const sec = 'ROS';
let url;
let params;
const urlConfig = getUrlConfig(bidRequests);
const pcrs = getCharset();

if (urlConfig.t) {
url = urlConfig.isv + '/layers/t_pbjs_2.json';
Expand All @@ -40,6 +42,11 @@ export const spec = {
pbv: '$prebid.version$',
ncb: '1'
};

if (pcrs) {
params.crs = pcrs;
}

if (referrerUrl) {
params.fr = referrerUrl;
}
Expand Down Expand Up @@ -147,6 +154,15 @@ function getSpacesString(bids) {

return spacesString;
}

function getCharset() {
try {
return window.top.document.charset || window.top.document.characterSet;
} catch (e) {
return document.charset || document.characterSet;
}
}

function getBidIdMap(bidRequests) {
let map = {};
bidRequests.forEach(bid => map[cleanName(bid.adUnitCode)] = bid.bidId);
Expand Down
3 changes: 2 additions & 1 deletion modules/googleAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ function sendBidTimeouts(timedOutBidders) {
_analyticsQueue.push(function () {
utils._each(timedOutBidders, function (bidderCode) {
_eventCount++;
window[_gaGlobal](_trackerSend, 'event', _category, 'Timeouts', bidderCode, _disableInteraction);
var bidderName = bidderCode.bidder;
window[_gaGlobal](_trackerSend, 'event', _category, 'Timeouts', bidderName, _disableInteraction);
});
});

Expand Down
2 changes: 1 addition & 1 deletion modules/ixBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export const spec = {
return false;
}

if (typeof bid.params.siteId !== 'string') {
if (typeof bid.params.siteId !== 'string' && typeof bid.params.siteId !== 'number') {
return false;
}

Expand Down
13 changes: 10 additions & 3 deletions modules/prebidServerBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ const OPEN_RTB_PROTOCOL = {
response.seatbid.forEach(seatbid => {
(seatbid.bid || []).forEach(bid => {
const bidRequest = utils.getBidRequest(
this.bidMap[`${bid.impid}${seatbid.seat}`],
this.bidMap[`${bid.impid}${seatbid.seat}`].bid_id,
bidderRequests
);

Expand Down Expand Up @@ -704,11 +704,12 @@ export function PrebidServer() {
/* Notify Prebid of bid responses so bids can get in the auction */
function handleResponse(response, requestedBidders, bidderRequests, addBidResponse, done) {
let result;
let bids = [];

try {
result = JSON.parse(response);

const bids = protocolAdapter().interpretResponse(
bids = protocolAdapter().interpretResponse(
result,
bidderRequests,
requestedBidders
Expand All @@ -734,7 +735,13 @@ export function PrebidServer() {
utils.logError('error parsing response: ', result.status);
}

done();
const videoBid = bids.some(bidResponse => bidResponse.bid.mediaType === 'video');
const cacheEnabled = config.getConfig('cache.url');

// video bids with cache enabled need to be cached first before they are considered done
if (!(videoBid && cacheEnabled)) {
done();
}
doClientSideSyncs(requestedBidders);
}

Expand Down
9 changes: 7 additions & 2 deletions modules/quantcastBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ export const spec = {
* `BidRequests`.
*
* @param {BidRequest[]} bidRequests A non-empty list of bid requests which should be send to Quantcast server
* @param bidderRequest
* @return ServerRequest information describing the request to the server.
*/
buildRequests(bidRequests) {
buildRequests(bidRequests, bidderRequest) {
const bids = bidRequests || [];

const referrer = utils.getTopWindowUrl();
Expand Down Expand Up @@ -75,6 +76,8 @@ export const spec = {
});
});

const gdprConsent = bidderRequest ? bidderRequest.gdprConsent : {};

// Request Data Format can be found at https://wiki.corp.qc/display/adinf/QCX
const requestData = {
publisherId: bid.params.publisherId,
Expand All @@ -94,7 +97,9 @@ export const spec = {
referrer,
domain
},
bidId: bid.bidId
bidId: bid.bidId,
gdprSignal: gdprConsent.gdprApplies ? 1 : 0,
gdprConsent: gdprConsent.consentString
};

const data = JSON.stringify(requestData);
Expand Down
4 changes: 2 additions & 2 deletions modules/quantcastBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
```
Module Name: Quantcast Bidder Adapter
Module Type: Bidder Adapter
Maintainer: xli@quantcast.com
Maintainer: igor.soarez@quantcast.com
```

# Description
Expand All @@ -28,4 +28,4 @@ const adUnits = [{
}
]
}];
```
```
3 changes: 2 additions & 1 deletion modules/rubiconBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ var sizeMap = {
199: '640x200',
213: '1030x590',
214: '980x360',
232: '580x400'
232: '580x400',
257: '400x600'
};
utils._each(sizeMap, (item, key) => sizeMap[item] = key);

Expand Down
Loading

0 comments on commit d23b8e8

Please sign in to comment.