Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/prebid/Prebid.js into Nob…
Browse files Browse the repository at this point in the history
…idVersion1.2.0

* 'master' of https://github.com/prebid/Prebid.js: (22 commits)
  fix lint errors in unit test file (prebid#4702)
  Add Revcontent Adapter (prebid#4654)
  Changed data structure in Platform One Analytic Adapter (prebid#4647)
  increment pre version
  Prebid 3.2.0 Release
  Add static API option to the consentManagementUsp module. (prebid#4685)
  replace all xhr stubs with global xhr stub to prevent all requests (prebid#4687)
  Add CCPA us_privacy support to spotxBidAdapter (prebid#4689)
  ucfunnel adapter support CCPA and remove utils.js in adapter (prebid#4541)
  freewheelSSPBidAdapter  (prebid#4645)
  Add CCPA support to Beachfront adapter (prebid#4673)
  add seedingAlliance Adapter (prebid#4614)
  Changed analytics data structure in YuktaMedia Analytic Adapter (prebid#4659)
  Add eplanning adapter for prebid 3.0 compliant and CCPA and GDPR support (prebid#4643)
  Bidder schain support (prebid#4551)
  Added CCPA support and GDPR compliance to Cedato adapter (prebid#4683)
  pass us privacy consent string to request (prebid#4581)
  Prebid 3 Admixer (prebid#4615)
  Pass uspConsent in bidRequest (prebid#4675)
  Advertly: New Bidder Adapter Submission (prebid#4496)
  ...
  • Loading branch information
redaguermas committed Jan 8, 2020
2 parents ff3aaa7 + 3049200 commit cb7a68d
Show file tree
Hide file tree
Showing 93 changed files with 6,554 additions and 737 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ When you are adding code to Prebid.js, or modifying code that isn't covered by a
- e.g., use Chai assertions to check that the expected output is equal to the actual output
- Test the public interface, not the internal implementation
- If you need to check `adloader.loadExternalScript` in a test, use a `stub` rather than a `spy`. `spy`s trigger a network call which can result in a `script error` and cause unrelated unit tests to fail. `stub`s will let you gather information about the `adloader.loadExternalScript` call without affecting external resources
- If your test makes ajax requests, use the global xhr stub in `test/mocks/xhr`. Do not use your own `sinon.useFakeXMLHttpRequest()` or `sinon.createFakeServer()`.
- When writing tests you may use ES2015 syntax if desired

### Test Examples
Expand Down
4 changes: 3 additions & 1 deletion PR_REVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ For modules and core platform updates, the initial reviewer should request an ad
- If the change results in needing updates to docs (such as public API change, module interface etc), add a label for "needs docs" and inform the submitter they must submit a docs PR to update the appropriate area of Prebid.org **before the PR can merge**. Help them with finding where the docs are located on prebid.org if needed.
- Below are some examples of bidder specific updates that should require docs update (in their dev-docs/bidders/bidder.md file):
- Add support for GDPR consentManagement module > add `gdpr_supported: true`
- Add support for US Privacy consentManagement module > add `usp_supported: true`
- Add support for userId module > add `userId: pubCommon, digitrust, newProviderHere`
- Add support for video and/or native mediaTypes > add `media_types: video, native`
- Add support for COPPA > add `coppa_supported: true`
- Add support for SChain > add `schain_supported: true`
- If all above is good, add a `LGTM` comment and request 1 additional core member to review.
- Once there is 2 `LGTM` on the PR, merge to master
- Ask the submitter to add a PR for documentation if applicable.
Expand All @@ -29,7 +31,7 @@ For modules and core platform updates, the initial reviewer should request an ad
- Follow steps above for general review process. In addition, please verify the following:
- Verify that bidder has submitted valid bid params and that bids are being received.
- Verify that bidder is not manipulating the prebid.js auction in any way or doing things that go against the principles of the project. If unsure check with the Tech Lead.
- Verify that the bidder is being as efficient as possible, ideally not loading an external library, however if they do load a library it should be cached.
- Verify that the bidder is being as efficient as possible, ideally not loading an external library, however if they do load a library it should be cached.
- Verify that code re-use is being done properly and that changes introduced by a bidder don't impact other bidders.
- If the adapter being submitted is an alias type, check with the bidder contact that is being aliased to make sure it's allowed.
- If the adapter is triggering any user syncs make sure they are using the user sync module in the Prebid.js core.
Expand Down
Empty file modified integrationExamples/gpt/hello_world.html
100644 → 100755
Empty file.
109 changes: 109 additions & 0 deletions integrationExamples/gpt/revcontent_example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<html>

<head>
<link rel="icon" type="image/png" href="/favicon.png">
<script async src="//www.googletagservices.com/tag/js/gpt.js"></script>
<script async src="../../build/dev/prebid.js"></script>
<script>
/*
Supported sizes:
----------------
300x250 - Medium rectangle
728x90 - Leaderboard
300x600 - Half page or large skyscraper
*/
var size = {width: 300, height: 250};

var PREBID_TIMEOUT = 10000;
var FAILSAFE_TIMEOUT = 30000;

var adUnits = [{
code: '/19968336/header-bid-tag-1',
mediaTypes: {
native: {
image: {
required: false
},
title: {
required: false,
len: 140
},
clickUrl: {
required: false
},
sponsoredBy: {
id: 5,
name: 'data',
type: 1
}
}
},
bids: [{
bidder: 'revcontent',
params: {
size: size,
apiKey: '8a33fa9cf220ae685dcc3544f847cdda858d3b1c',
userId: 673,
domain: 'test.com',
endpoint: 'trends-s0.revcontent.com'
}
}]
}];

// ======== DO NOT EDIT BELOW THIS LINE =========== //
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function() {
googletag.pubads().disableInitialLoad();
});

var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];

pbjs.que.push(function() {
pbjs.addAdUnits(adUnits);
pbjs.requestBids({
bidsBackHandler: initAdserver,
timeout: PREBID_TIMEOUT
});
});

function initAdserver() {
if (pbjs.initAdserverSet) return;
pbjs.initAdserverSet = true;
googletag.cmd.push(function() {
pbjs.setTargetingForGPTAsync && pbjs.setTargetingForGPTAsync();
googletag.pubads().refresh();
});
}

// in case PBJS doesn't load
setTimeout(function() {
initAdserver();
}, FAILSAFE_TIMEOUT);

googletag.cmd.push(function() {
googletag.defineSlot('/19968336/header-bid-tag-1', [[size.width, size.height]], 'div-1')
.addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});

</script>

</head>

<body>
<h2>Basic Prebid.js Example</h2>
<h5>Div-1</h5>
<div id='div-1'>
<script type='text/javascript'>
googletag.cmd.push(function() {
googletag.display('div-1');
});

</script>
</div>
</body>

</html>
64 changes: 64 additions & 0 deletions modules/admixerBidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import * as utils from '../src/utils';
import {registerBidder} from '../src/adapters/bidderFactory';

const BIDDER_CODE = 'admixer';
const ALIASES = ['go2net'];
const ENDPOINT_URL = 'https://inv-nets.admixer.net/prebid.1.0.aspx';
export const spec = {
code: BIDDER_CODE,
aliases: ALIASES,
supportedMediaTypes: ['banner', 'video'],
/**
* Determines whether or not the given bid request is valid.
*/
isBidRequestValid: function (bid) {
return !!bid.params.zone;
},
/**
* Make a server request from the list of BidRequests.
*/
buildRequests: function (validRequest, bidderRequest) {
const payload = {
imps: [],
referrer: encodeURIComponent(bidderRequest.refererInfo.referer),
};
validRequest.forEach((bid) => {
payload.imps.push(bid);
});
const payloadString = JSON.stringify(payload);
return {
method: 'GET',
url: ENDPOINT_URL,
data: `data=${payloadString}`,
};
},
/**
* Unpack the response from the server into a list of bids.
*/
interpretResponse: function (serverResponse, bidRequest) {
const bidResponses = [];
// loop through serverResponses {
try {
serverResponse = serverResponse.body;
serverResponse.forEach((bidResponse) => {
const bidResp = {
requestId: bidResponse.bidId,
cpm: bidResponse.cpm,
width: bidResponse.width,
height: bidResponse.height,
ad: bidResponse.ad,
ttl: bidResponse.ttl,
creativeId: bidResponse.creativeId,
netRevenue: bidResponse.netRevenue,
currency: bidResponse.currency,
vastUrl: bidResponse.vastUrl,
};
bidResponses.push(bidResp);
});
} catch (e) {
utils.logError(e);
}
return bidResponses;
}
};
registerBidder(spec);
4 changes: 2 additions & 2 deletions modules/adponeBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {BANNER} from '../src/mediaTypes';
import {registerBidder} from '../src/adapters/bidderFactory';
import {triggerPixel} from '../src/utils';

const ADPONE_CODE = 'adpone';
const ADPONE_ENDPOINT = 'https://rtb.adpone.com/bid-request';
Expand Down Expand Up @@ -87,8 +88,7 @@ export const spec = {
onBidWon: bid => {
const bidString = JSON.stringify(bid);
const encodedBuf = window.btoa(bidString);
const img = new Image(1, 1);
img.src = `https://rtb.adpone.com/prebid/analytics?q=${encodedBuf}`;
triggerPixel(`https://rtb.adpone.com/prebid/analytics?q=${encodedBuf}`);
},

};
Expand Down
127 changes: 127 additions & 0 deletions modules/advertlyBidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
import { registerBidder } from '../src/adapters/bidderFactory';
import { config } from '../src/config';
import * as utils from '../src/utils';
import {BANNER, VIDEO} from '../src/mediaTypes';
import { ajax } from '../src/ajax';
import {Renderer} from '../src/Renderer';

const SUPPORTED_AD_TYPES = [BANNER, VIDEO];
const BIDDER_CODE = 'advertly';
const DOMAIN = 'https://api.advertly.com/';
const RENDERER_URL = '//acdn.adnxs.com/video/outstream/ANOutstreamVideo.js';

function isBidRequestValid(bid) {
return (typeof bid.params !== 'undefined' && parseInt(utils.getValue(bid.params, 'publisherId')) > 0);
}

function buildRequests(validBidRequests) {
return {
method: 'POST',
url: DOMAIN + 'www/admin/plugins/Prebid/getAd.php',
options: {
withCredentials: false,
crossOrigin: true
},
data: validBidRequests,
};
}

function interpretResponse(serverResponse, request) {
const response = serverResponse.body;
const bidResponses = [];
var bidRequestResponses = [];
utils._each(response, function(bidAd) {
let bnd = {};
Object.assign(bnd, bidAd);
bnd.adResponse = {
content: bidAd.vastXml,
height: bidAd.height,
width: bidAd.width
};
bnd.ttl = config.getConfig('_bidderTimeout')
bnd.renderer = bidAd.context === 'outstream' ? createRenderer(bidAd, RENDERER_URL) : undefined;
bidResponses.push(bnd);
});

bidRequestResponses.push({
function: 'saveResponses',
request: request,
response: bidResponses
});
sendResponseToServer(bidRequestResponses);
return bidResponses;
}

function outstreamRender(bidAd) {
bidAd.renderer.push(() => {
window.ANOutstreamVideo.renderAd({
sizes: [bidAd.width, bidAd.height],
width: bidAd.width,
height: bidAd.height,
targetId: bidAd.adUnitCode,
adResponse: bidAd.adResponse,
rendererOptions: {
showVolume: false,
allowFullscreen: false
}
});
});
}

function createRenderer(bidAd, url) {
const renderer = Renderer.install({
id: bidAd.adUnitCode,
url: url,
loaded: false,
config: {'player_height': bidAd.height, 'player_width': bidAd.width},
adUnitCode: bidAd.adUnitCode
});
try {
renderer.setRender(outstreamRender);
} catch (err) {
utils.logWarn('Prebid Error calling setRender on renderer', err);
}
return renderer;
}

function onBidWon(bid) {
let wonBids = [];
wonBids.push(bid);
wonBids[0].function = 'onBidWon';
sendResponseToServer(wonBids);
}

function onTimeout(details) {
details.unshift({ 'function': 'onTimeout' });
sendResponseToServer(details);
}

function sendResponseToServer(data) {
ajax(DOMAIN + 'www/admin/plugins/Prebid/tracking/track.php', null, JSON.stringify(data), {
withCredentials: false,
method: 'POST',
crossOrigin: true
});
}

function getUserSyncs(syncOptions) {
if (syncOptions.iframeEnabled) {
return [{
type: 'iframe',
url: DOMAIN + 'www/admin/plugins/Prebid/userSync.php'
}];
}
}

export const spec = {
code: BIDDER_CODE,
supportedMediaTypes: SUPPORTED_AD_TYPES,
isBidRequestValid,
buildRequests,
interpretResponse,
getUserSyncs,
onBidWon,
onTimeout
};

registerBidder(spec);
Loading

0 comments on commit cb7a68d

Please sign in to comment.