Skip to content

Commit e7e485e

Browse files
author
Jaimin Panchal
committed
Merge branch 'master' of github.com:prebid/Prebid.js into translation-module
2 parents e334120 + 36f1230 commit e7e485e

File tree

70 files changed

+7699
-970
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+7699
-970
lines changed

gulpHelpers.js

+24-5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const gutil = require('gulp-util');
1111
const MODULE_PATH = './modules';
1212
const BUILD_PATH = './build/dist';
1313
const DEV_PATH = './build/dev';
14+
const ANALYTICS_PATH = '../analytics';
1415

1516

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

132-
const directoryContents = fs.readdirSync(directory);
133+
const directoryContents = fs.readdirSync(ANALYTICS_PATH);
133134
return directoryContents
134-
.filter(file => isModuleDirectory(path.join(directory, file)))
135+
.filter(file => isModuleDirectory(path.join(ANALYTICS_PATH, file)))
135136
.map(moduleDirectory => {
136-
const module = require(path.join(directory, moduleDirectory, MANIFEST));
137-
return path.join(directory, moduleDirectory, module.main);
137+
const module = require(path.join(ANALYTICS_PATH, moduleDirectory, MANIFEST));
138+
return path.join(ANALYTICS_PATH, moduleDirectory, module.main);
138139
});
139140
},
140141

142+
/*
143+
* Returns the babel options object necessary for allowing analytics packages
144+
* to have their own configs. Gets added to prebid's webpack config with the
145+
* flag --analytics
146+
*/
147+
getAnalyticsOptions: function() {
148+
let options;
149+
150+
if (argv.analytics) {
151+
// https://babeljs.io/docs/en/options#babelrcroots
152+
options = {
153+
babelrcRoots: ['.', ANALYTICS_PATH],
154+
}
155+
}
156+
157+
return options;
158+
},
159+
141160
createEnd2EndTestReport : function(targetDestinationDir) {
142161
var browsers = require('./browsers.json');
143162
var env = [];

gulpfile.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ var jsEscape = require('gulp-js-escape');
3030
var prebid = require('./package.json');
3131
var dateString = 'Updated : ' + (new Date()).toISOString().substring(0, 10);
3232
var banner = '/* <%= prebid.name %> v<%= prebid.version %>\n' + dateString + ' */\n';
33-
var analyticsDirectory = '../analytics';
3433
var port = 9999;
3534

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

138-
const analyticsSources = helpers.getAnalyticsSources(analyticsDirectory);
137+
const analyticsSources = helpers.getAnalyticsSources();
139138
const moduleSources = helpers.getModulePaths(externalModules);
140139

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

148147
function makeWebpackPkg() {
149148
var cloned = _.cloneDeep(webpackConfig);
150-
151149
delete cloned.devtool;
152150

153151
var externalModules = helpers.getArgModules();
154152

155-
const analyticsSources = helpers.getAnalyticsSources(analyticsDirectory);
153+
const analyticsSources = helpers.getAnalyticsSources();
156154
const moduleSources = helpers.getModulePaths(externalModules);
157155

158156
return gulp.src([].concat(moduleSources, analyticsSources, 'src/prebid.js'))

integrationExamples/gpt/pbjs_example_gpt.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,8 @@
300300
bidder: 'zedo',
301301
params: {
302302
channelCode: 2264002816, //REQUIRED
303-
dimId: 9 //REQUIRED
303+
dimId: 9, //REQUIRED
304+
pubId: 1 // OPTIONAL
304305
}
305306
},
306307
{

modules/admediaBidAdapter.js

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import * as utils from '../src/utils';
2+
import {registerBidder} from '../src/adapters/bidderFactory';
3+
4+
const BIDDER_CODE = 'admedia';
5+
const ENDPOINT_URL = '//prebid.admedia.com/bidder/';
6+
7+
export const spec = {
8+
code: BIDDER_CODE,
9+
10+
isBidRequestValid: function (bid) {
11+
return bid.params && !!bid.params.aid;
12+
},
13+
14+
buildRequests: function (validBidRequests, bidderRequest) {
15+
let payload = {};
16+
17+
if (bidderRequest && bidderRequest.refererInfo) {
18+
payload.referer = encodeURIComponent(bidderRequest.refererInfo.referer);
19+
}
20+
21+
payload.tags = [];
22+
23+
utils._each(validBidRequests, function (bid) {
24+
const tag = {
25+
id: bid.bidId,
26+
sizes: bid.sizes,
27+
aid: bid.params.aid
28+
};
29+
payload.tags.push(tag);
30+
});
31+
32+
const payloadString = JSON.stringify(payload);
33+
return {
34+
method: 'POST',
35+
url: ENDPOINT_URL,
36+
data: payloadString,
37+
};
38+
},
39+
40+
interpretResponse: function (serverResponse, bidRequest) {
41+
const bidResponses = [];
42+
43+
if (!serverResponse.body.tags) {
44+
return bidResponses;
45+
}
46+
47+
utils._each(serverResponse.body.tags, function (response) {
48+
if (!response.error && response.cpm > 0) {
49+
const bidResponse = {
50+
requestId: response.id,
51+
cpm: response.cpm,
52+
width: response.width,
53+
height: response.height,
54+
creativeId: response.id,
55+
dealId: response.id,
56+
currency: 'USD',
57+
netRevenue: true,
58+
ttl: 120,
59+
// referrer: REFERER,
60+
ad: response.ad
61+
};
62+
63+
bidResponses.push(bidResponse);
64+
}
65+
});
66+
67+
return bidResponses;
68+
}
69+
};
70+
71+
registerBidder(spec);

modules/admediaBidAdapter.md

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Overview
2+
3+
```
4+
Module Name: Admedia Bidder Adapter
5+
Module Type: Bidder Adapter
6+
Maintainer: [email protected]
7+
```
8+
9+
# Description
10+
11+
Admedia Bidder Adapter for Prebid.js.
12+
Only Banner format is supported.
13+
14+
# Test Parameters
15+
```
16+
var adUnits = [
17+
{
18+
code: 'test-div-0',
19+
sizes: [[300, 250]], // a display size
20+
bids: [
21+
{
22+
bidder: 'admedia',
23+
params: {
24+
aid: 86858
25+
}
26+
}
27+
]
28+
},
29+
{
30+
code: 'test-div-1',
31+
sizes: [[300, 50]], // a mobile size
32+
bids: [
33+
{
34+
bidder: 'admedia',
35+
params: {
36+
aid: 86858
37+
}
38+
}
39+
]
40+
}
41+
];
42+
```

modules/adtelligentBidAdapter.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ function bidToTag(bidRequests, bidderRequest) {
126126
domain: utils.getTopWindowLocation().hostname
127127
};
128128

129-
if (bidderRequest && bidderRequest.gdprConsent) {
129+
if (bidderRequest && bidderRequest.gdprConsent && bidderRequest.gdprConsent.gdprApplies) {
130130
tag.gdpr = 1;
131131
tag.gdpr_consent = bidderRequest.gdprConsent.consentString;
132132
}

0 commit comments

Comments
 (0)