Skip to content

Commit

Permalink
Merge pull request #21 from prebid/master
Browse files Browse the repository at this point in the history
Update remote fork
  • Loading branch information
wojciech-bialy-wpm committed Apr 12, 2022
2 parents c722caf + a6496f5 commit 383fb31
Show file tree
Hide file tree
Showing 73 changed files with 5,362 additions and 2,525 deletions.
9 changes: 7 additions & 2 deletions PR_REVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,16 @@ Follow steps above for general review process. In addition, please verify the fo
- If the adapter being submitted is an alias type, check with the bidder contact that is being aliased to make sure it's allowed.
- All bidder parameter conventions must be followed:
- Video params must be read from AdUnit.mediaTypes.video when available; however bidder config can override the ad unit.
- First party data must be read from [`fpd.context` and `fpd.user`](https://docs.prebid.org/dev-docs/publisher-api-reference.html#setConfig-fpd).
- First party data must be read from [getConfig('ortb2');](https://docs.prebid.org/dev-docs/publisher-api-reference/setConfig.html#setConfig-fpd).
- Adapters that accept a floor parameter must also support the [floors module](https://docs.prebid.org/dev-docs/modules/floors.html) -- look for a call to the `getFloor()` function.
- Adapters cannot accept an schain parameter. Rather, they must look for the schain parameter at bidRequest.schain.
- The bidRequest page referrer must checked in addition to any bidder-specific parameter.
- The bidderRequest.refererInfo.referer must be checked in addition to any bidder-specific parameter.
- If they're getting the COPPA flag, it must come from config.getConfig('coppa');
- Page position must come from bidrequest.mediaTypes.banner.pos or bidrequest.mediaTypes.video.pos
- Global OpenRTB fields should come from [getConfig('ortb2');](https://docs.prebid.org/dev-docs/publisher-api-reference/setConfig.html#setConfig-fpd):
- bcat, battr, badv
- Impression-specific OpenRTB fields should come from bidrequest.ortb2imp
- instl
- Below are some examples of bidder specific updates that should require docs update (in their dev-docs/bidders/BIDDER.md file):
- If they support the GDPR consentManagement module and TCF1, add `gdpr_supported: true`
- If they support the GDPR consentManagement module and TCF2, add `tcf2_supported: true`
Expand Down
24 changes: 18 additions & 6 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ function makeDevpackPkg() {

function makeWebpackPkg() {
var cloned = _.cloneDeep(webpackConfig);
delete cloned.devtool;
if (!argv.sourceMaps) {
delete cloned.devtool;
}

var externalModules = helpers.getArgModules();

Expand All @@ -144,10 +146,19 @@ function makeWebpackPkg() {
return gulp.src([].concat(moduleSources, analyticsSources, 'src/prebid.js'))
.pipe(helpers.nameModules(externalModules))
.pipe(webpackStream(cloned, webpack))
.pipe(gulpif(file => file.basename === 'prebid-core.js', header(banner, { prebid: prebid })))
.pipe(gulp.dest('build/dist'));
}

function addBanner() {
const sm = argv.sourceMaps;

return gulp.src(['build/dist/prebid-core.js'])
.pipe(gulpif(sm, sourcemaps.init({loadMaps: true})))
.pipe(header(banner, {prebid}))
.pipe(gulpif(sm, sourcemaps.write('.')))
.pipe(gulp.dest('build/dist'))
}

function getModulesListToAddInBanner(modules) {
return (modules.length > 0) ? modules.join(', ') : 'All available modules in current version.';
}
Expand All @@ -172,6 +183,7 @@ function nodeBundle(modules) {
function bundle(dev, moduleArr) {
var modules = moduleArr || helpers.getArgModules();
var allModules = helpers.getModuleNames(modules);
const sm = dev || argv.sourceMaps;

if (modules.length === 0) {
modules = allModules.filter(module => explicitModules.indexOf(module) === -1);
Expand Down Expand Up @@ -203,13 +215,13 @@ function bundle(dev, moduleArr) {
)
// Need to uodate the "Modules: ..." section in comment with the current modules list
.pipe(replace(/(Modules: )(.*?)(\*\/)/, ('$1' + getModulesListToAddInBanner(helpers.getArgModules()) + ' $3')))
.pipe(gulpif(dev, sourcemaps.init({ loadMaps: true })))
.pipe(gulpif(sm, sourcemaps.init({ loadMaps: true })))
.pipe(concat(outputFileName))
.pipe(gulpif(!argv.manualEnable, footer('\n<%= global %>.processQueue();', {
global: prebid.globalVarName
}
)))
.pipe(gulpif(dev, sourcemaps.write('.')));
.pipe(gulpif(sm, sourcemaps.write('.')));
}

// Run the unit tests.
Expand Down Expand Up @@ -398,7 +410,7 @@ gulp.task(clean);
gulp.task(escapePostbidConfig);

gulp.task('build-bundle-dev', gulp.series(makeDevpackPkg, gulpBundle.bind(null, true)));
gulp.task('build-bundle-prod', gulp.series(makeWebpackPkg, gulpBundle.bind(null, false)));
gulp.task('build-bundle-prod', gulp.series(makeWebpackPkg, addBanner, gulpBundle.bind(null, false)));

// public tasks (dependencies are needed for each task since they can be ran on their own)
gulp.task('test-only', test);
Expand All @@ -417,7 +429,7 @@ gulp.task('serve-fast', gulp.series(clean, gulp.parallel('build-bundle-dev', wat
gulp.task('serve-and-test', gulp.series(clean, gulp.parallel('build-bundle-dev', watchFast, testTaskMaker({watch: true}))));
gulp.task('serve-fake', gulp.series(clean, gulp.parallel('build-bundle-dev', watch), injectFakeServerEndpointDev, test, startFakeServer));

gulp.task('default', gulp.series(clean, makeWebpackPkg));
gulp.task('default', gulp.series(clean, 'build-bundle-prod'));

gulp.task('e2e-test', gulp.series(clean, setupE2e, gulp.parallel('build-bundle-prod', watch), injectFakeServerEndpoint, test));
// other tasks
Expand Down
29 changes: 22 additions & 7 deletions integrationExamples/gpt/permutiveRtdProvider_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@
}
},
bids: [
{
bidder: 'ix',
params: {
siteId: '123456',
}
},
{
bidder: 'appnexus',
params: {
Expand Down Expand Up @@ -135,15 +141,28 @@
pbjs.que.push(function() {
pbjs.setConfig({
debug: true,
pageUrl: 'http://www.test.com/test.html',
realTimeData: {
auctionDelay: 80, // maximum time for RTD modules to respond
dataProviders: [
{
name: 'permutive',
waitForIt: true,
params: {
acBidders: ['appnexus', 'rubicon', 'ozone', 'trustx'],
acBidders: ['appnexus', 'rubicon', 'ozone', 'trustx', 'ix'],
maxSegs: 500,
transformations: [
{
id: 'iab',
config: {
segtax: 4,
iabIds: {
1000001: '777777',
1000002: '888888'
}
}
}
],
overwrites: {
rubicon: function (bid, data, acEnabled, utils, defaultFn) {
if (defaultFn){
Expand All @@ -160,7 +179,7 @@
}
});
pbjs.setBidderConfig({
bidders: ['appnexus', 'rubicon'],
bidders: ['appnexus', 'rubicon', 'ix'],
config: {
ortb2: {
site: {
Expand All @@ -180,13 +199,9 @@
gender: 'm',
keywords: 'a,b',
data: [
{
name: 'www.dataprovider1.com',
ext: { taxonomyname: 'iab_audience_taxonomy' },
segment: [{ id: '687' }, { id: '123' }]
},
{
name: 'permutive.com',
ext: { segtax: 6 },
segment: [{ id: '1' }]
}
]
Expand Down
2 changes: 1 addition & 1 deletion modules/admanBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {config} from '../src/config.js';

const BIDDER_CODE = 'adman';
const AD_URL = 'https://pub.admanmedia.com/?c=o&m=multi';
const URL_SYNC = 'https://pub.admanmedia.com';
const URL_SYNC = 'https://sync.admanmedia.com';

function isBidResponseValid(bid) {
if (!bid.requestId || !bid.cpm || !bid.creativeId ||
Expand Down
3 changes: 2 additions & 1 deletion modules/adtelligentBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const HOST_GETTERS = {
onefiftytwomedia: () => 'ghb.ads.152media.com',
bidsxchange: () => 'ghb.hbd.bidsxchange.com',
streamkey: () => 'ghb.hb.streamkey.net',
janet: () => 'ghb.bidder.jmgads.com',
}
const getUri = function (bidderCode) {
let bidderWithoutSuffix = bidderCode.split('_')[0];
Expand All @@ -35,7 +36,7 @@ const syncsCache = {};
export const spec = {
code: BIDDER_CODE,
gvlid: 410,
aliases: ['onefiftytwomedia', 'selectmedia', 'appaloosa', 'bidsxchange', 'streamkey',
aliases: ['onefiftytwomedia', 'selectmedia', 'appaloosa', 'bidsxchange', 'streamkey', 'janet',
{ code: 'navelix', gvlid: 380 }
],
supportedMediaTypes: [VIDEO, BANNER],
Expand Down
11 changes: 11 additions & 0 deletions modules/appnexusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ export const spec = {
rd_ifs: bidderRequest.refererInfo.numIframes,
rd_stk: bidderRequest.refererInfo.stack.map((url) => encodeURIComponent(url)).join(',')
}
let pubPageUrl = config.getConfig('pageUrl');
if (isStr(pubPageUrl) && pubPageUrl !== '') {
refererinfo.rd_can = pubPageUrl;
}
payload.referrer_detection = refererinfo;
}

Expand Down Expand Up @@ -802,6 +806,13 @@ function bidToTag(bid) {
}
if (bid.params.position) {
tag.position = { 'above': 1, 'below': 2 }[bid.params.position] || 0;
} else {
let mediaTypePos = deepAccess(bid, `mediaTypes.banner.pos`) || deepAccess(bid, `mediaTypes.video.pos`);
// only support unknown, atf, and btf values for position at this time
if (mediaTypePos === 0 || mediaTypePos === 1 || mediaTypePos === 3) {
// ortb spec treats btf === 3, but our system interprets btf === 2; so converting the ortb value here for consistency
tag.position = (mediaTypePos === 3) ? 2 : mediaTypePos;
}
}
if (bid.params.trafficSourceCode) {
tag.traffic_source_code = bid.params.trafficSourceCode;
Expand Down
16 changes: 11 additions & 5 deletions modules/betweenBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export const spec = {
mediaType: serverResponse.body[i].mediaType,
ttl: serverResponse.body[i].ttl,
creativeId: serverResponse.body[i].creativeid,
currency: serverResponse.body[i].currency || 'RUB',
currency: serverResponse.body[i].currency || 'USD',
netRevenue: serverResponse.body[i].netRevenue || true,
ad: serverResponse.body[i].ad,
meta: {
Expand Down Expand Up @@ -158,10 +158,16 @@ export const spec = {
// type: 'iframe',
// url: 'https://acdn.adnxs.com/dmp/async_usersync.html'
// });
syncs.push({
type: 'iframe',
url: 'https://ads.betweendigital.com/sspmatch-iframe'
});
syncs.push(
{
type: 'iframe',
url: 'https://ads.betweendigital.com/sspmatch-iframe'
},
{
type: 'image',
url: 'https://ads.betweendigital.com/sspmatch'
}
);
return syncs;
}
}
Expand Down
92 changes: 92 additions & 0 deletions modules/biddoBidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER} from '../src/mediaTypes.js';

const BIDDER_CODE = 'biddo';
const ENDPOINT_URL = 'https://ad.adopx.net/delivery/impress';

export const spec = {
code: BIDDER_CODE,
supportedMediaTypes: [BANNER],
/**
* Determines whether or not the given bid request is valid.
*
* @param {BidRequest} bidRequest The bid request params to validate.
* @return boolean True if this is a valid bid request, and false otherwise.
*/
isBidRequestValid: function(bidRequest) {
return !!bidRequest.params.zoneId;
},
/**
* Make a server request from the list of BidRequests.
*
* @param {Array<BidRequest>} validBidRequests an array of bid requests
* @return ServerRequest Info describing the request to the server.
*/
buildRequests: function(validBidRequests) {
let serverRequests = [];

validBidRequests.forEach(bidRequest => {
const sizes = bidRequest.mediaTypes.banner.sizes;

sizes.forEach(([width, height]) => {
bidRequest.params.requestedSizes = [width, height];

const payload = {
ctype: 'div',
pzoneid: bidRequest.params.zoneId,
width,
height,
};

const payloadString = Object.keys(payload).map(k => k + '=' + encodeURIComponent(payload[k])).join('&');

serverRequests.push({
method: 'GET',
url: ENDPOINT_URL,
data: payloadString,
bidderRequest: bidRequest,
});
});
});

return serverRequests;
},
/**
* Unpack the response from the server into a list of bids.
*
* @param {ServerResponse} serverResponse A successful response from the server.
* @param {BidRequest} bidderRequest A matched bid request for this response.
* @return Array<BidResponse> An array of bids which were nested inside the server.
*/
interpretResponse: function(serverResponse, {bidderRequest}) {
const response = serverResponse.body;
const bidResponses = [];

if (response && response.template && response.template.html) {
const {bidId} = bidderRequest;
const [width, height] = bidderRequest.params.requestedSizes;

const bidResponse = {
requestId: bidId,
cpm: response.hb.cpm,
creativeId: response.banner.hash,
currency: 'USD',
netRevenue: response.hb.netRevenue,
ttl: 600,
ad: response.template.html,
mediaType: 'banner',
meta: {
advertiserDomains: response.hb.adomains || [],
},
width,
height,
};

bidResponses.push(bidResponse);
}

return bidResponses;
},
}

registerBidder(spec);
30 changes: 30 additions & 0 deletions modules/biddoBidAdapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Overview

```
Module Name: Biddo Bidder Adapter
Module Type: Bidder Adapter
Maintainer: contact@biddo.net
```

# Description

Module that connects to Invamia demand sources.

# Test Parameters

```
const adUnits = [{
code: 'test-div',
mediaTypes: {
banner: {
sizes: [[300, 250]],
},
},
bids: [{
bidder: 'biddo',
params: {
zoneId: 7254,
},
}],
}];
```
Loading

0 comments on commit 383fb31

Please sign in to comment.