Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
jrosendahl committed Oct 16, 2020
2 parents 6a8813f + 926ccc6 commit 90fa163
Show file tree
Hide file tree
Showing 84 changed files with 5,238 additions and 409 deletions.
85 changes: 65 additions & 20 deletions PR_REVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,93 @@ If the PR is for a standard bid adapter or a standard analytics adapter, just th
For modules and core platform updates, the initial reviewer should request an additional team member to review as a sanity check. Merge should only happen when the PR has 2 `LGTM` from the core team and a documentation PR if required.

### General PR review Process
- All required global and bidder-adapter rules defined in the [Module Rules](https://docs.prebid.org/dev-docs/module-rules.html) must be followed. Please review these rules often - we depend on reviewers to enforce them.
- Checkout the branch (these instructions are available on the github PR page as well).
- Verify PR is a single change type. Example, refactor OR bugfix. If more than 1 type, ask submitter to break out requests.
- Verify code under review has at least 80% unit test coverage. If legacy code has no unit test coverage, ask for unit tests to be included in the PR.
- Verify code under review has at least 80% unit test coverage. If legacy code doesn't have enough unit test coverage, require that additional unit tests to be included in the PR.
- Verify tests are green in Travis-ci + local build by running `gulp serve` | `gulp test`
- Verify no code quality violations are present from linting (should be reported in terminal)
- Make sure the code is not setting cookies or localstorage directly -- it must use the `StorageManager`.
- Review for obvious errors or bad coding practice / use best judgement here.
- If the change is a new feature / change to core prebid.js - review the change with a Tech Lead on the project and make sure they agree with the nature of change.
- 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):
- 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`
- If they support the US Privacy consentManagementUsp module, add `usp_supported: true`
- If they support one or more userId modules, add `userId: (list of supported vendors)`
- If they support video and/or native mediaTypes add `media_types: video, native`. Note that display is added by default. If you don't support display, add "no-display" as the first entry, e.g. `media_types: no-display, native`
- If they support COPPA, add `coppa_supported: true`
- If they support SChain, add `schain_supported: true`
- If their bidder doesn't work well with safeframed creatives, add `safeframes_ok: false`. This will alert publishers to not use safeframed creatives when creating the ad server entries for their bidder.
- If they're setting a deal ID in some scenarios, add `bidder_supports_deals: true`
- If they have an IAB Global Vendor List ID, add `gvl_id: ID`. There's no default.
- 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.
- If all above is good, add a `LGTM` comment and, if the change is in PBS-core or is an important module like the prebidServerBidAdapter, request 1 additional core member to review.
- Once there are 2 `LGTM` on the PR, merge to master
- Add a line into the [draft release](https://github.com/prebid/Prebid.js/releases) notes for this submission. If no draft release is available, create one using [this template]( https://gist.github.com/mkendall07/c3af6f4691bed8a46738b3675cb5a479)
- Add the PR to the appropriate project board (I.E. 1.23.0 Release) for the week, [see](https://github.com/prebid/Prebid.js/projects)

### New Adapter or updates to adapter process
- Follow steps above for general review process. In addition, please verify the following:
### Reviewing a New or Updated Bid Adapter
Documentation they're supposed to be following is https://docs.prebid.org/dev-docs/bidder-adaptor.html

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 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.
- All required global and bidder-adapter rules defined in the [Module Rules](https://docs.prebid.org/dev-docs/module-rules.html) must be followed. Please review these rules often - we depend on reviewers to enforce them.
- 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).
- 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 `getFloors()` 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.
- If they're getting the COPPA flag, it must come from config.getConfig('coppa');

- 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`
- If they support the US Privacy consentManagementUsp module, add `usp_supported: true`
- If they support one or more userId modules, add `userId: (list of supported vendors)`
- If they support video and/or native mediaTypes add `media_types: video, native`. Note that display is added by default. If you don't support display, add "no-display" as the first entry, e.g. `media_types: no-display, native`
- If they support COPPA, add `coppa_supported: true`
- If they support SChain, add `schain_supported: true`
- If their bidder doesn't work well with safeframed creatives, add `safeframes_ok: false`. This will alert publishers to not use safeframed creatives when creating the ad server entries for their bidder.
- If they're setting a deal ID in some scenarios, add `bidder_supports_deals: true`
- If they have an IAB Global Vendor List ID, add `gvl_id: ID`. There's no default.
- After a new adapter is approved, let the submitter know they may open a PR in the [headerbid-expert repository](https://github.com/prebid/headerbid-expert) to have their adapter recognized by the [Headerbid Expert extension](https://chrome.google.com/webstore/detail/headerbid-expert/cgfkddgbnfplidghapbbnngaogeldmop). The PR should be to the [bidder patterns file](https://github.com/prebid/headerbid-expert/blob/master/bidderPatterns.js), adding an entry with their adapter's name and the url the adapter uses to send and receive bid responses.

### Reviewing a New or Updated Analytics Adapter
Documentation they're supposed to be following is https://docs.prebid.org/dev-docs/integrate-with-the-prebid-analytics-api.html

No additional steps above the general review process and making sure it conforms to the [Module Rules](https://docs.prebid.org/dev-docs/module-rules.html).

Make sure there's a docs pull request

### Reviewing a New or Updated User ID Sub-Module
Documentation they're supposed to be following is https://docs.prebid.org/dev-docs/modules/userId.html#id-providers

Follow steps above for general review process. In addition:
- Try running the new user ID module with a basic config and confirm it hits the endpoint and stores the results.
- the filename should be camel case ending with `IdSystem` (e.g. `myCompanyIdSystem.js`)
- the `const MODULE_NAME` value should be camel case ending with `Id` (e.g. `myCompanyId` )
- the response of the `decode` method should be an object with the key being ideally camel case similar to the module name and ending in `id` or `Id`, but in some cases this value is a shortened name and sometimes with the `id` part being all lowercase, provided there are no other uppercase letters. if there's no id or it's an invalid object, the response should be `undefined`. example "valid" values (although this is more style than a requirement)
- `mcid`
- `mcId`
- `myCompanyId`
- make sure they've added references of their new module everywhere required:
- modules/.submodules.json
- modules/userId/eids.js
- modules/userId/eids.md
- modules/userId/userId.md
- tests can go either within the userId_spec.js file or in their own _spec file if they wish
- GVLID is recommended in the *IdSystem file if they operate in EU
- make sure example configurations align to the actual code (some modules use the userId storage settings and allow pub configuration, while others handle reading/writing cookies on their own, so should not include the storage params in examples)
- the 3 available methods (getId, extendId, decode) should be used as they were intended
- decode (required method) should not be making requests to retrieve a new ID, it should just be decoding a response
- extendId (optional method) should not be making requests to retrieve a new ID, it should just be adding additional data to the id object
- getId (required method) should be the only method that gets a new ID (from ajax calls or a cookie/local storage). this ensures that decode and extend do not unnecessarily delay the auction in places where it is not expected.
- in the eids.js file, the source should be the actual domain of the provider, not a made up domain.
- in the eids.js file, the key in the array should be the same value as the key in the decode function
- make sure all supported config params align in the submodule js file and the docs / examples
- make sure there's a docs pull request

### Reviewing a New or Updated Real-Time-Data Sub-Module
Documentation they're supposed to be following is https://docs.prebid.org/dev-docs/add-rtd-submodule.html

Follow steps above for general review process. In addition:
- The RTD Provider must include a `providerRtdProvider.md` file. This file must have example parameters and document a sense of what to expect: what should change in the bidrequest, or what targeting data should be added?
- Try running the new sub-module and confirm the provided test parameters.
- Make sure the sub-module is making HTTP requests as early as possible, but not more often than needed.
- Consider whether the kind of data the module is obtaining could have privacy implications. If so, make sure they're utilizing the `consent` data passed to them.
- make sure there's a docs pull request

## Ticket Coordinator

Each week, Prebid Org assigns one person to keep an eye on incoming issues and PRs. Every Monday morning a reminder is
Expand Down
5 changes: 4 additions & 1 deletion integrationExamples/gpt/userId_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,10 @@
},
{
name: "quantcastId"
}
},
{
name: "criteo"
},
],
syncDelay: 5000,
auctionDelay: 1000
Expand Down
4 changes: 3 additions & 1 deletion modules/.submodules.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"intentIqIdSystem",
"zeotapIdPlusIdSystem",
"haloIdSystem",
"quantcastIdSystem"
"quantcastIdSystem",
"idxIdSystem",
"fabrickIdSystem"
],
"adpod": [
"freeWheelAdserverVideo",
Expand Down
25 changes: 18 additions & 7 deletions modules/adtelligentBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,23 @@ import { Renderer } from '../src/Renderer.js';
import find from 'core-js-pure/features/array/find.js';

const subdomainSuffixes = ['', 1, 2];
const getUri = (function () {
let num = 0;
return function () {
return 'https://ghb' + subdomainSuffixes[num++ % subdomainSuffixes.length] + '.adtelligent.com/v2/auction/'
const AUCTION_PATH = '/v2/auction/';
const PROTOCOL = 'https://';
const HOST_GETTERS = {
default: (function () {
let num = 0;
return function () {
return 'ghb' + subdomainSuffixes[num++ % subdomainSuffixes.length] + '.adtelligent.com'
}
}()),
appaloosa: function () {
return 'hb.appaloosa.media'
}
}())
}
const getUri = function (bidderCode) {
let getter = HOST_GETTERS[bidderCode] || HOST_GETTERS['default'];
return PROTOCOL + getter() + AUCTION_PATH
}
const OUTSTREAM_SRC = 'https://player.adtelligent.com/outstream-unit/2.01/outstream.min.js';
const BIDDER_CODE = 'adtelligent';
const OUTSTREAM = 'outstream';
Expand All @@ -21,7 +32,7 @@ const syncsCache = {};
export const spec = {
code: BIDDER_CODE,
gvlid: 410,
aliases: ['onefiftytwomedia', 'selectmedia'],
aliases: ['onefiftytwomedia', 'selectmedia', 'appaloosa'],
supportedMediaTypes: [VIDEO, BANNER],
isBidRequestValid: function (bid) {
return !!utils.deepAccess(bid, 'params.aid');
Expand Down Expand Up @@ -82,7 +93,7 @@ export const spec = {
data: Object.assign({}, tag, { BidRequests: bids }),
adapterRequest,
method: 'POST',
url: getUri()
url: getUri(adapterRequest.bidderCode)
};
})
},
Expand Down
26 changes: 14 additions & 12 deletions modules/adyoulikeBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as utils from '../src/utils.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { config } from '../src/config.js';
import find from 'core-js-pure/features/array/find.js';

const VERSION = '1.0';
Expand Down Expand Up @@ -104,15 +105,6 @@ function getHostname(bidderRequest) {
return '';
}

/* Get current page referrer url */
function getReferrerUrl(bidderRequest) {
let referer = '';
if (bidderRequest && bidderRequest.refererInfo) {
referer = bidderRequest.refererInfo.referer;
}
return referer;
}

/* Get current page canonical url */
function getCanonicalUrl() {
let link;
Expand Down Expand Up @@ -155,16 +147,26 @@ function createEndpoint(bidRequests, bidderRequest) {
function createEndpointQS(bidderRequest) {
const qs = {};

const ref = getReferrerUrl(bidderRequest);
if (ref) {
qs.RefererUrl = encodeURIComponent(ref);
if (bidderRequest) {
const ref = bidderRequest.refererInfo;
if (ref) {
qs.RefererUrl = encodeURIComponent(ref.referer);
if (ref.numIframes > 0) {
qs.SafeFrame = true;
}
}
}

const can = getCanonicalUrl();
if (can) {
qs.CanonicalUrl = encodeURIComponent(can);
}

const domain = config.getConfig('publisherDomain');
if (domain) {
qs.PublisherDomain = encodeURIComponent(domain);
}

return qs;
}

Expand Down
32 changes: 32 additions & 0 deletions modules/appnexusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ export const spec = {
const memberIdBid = find(bidRequests, hasMemberId);
const member = memberIdBid ? parseInt(memberIdBid.params.member, 10) : 0;
const schain = bidRequests[0].schain;
const omidSupport = find(bidRequests, hasOmidSupport);

const payload = {
tags: [...tags],
Expand All @@ -168,6 +169,13 @@ export const spec = {
schain: schain
};

if (omidSupport) {
payload['iab_support'] = {
omidpn: 'Appnexus',
omidpv: '$prebid.version$'
}
}

if (member > 0) {
payload.member_id = member;
}
Expand Down Expand Up @@ -766,16 +774,27 @@ function bidToTag(bid) {
type = (utils.isArray(type)) ? type[0] : type;
tag.video[param] = VIDEO_MAPPING[param][type];
break;
// Deprecating tags[].video.frameworks in favor of tags[].video_frameworks
case 'frameworks':
break;
default:
tag.video[param] = bid.params.video[param];
}
});

if (bid.params.video.frameworks && utils.isArray(bid.params.video.frameworks)) {
tag['video_frameworks'] = bid.params.video.frameworks;
}
}

if (bid.renderer) {
tag.video = Object.assign({}, tag.video, { custom_renderer_present: true });
}

if (bid.params.frameworks && utils.isArray(bid.params.frameworks)) {
tag['banner_frameworks'] = bid.params.frameworks;
}

let adUnit = find(auctionManager.getAdUnits(), au => bid.transactionId === au.transactionId);
if (adUnit && adUnit.mediaTypes && adUnit.mediaTypes.banner) {
tag.ad_types.push(BANNER);
Expand Down Expand Up @@ -844,6 +863,19 @@ function hasAdPod(bid) {
);
}

function hasOmidSupport(bid) {
let hasOmid = false;
const bidderParams = bid.params;
const videoParams = bid.params.video;
if (bidderParams.frameworks && utils.isArray(bidderParams.frameworks)) {
hasOmid = includes(bid.params.frameworks, 6);
}
if (!hasOmid && videoParams && videoParams.frameworks && utils.isArray(videoParams.frameworks)) {
hasOmid = includes(bid.params.video.frameworks, 6);
}
return hasOmid;
}

/**
* Expand an adpod placement into a set of request objects according to the
* total adpod duration and the range of duration seconds. Sets minduration/
Expand Down
22 changes: 15 additions & 7 deletions modules/atsAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,16 @@ let atsAnalyticsAdapter = Object.assign(adapter(
callHandler(eventType, args);
}
if (eventType === CONSTANTS.EVENTS.AUCTION_END) {
// send data to ats analytic endpoint
try {
let dataToSend = {'Data': atsAnalyticsAdapter.context.events};
let strJSON = JSON.stringify(dataToSend);
ajax(atsAnalyticsAdapter.context.host, function () {
}, strJSON, {method: 'POST', contentType: 'application/json'});
} catch (err) {
if (atsAnalyticsAdapter.shouldFireRequest()) {
// send data to ats analytic endpoint
try {
let dataToSend = {'Data': atsAnalyticsAdapter.context.events};
let strJSON = JSON.stringify(dataToSend);
utils.logInfo('atsAnalytics tried to send analytics data!');
ajax(atsAnalyticsAdapter.context.host, function () {
}, strJSON, {method: 'POST', contentType: 'application/json'});
} catch (err) {
}
}
}
}
Expand All @@ -141,6 +144,11 @@ let atsAnalyticsAdapter = Object.assign(adapter(
// save the base class function
atsAnalyticsAdapter.originEnableAnalytics = atsAnalyticsAdapter.enableAnalytics;

// add check to not fire request every time, but instead to send 1/10 events
atsAnalyticsAdapter.shouldFireRequest = function () {
return (Math.floor((Math.random() * 11)) === 10);
}

// override enableAnalytics so we can get access to the config passed in from the page
atsAnalyticsAdapter.enableAnalytics = function (config) {
if (!config.options.pid) {
Expand Down
5 changes: 3 additions & 2 deletions modules/britepoolIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ export const britepoolIdSubmodule = {
/**
* Performs action to obtain id and return a value in the callback's response argument
* @function
* @param {SubmoduleParams} [submoduleConfigParams]
* @param {SubmoduleConfig} [submoduleConfig]
* @param {ConsentData|undefined} consentData
* @returns {function(callback:function)}
*/
getId(submoduleConfigParams, consentData) {
getId(submoduleConfig, consentData) {
const submoduleConfigParams = (submoduleConfig && submoduleConfig.params) || {};
const { params, headers, url, getter, errors } = britepoolIdSubmodule.createParams(submoduleConfigParams, consentData);
let getterResponse = null;
if (typeof getter === 'function') {
Expand Down
Loading

0 comments on commit 90fa163

Please sign in to comment.