Skip to content

Commit

Permalink
Merge pull request prebid#10 from pm-manasi-moghe/master
Browse files Browse the repository at this point in the history
merge latest prebid from master into branch
  • Loading branch information
pm-manasi-moghe authored Feb 27, 2019
2 parents 1b7c856 + 84c6e64 commit feaf0fa
Show file tree
Hide file tree
Showing 179 changed files with 14,038 additions and 4,725 deletions.
4 changes: 2 additions & 2 deletions RELEASE_SCHEDULE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

## Release Schedule

We push a new release of Prebid.js every other week on Tuesday. During the adoption phase for 1.x, we are releasing updates for 1.x and 0.x at the same time.
We aim to push a new release of Prebid.js every week on Tuesday.

While the releases will be available immediately for those using direct Git access,
it will be about a week before the Prebid Org [Download Page](http://prebid.org/download.html) will be updated.
Expand Down Expand Up @@ -128,7 +128,7 @@ Characteristics of a `GA` release:

## FAQs

**1. Is there flexibility in the 2-week schedule?**
**1. Is there flexibility in the schedule?**

If a major bug is found in the current release, a maintenance patch will be done as soon as possible.

Expand Down
29 changes: 24 additions & 5 deletions gulpHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const gutil = require('gulp-util');
const MODULE_PATH = './modules';
const BUILD_PATH = './build/dist';
const DEV_PATH = './build/dev';
const ANALYTICS_PATH = '../analytics';


// get only subdirectories that contain package.json with 'main' property
Expand Down Expand Up @@ -126,18 +127,36 @@ module.exports = {
* Invoke with gulp <task> --analytics
* Returns an array of source files for inclusion in build process
*/
getAnalyticsSources: function(directory) {
getAnalyticsSources: function() {
if (!argv.analytics) {return [];} // empty arrays won't affect a standard build

const directoryContents = fs.readdirSync(directory);
const directoryContents = fs.readdirSync(ANALYTICS_PATH);
return directoryContents
.filter(file => isModuleDirectory(path.join(directory, file)))
.filter(file => isModuleDirectory(path.join(ANALYTICS_PATH, file)))
.map(moduleDirectory => {
const module = require(path.join(directory, moduleDirectory, MANIFEST));
return path.join(directory, moduleDirectory, module.main);
const module = require(path.join(ANALYTICS_PATH, moduleDirectory, MANIFEST));
return path.join(ANALYTICS_PATH, moduleDirectory, module.main);
});
},

/*
* Returns the babel options object necessary for allowing analytics packages
* to have their own configs. Gets added to prebid's webpack config with the
* flag --analytics
*/
getAnalyticsOptions: function() {
let options;

if (argv.analytics) {
// https://babeljs.io/docs/en/options#babelrcroots
options = {
babelrcRoots: ['.', ANALYTICS_PATH],
}
}

return options;
},

createEnd2EndTestReport : function(targetDestinationDir) {
var browsers = require('./browsers.json');
var env = [];
Expand Down
6 changes: 2 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ var jsEscape = require('gulp-js-escape');
var prebid = require('./package.json');
var dateString = 'Updated : ' + (new Date()).toISOString().substring(0, 10);
var banner = '/* <%= prebid.name %> v<%= prebid.version %>\n' + dateString + ' */\n';
var analyticsDirectory = '../analytics';
var port = 9999;

// these modules must be explicitly listed in --modules to be included in the build, won't be part of "all" modules
Expand Down Expand Up @@ -135,7 +134,7 @@ function makeDevpackPkg() {
cloned.devtool = 'source-map';
var externalModules = helpers.getArgModules();

const analyticsSources = helpers.getAnalyticsSources(analyticsDirectory);
const analyticsSources = helpers.getAnalyticsSources();
const moduleSources = helpers.getModulePaths(externalModules);

return gulp.src([].concat(moduleSources, analyticsSources, 'src/prebid.js'))
Expand All @@ -147,12 +146,11 @@ function makeDevpackPkg() {

function makeWebpackPkg() {
var cloned = _.cloneDeep(webpackConfig);

delete cloned.devtool;

var externalModules = helpers.getArgModules();

const analyticsSources = helpers.getAnalyticsSources(analyticsDirectory);
const analyticsSources = helpers.getAnalyticsSources();
const moduleSources = helpers.getModulePaths(externalModules);

return gulp.src([].concat(moduleSources, analyticsSources, 'src/prebid.js'))
Expand Down
6 changes: 4 additions & 2 deletions integrationExamples/gpt/pbjs_example_gpt.html
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,8 @@
bidder: 'zedo',
params: {
channelCode: 2264002816, //REQUIRED
dimId: 9 //REQUIRED
dimId: 9, //REQUIRED
pubId: 1 // OPTIONAL
}
},
{
Expand Down Expand Up @@ -418,7 +419,8 @@
{
bidder: 'gumgum',
params: {
inScreen: 'ggumtest' // REQUIRED str Tracking Id
inScreen: 'ggumtest', // REQUIRED str Tracking Id
bidfloor: 0.01 // OPTIONAL number CPM bid
}
},
{
Expand Down
4 changes: 4 additions & 0 deletions integrationExamples/gpt/unruly_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
pbjs.setConfig({
"currency": {
"adServerCurrency": "USD",
},
"userSync": {
"iframeEnabled": true,
"enabledBidders": ['unruly']
}
});
});
Expand Down
19 changes: 11 additions & 8 deletions modules/adheseBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,19 @@ export const spec = {
.map(item => adResponse(item.bid, item.ad));
},

getUserSyncs: function(syncOptions, serverResponse, gdprConsent) {
const account = serverResponse.account || '';
if (syncOptions.iframeEnabled) {
let syncurl = USER_SYNC_BASE_URL + '?account=' + account;
if (gdprConsent) {
syncurl += '&gdpr=' + (gdprConsent.gdprApplies ? 1 : 0);
syncurl += '&consentString=' + encodeURIComponent(gdprConsent.consentString || '');
getUserSyncs: function(syncOptions, serverResponses, gdprConsent) {
if (syncOptions.iframeEnabled && serverResponses.length > 0) {
const account = serverResponses[0].account;
if (account) {
let syncurl = USER_SYNC_BASE_URL + '?account=' + account;
if (gdprConsent) {
syncurl += '&gdpr=' + (gdprConsent.gdprApplies ? 1 : 0);
syncurl += '&consentString=' + encodeURIComponent(gdprConsent.consentString || '');
}
return [{type: 'iframe', url: syncurl}];
}
return [{ type: 'iframe', url: syncurl }];
}
return [];
}
};

Expand Down
39 changes: 21 additions & 18 deletions modules/adkernelAdnBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,30 @@ import * as utils from '../src/utils';
import {registerBidder} from '../src/adapters/bidderFactory';
import {BANNER, VIDEO} from '../src/mediaTypes';
import includes from 'core-js/library/fn/array/includes';
import {parse as parseUrl} from '../src/url';

const DEFAULT_ADKERNEL_DSP_DOMAIN = 'tag.adkernel.com';
const VIDEO_TARGETING = ['mimes', 'protocols', 'api'];
const DEFAULT_MIMES = ['video/mp4', 'video/webm', 'application/x-shockwave-flash', 'application/javascript'];
const DEFAULT_PROTOCOLS = [2, 3, 5, 6];
const DEFAULT_APIS = [1, 2];

function isRtbDebugEnabled() {
return utils.getTopWindowLocation().href.indexOf('adk_debug=true') !== -1;
function isRtbDebugEnabled(refInfo) {
return refInfo.referer.indexOf('adk_debug=true') !== -1;
}

function buildImp(bidRequest) {
let imp = {
id: bidRequest.bidId,
tagid: bidRequest.adUnitCode
};
if (bidRequest.mediaType === BANNER || utils.deepAccess(bidRequest, `mediaTypes.banner`) ||
(bidRequest.mediaTypes === undefined && bidRequest.mediaType === undefined)) {
let sizes = canonicalizeSizesArray(bidRequest.sizes);
if (utils.deepAccess(bidRequest, `mediaTypes.banner`)) {
let sizes = canonicalizeSizesArray(bidRequest.mediaTypes.banner.sizes);
imp.banner = {
format: utils.parseSizesInput(sizes)
}
} else if (bidRequest.mediaType === VIDEO || utils.deepAccess(bidRequest, `mediaTypes.video`)) {
let size = canonicalizeSizesArray(bidRequest.sizes)[0];
} else if (utils.deepAccess(bidRequest, `mediaTypes.video`)) {
let size = canonicalizeSizesArray(bidRequest.mediaTypes.video.playerSize)[0];
imp.video = {
w: size[0],
h: size[1],
Expand Down Expand Up @@ -54,11 +54,11 @@ function canonicalizeSizesArray(sizes) {
return sizes;
}

function buildRequestParams(tags, auctionId, transactionId, gdprConsent) {
function buildRequestParams(tags, auctionId, transactionId, gdprConsent, refInfo) {
let req = {
id: auctionId,
tid: transactionId,
site: buildSite(),
site: buildSite(refInfo),
imp: tags
};

Expand All @@ -74,13 +74,15 @@ function buildRequestParams(tags, auctionId, transactionId, gdprConsent) {
return req;
}

function buildSite() {
let loc = utils.getTopWindowLocation();
function buildSite(refInfo) {
let loc = parseUrl(refInfo.referer);
let result = {
page: loc.href,
ref: utils.getTopWindowReferrer(),
secure: ~~(loc.protocol === 'https:')
page: `${loc.protocol}://${loc.hostname}${loc.pathname}`,
secure: ~~(loc.protocol === 'https')
};
if (self === top && document.referrer) {
result.ref = document.referrer;
}
let keywords = document.getElementsByTagName('meta')['keywords'];
if (keywords && keywords.content) {
result.keywords = keywords.content;
Expand All @@ -101,7 +103,7 @@ function buildBid(tag) {
netRevenue: true
};
if (tag.tag) {
bid.ad = `<!DOCTYPE html><html><head><title></title><body style='margin:0px;padding:0px;'>${tag.tag}</body></head>`;
bid.ad = tag.tag;
bid.mediaType = BANNER;
} else if (tag.vast_url) {
bid.vastUrl = tag.vast_url;
Expand All @@ -117,7 +119,7 @@ export const spec = {

isBidRequestValid: function(bidRequest) {
return 'params' in bidRequest && (typeof bidRequest.params.host === 'undefined' || typeof bidRequest.params.host === 'string') &&
typeof bidRequest.params.pubId === 'number';
typeof bidRequest.params.pubId === 'number' && 'mediaTypes' in bidRequest && ('banner' in bidRequest.mediaTypes || 'video' in bidRequest.mediaTypes);
},

buildRequests: function(bidRequests, bidderRequest) {
Expand All @@ -134,13 +136,14 @@ export const spec = {
let auctionId = bidderRequest.auctionId;
let gdprConsent = bidderRequest.gdprConsent;
let transactionId = bidderRequest.transactionId;
let refererInfo = bidderRequest.refererInfo;
let requests = [];
Object.keys(dispatch).forEach(host => {
Object.keys(dispatch[host]).forEach(pubId => {
let request = buildRequestParams(dispatch[host][pubId], auctionId, transactionId, gdprConsent);
let request = buildRequestParams(dispatch[host][pubId], auctionId, transactionId, gdprConsent, refererInfo);
requests.push({
method: 'POST',
url: `//${host}/tag?account=${pubId}&pb=1${isRtbDebugEnabled() ? '&debug=1' : ''}`,
url: `//${host}/tag?account=${pubId}&pb=1${isRtbDebugEnabled(refererInfo) ? '&debug=1' : ''}`,
data: JSON.stringify(request)
})
});
Expand Down
31 changes: 13 additions & 18 deletions modules/adkernelBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { BANNER, VIDEO } from '../src/mediaTypes';
import {registerBidder} from '../src/adapters/bidderFactory';
import find from 'core-js/library/fn/array/find';
import includes from 'core-js/library/fn/array/includes';
import {parse as parseUrl} from '../src/url'
import {parse as parseUrl} from '../src/url';

const VIDEO_TARGETING = ['mimes', 'minduration', 'maxduration', 'protocols',
'startdelay', 'linearity', 'boxingallowed', 'playbackmethod', 'delivery',
Expand All @@ -20,7 +20,8 @@ export const spec = {
supportedMediaTypes: [BANNER, VIDEO],
isBidRequestValid: function(bidRequest) {
return 'params' in bidRequest && typeof bidRequest.params.host !== 'undefined' &&
'zoneId' in bidRequest.params && !isNaN(Number(bidRequest.params.zoneId));
'zoneId' in bidRequest.params && !isNaN(Number(bidRequest.params.zoneId)) &&
bidRequest.mediaTypes && (bidRequest.mediaTypes.banner || bidRequest.mediaTypes.video);
},
buildRequests: function(bidRequests, bidderRequest) {
let impDispatch = dispatchImps(bidRequests, bidderRequest.refererInfo);
Expand All @@ -31,14 +32,9 @@ export const spec = {
Object.keys(impDispatch[host]).forEach(zoneId => {
const request = buildRtbRequest(impDispatch[host][zoneId], auctionId, gdprConsent, bidderRequest.refererInfo);
requests.push({
method: 'GET',
url: `${window.location.protocol}//${host}/rtbg`,
data: {
zone: Number(zoneId),
ad_type: 'rtb',
v: VERSION,
r: JSON.stringify(request)
}
method: 'POST',
url: `${window.location.protocol}//${host}/hb?zone=${Number(zoneId)}&v=${VERSION}`,
data: JSON.stringify(request)
});
});
});
Expand All @@ -50,7 +46,7 @@ export const spec = {
return [];
}

let rtbRequest = JSON.parse(request.data.r);
let rtbRequest = JSON.parse(request.data);
let rtbImps = rtbRequest.imp;
let rtbBids = response.seatbid
.map(seatbid => seatbid.bid)
Expand Down Expand Up @@ -120,15 +116,14 @@ function buildImp(bidRequest, secure) {
'tagid': bidRequest.adUnitCode
};

if (bidRequest.mediaType === BANNER || utils.deepAccess(bidRequest, `mediaTypes.banner`) ||
(bidRequest.mediaTypes === undefined && bidRequest.mediaType === undefined)) {
let sizes = canonicalizeSizesArray(bidRequest.sizes);
if (utils.deepAccess(bidRequest, `mediaTypes.banner`)) {
let sizes = canonicalizeSizesArray(bidRequest.mediaTypes.banner.sizes);
imp.banner = {
format: sizes.map(s => ({'w': s[0], 'h': s[1]})),
topframe: 0
};
} else if (bidRequest.mediaType === VIDEO || utils.deepAccess(bidRequest, 'mediaTypes.video')) {
let size = canonicalizeSizesArray(bidRequest.sizes)[0];
} else if (utils.deepAccess(bidRequest, 'mediaTypes.video')) {
let size = canonicalizeSizesArray(bidRequest.mediaTypes.video.playerSize)[0];
imp.video = {
w: size[0],
h: size[1]
Expand Down Expand Up @@ -222,9 +217,9 @@ function createSite(refInfo) {
* @param bid rtb Bid object
*/
function formatAdMarkup(bid) {
var adm = bid.adm;
let adm = bid.adm;
if ('nurl' in bid) {
adm += utils.createTrackPixelHtml(`${bid.nurl}&px=1`);
}
return `<!DOCTYPE html><html><head><title></title><body style='margin:0px;padding:0px;'>${adm}</body></head>`;
return adm;
}
1 change: 1 addition & 0 deletions modules/adliveBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { BANNER } from '../src/mediaTypes';

const BIDDER_CODE = 'adlive';
const ENDPOINT_URL = 'https://api.publishers.adlive.io/get?pbjs=1';

const CURRENCY = 'USD';
const TIME_TO_LIVE = 360;

Expand Down
Loading

0 comments on commit feaf0fa

Please sign in to comment.