From 77773599e7cde203dce6fccab29164feaa78049d Mon Sep 17 00:00:00 2001
From: astraone-ssp <57891367+astraone-ssp@users.noreply.github.com>
Date: Thu, 5 Dec 2019 11:08:49 +0300
Subject: [PATCH 01/41] Added AstraOne adapter (#4475)
* Added AstraOne adapter
* Fixed an argument in function createRenderer
* Added unit tests. Added example with GPT in the documentation. Removed bid renderer.
* Fixed a small typo
---
modules/astraoneBidAdapter.js | 140 +++++++++++++
modules/astraoneBidAdapter.md | 198 +++++++++++++++++
test/spec/modules/astraoneBidAdapter_spec.js | 210 +++++++++++++++++++
3 files changed, 548 insertions(+)
create mode 100644 modules/astraoneBidAdapter.js
create mode 100644 modules/astraoneBidAdapter.md
create mode 100644 test/spec/modules/astraoneBidAdapter_spec.js
diff --git a/modules/astraoneBidAdapter.js b/modules/astraoneBidAdapter.js
new file mode 100644
index 000000000000..efff699b0dc3
--- /dev/null
+++ b/modules/astraoneBidAdapter.js
@@ -0,0 +1,140 @@
+import * as utils from '../src/utils'
+import { registerBidder } from '../src/adapters/bidderFactory'
+import { BANNER } from '../src/mediaTypes'
+
+const BIDDER_CODE = 'astraone';
+const SSP_ENDPOINT = 'https://ssp.astraone.io/auction/prebid';
+const TTL = 60;
+
+function buildBidRequests(validBidRequests) {
+ return utils._map(validBidRequests, function(validBidRequest) {
+ const params = validBidRequest.params;
+ const bidRequest = {
+ bidId: validBidRequest.bidId,
+ transactionId: validBidRequest.transactionId,
+ sizes: validBidRequest.sizes,
+ placement: params.placement,
+ placeId: params.placeId,
+ imageUrl: params.imageUrl
+ };
+
+ return bidRequest;
+ })
+}
+
+function buildBid(bidData) {
+ const bid = {
+ requestId: bidData.bidId,
+ cpm: bidData.price,
+ width: bidData.width,
+ height: bidData.height,
+ creativeId: bidData.content.seanceId,
+ currency: bidData.currency,
+ netRevenue: true,
+ mediaType: BANNER,
+ ttl: TTL,
+ content: bidData.content
+ };
+
+ bid.ad = wrapAd(bid, bidData);
+
+ return bid;
+}
+
+function getMediaTypeFromBid(bid) {
+ return bid.mediaTypes && Object.keys(bid.mediaTypes)[0]
+}
+
+function wrapAd(bid, bidData) {
+ return `
+
+
+
+
+
+
+
+
+
+
+
+ `;
+}
+
+export const spec = {
+ code: BIDDER_CODE,
+ supportedMediaTypes: [BANNER],
+
+ /**
+ * Determines whether or not the given bid request is valid.
+ *
+ * @param {BidRequest} bid The bid params to validate.
+ * @return boolean True if this is a valid bid, and false otherwise.
+ */
+ isBidRequestValid(bid) {
+ return (
+ getMediaTypeFromBid(bid) === BANNER &&
+ !!bid.params.placeId &&
+ !!bid.params.imageUrl &&
+ !!bid.params.placement &&
+ (bid.params.placement === 'inImage')
+ );
+ },
+
+ /**
+ * Make a server request from the list of BidRequests.
+ *
+ * @param {validBidRequests[]} - an array of bids
+ * @return ServerRequest Info describing the request to the server.
+ */
+ buildRequests(validBidRequests, bidderRequest) {
+ const payload = {
+ url: bidderRequest.refererInfo.referer,
+ cmp: !!bidderRequest.gdprConsent,
+ bidRequests: buildBidRequests(validBidRequests)
+ };
+
+ if (payload.cmp) {
+ const gdprApplies = bidderRequest.gdprConsent.gdprApplies;
+ if (gdprApplies !== undefined) payload['ga'] = gdprApplies;
+ payload['cs'] = bidderRequest.gdprConsent.consentString;
+ }
+
+ const payloadString = JSON.stringify(payload);
+ return {
+ method: 'POST',
+ url: SSP_ENDPOINT,
+ data: payloadString,
+ options: {
+ contentType: 'application/json'
+ }
+ }
+ },
+
+ /**
+ * Unpack the response from the server into a list of bids.
+ *
+ * @param {ServerResponse} serverResponse A successful response from the server.
+ * @return {Bid[]} An array of bids which were nested inside the server.
+ */
+ interpretResponse: function(serverResponse) {
+ const serverBody = serverResponse.body;
+ if (serverBody && utils.isArray(serverBody)) {
+ return utils._map(serverBody, function(bid) {
+ return buildBid(bid);
+ });
+ } else {
+ return [];
+ }
+ }
+
+}
+registerBidder(spec);
diff --git a/modules/astraoneBidAdapter.md b/modules/astraoneBidAdapter.md
new file mode 100644
index 000000000000..0c7b79489a5c
--- /dev/null
+++ b/modules/astraoneBidAdapter.md
@@ -0,0 +1,198 @@
+# Overview
+
+
+**Module Name**: AstraOne Bidder Adapter
+**Module Type**: Bidder Adapter
+**Maintainer**: prebid@astraone.io
+
+# Description
+
+You can use this adapter to get a bid from AstraOne.
+Please reach out to your AstraOne account team before using this plugin to get placeId.
+The code below returns a demo ad.
+
+About us: https://astraone.io
+
+# Test Parameters
+```js
+var adUnits = [{
+ code: 'test-div',
+ mediaTypes: {
+ banner: {
+ sizes: [],
+ }
+ },
+ bids: [{
+ bidder: "astraone",
+ params: {
+ placement: "inImage",
+ placeId: "5af45ad34d506ee7acad0c26",
+ imageUrl: "https://creative.astraone.io/files/default_image-1-600x400.jpg"
+ }
+ }]
+}];
+```
+
+# Example page
+
+```html
+
+
+
+
+ Prebid.js Banner Example
+
+
+
+
+
+
+ Prebid.js InImage Banner Test
+
+
+
+
+
+
+
+
+```
+# Example page with GPT
+
+```html
+
+
+
+
+ Prebid.js Banner Example
+
+
+
+
+
+
+ Prebid.js Banner Ad Unit Test
+
+
+
+
+
+
+
+
+
+
+```
diff --git a/test/spec/modules/astraoneBidAdapter_spec.js b/test/spec/modules/astraoneBidAdapter_spec.js
new file mode 100644
index 000000000000..cd80e742b7d2
--- /dev/null
+++ b/test/spec/modules/astraoneBidAdapter_spec.js
@@ -0,0 +1,210 @@
+import { expect } from 'chai'
+import { spec } from 'modules/astraoneBidAdapter'
+
+function getSlotConfigs(mediaTypes, params) {
+ return {
+ params: params,
+ sizes: [],
+ bidId: '2df8c0733f284e',
+ bidder: 'astraone',
+ mediaTypes: mediaTypes,
+ transactionId: '31a58515-3634-4e90-9c96-f86196db1459'
+ }
+}
+
+describe('AstraOne Adapter', function() {
+ describe('isBidRequestValid method', function() {
+ const PLACE_ID = '5af45ad34d506ee7acad0c26';
+ const IMAGE_URL = 'https://creative.astraone.io/files/default_image-1-600x400.jpg';
+
+ describe('returns true', function() {
+ describe('when banner slot config has all mandatory params', () => {
+ describe('and placement has the correct value', function() {
+ const createBannerSlotConfig = placement => {
+ return getSlotConfigs(
+ { banner: {} },
+ {
+ placeId: PLACE_ID,
+ imageUrl: IMAGE_URL,
+ placement
+ }
+ )
+ }
+ const placements = ['inImage'];
+ placements.forEach(placement => {
+ it('should be ' + placement, function() {
+ const isBidRequestValid = spec.isBidRequestValid(
+ createBannerSlotConfig(placement)
+ )
+ expect(isBidRequestValid).to.equal(true)
+ })
+ })
+ })
+ })
+ })
+ describe('returns false', function() {
+ describe('when params are not correct', function() {
+ function createSlotconfig(params) {
+ return getSlotConfigs({ banner: {} }, params)
+ }
+ it('does not have the placeId.', function() {
+ const isBidRequestValid = spec.isBidRequestValid(
+ createSlotconfig({
+ imageUrl: IMAGE_URL,
+ placement: 'inImage'
+ })
+ )
+ expect(isBidRequestValid).to.equal(false)
+ })
+ it('does not have the imageUrl.', function() {
+ const isBidRequestValid = spec.isBidRequestValid(
+ createSlotconfig({
+ placeId: PLACE_ID,
+ placement: 'inImage'
+ })
+ )
+ expect(isBidRequestValid).to.equal(false)
+ })
+ it('does not have the placement.', function() {
+ const isBidRequestValid = spec.isBidRequestValid(
+ createSlotconfig({
+ placeId: PLACE_ID,
+ imageUrl: IMAGE_URL,
+ })
+ )
+ expect(isBidRequestValid).to.equal(false)
+ })
+ it('does not have a the correct placement.', function() {
+ const isBidRequestValid = spec.isBidRequestValid(
+ createSlotconfig({
+ placeId: PLACE_ID,
+ imageUrl: IMAGE_URL,
+ placement: 'something'
+ })
+ )
+ expect(isBidRequestValid).to.equal(false)
+ })
+ })
+ })
+ })
+
+ describe('buildRequests method', function() {
+ const bidderRequest = {
+ refererInfo: { referer: 'referer' }
+ }
+ const mandatoryParams = {
+ placeId: '5af45ad34d506ee7acad0c26',
+ imageUrl: 'https://creative.astraone.io/files/default_image-1-600x400.jpg',
+ placement: 'inImage'
+ }
+ const validBidRequests = [
+ getSlotConfigs({ banner: {} }, mandatoryParams)
+ ]
+ it('Url params should be correct ', function() {
+ const request = spec.buildRequests(validBidRequests, bidderRequest)
+ expect(request.method).to.equal('POST')
+ expect(request.url).to.equal('https://ssp.astraone.io/auction/prebid')
+ })
+
+ it('Common data request should be correct', function() {
+ const request = spec.buildRequests(validBidRequests, bidderRequest)
+ const data = JSON.parse(request.data)
+ expect(Array.isArray(data.bidRequests)).to.equal(true)
+ data.bidRequests.forEach(bid => {
+ expect(bid.placeId).to.equal('5af45ad34d506ee7acad0c26')
+ expect(typeof bid.imageUrl).to.equal('string')
+ })
+ })
+
+ describe('GDPR params', function() {
+ describe('when there are not consent management platform', function() {
+ it('cmp should be false', function() {
+ const request = spec.buildRequests(validBidRequests, bidderRequest)
+ const data = JSON.parse(request.data)
+ expect(data.cmp).to.equal(false)
+ })
+ })
+ describe('when there are consent management platform', function() {
+ it('cmps should be true and ga should not sended, when gdprApplies is undefined', function() {
+ bidderRequest['gdprConsent'] = {
+ gdprApplies: undefined,
+ consentString: 'consentString'
+ }
+ const request = spec.buildRequests(validBidRequests, bidderRequest)
+ const data = JSON.parse(request.data)
+ expect(data.cmp).to.equal(true)
+ expect(Object.keys(data).indexOf('data')).to.equal(-1)
+ expect(data.cs).to.equal('consentString')
+ })
+ it('cmps should be true and all gdpr parameters should be sended, when there are gdprApplies', function() {
+ bidderRequest['gdprConsent'] = {
+ gdprApplies: true,
+ consentString: 'consentString'
+ }
+ const request = spec.buildRequests(validBidRequests, bidderRequest)
+ const data = JSON.parse(request.data)
+ expect(data.cmp).to.equal(true)
+ expect(data.ga).to.equal(true)
+ expect(data.cs).to.equal('consentString')
+ })
+ })
+ })
+
+ describe('BidRequests params', function() {
+ const request = spec.buildRequests(validBidRequests, bidderRequest)
+ const data = JSON.parse(request.data)
+ const bidRequests = data.bidRequests
+ it('should request a Banner', function() {
+ const bannerBid = bidRequests[0]
+ expect(bannerBid.bidId).to.equal('2df8c0733f284e')
+ expect(bannerBid.transactionId).to.equal('31a58515-3634-4e90-9c96-f86196db1459')
+ expect(bannerBid.placeId).to.equal('5af45ad34d506ee7acad0c26')
+ })
+ })
+ })
+
+ describe('interpret response method', function() {
+ it('should return a void array, when the server response have not got bids.', function() {
+ const serverResponse = {
+ body: []
+ }
+ const bids = spec.interpretResponse(serverResponse)
+ expect(Array.isArray(bids)).to.equal(true)
+ expect(bids.length).to.equal(0)
+ })
+ describe('when the server response return a bid', function() {
+ describe('the bid is a banner', function() {
+ it('should return a banner bid', function() {
+ const serverResponse = {
+ body: [
+ {
+ bidId: '2df8c0733f284e',
+ price: 0.5,
+ currency: 'USD',
+ content: {
+ content: 'html',
+ actionUrls: {},
+ seanceId: '123123'
+ },
+ width: 100,
+ height: 100,
+ ttl: 360
+ }
+ ]
+ }
+ const bids = spec.interpretResponse(serverResponse)
+ expect(bids.length).to.equal(1)
+ expect(bids[0].requestId).to.equal('2df8c0733f284e')
+ expect(bids[0].creativeId).to.equal('123123')
+ expect(bids[0].cpm).to.equal(0.5)
+ expect(bids[0].width).to.equal(100)
+ expect(bids[0].height).to.equal(100)
+ expect(bids[0].currency).to.equal('USD')
+ expect(bids[0].netRevenue).to.equal(true)
+ expect(typeof bids[0].ad).to.equal('string')
+ expect(typeof bids[0].content).to.equal('object')
+ })
+ })
+ })
+ })
+})
From 8e12e5f436c6530ca620a616a76a2393aebf63ba Mon Sep 17 00:00:00 2001
From: Harshad Mane
Date: Fri, 6 Dec 2019 09:42:26 -0800
Subject: [PATCH 02/41] PubMatic bid adapter to support CCPA/USP (#4533)
* added support for pubcommon, digitrust, id5id
* added support for IdentityLink
* changed the source for id5
* added unit test cases
* changed source param for identityLink
* added CCPA/USP support in PubMatic adapter
---
modules/pubmaticBidAdapter.js | 12 +-
test/spec/modules/pubmaticBidAdapter_spec.js | 109 +++++++++++++++++++
2 files changed, 120 insertions(+), 1 deletion(-)
diff --git a/modules/pubmaticBidAdapter.js b/modules/pubmaticBidAdapter.js
index 34beb4d8745b..4281c4a449e3 100644
--- a/modules/pubmaticBidAdapter.js
+++ b/modules/pubmaticBidAdapter.js
@@ -917,6 +917,11 @@ export const spec = {
};
}
+ // CCPA
+ if (bidderRequest && bidderRequest.uspConsent) {
+ utils.deepSetValue(payload, 'regs.ext.us_privacy', bidderRequest.uspConsent);
+ }
+
// coppa compliance
if (config.getConfig('coppa') === true) {
utils.deepSetValue(payload, 'regs.coppa', 1);
@@ -1012,7 +1017,7 @@ export const spec = {
/**
* Register User Sync.
*/
- getUserSyncs: (syncOptions, responses, gdprConsent) => {
+ getUserSyncs: (syncOptions, responses, gdprConsent, uspConsent) => {
let syncurl = USYNCURL + publisherId;
// Attaching GDPR Consent Params in UserSync url
@@ -1021,6 +1026,11 @@ export const spec = {
syncurl += '&gdpr_consent=' + encodeURIComponent(gdprConsent.consentString || '');
}
+ // CCPA
+ if (uspConsent) {
+ syncurl += '&us_privacy=' + encodeURIComponent(uspConsent);
+ }
+
// coppa compliance
if (config.getConfig('coppa') === true) {
syncurl += '&coppa=1';
diff --git a/test/spec/modules/pubmaticBidAdapter_spec.js b/test/spec/modules/pubmaticBidAdapter_spec.js
index b2c2da99d233..764897b596b2 100644
--- a/test/spec/modules/pubmaticBidAdapter_spec.js
+++ b/test/spec/modules/pubmaticBidAdapter_spec.js
@@ -982,6 +982,43 @@ describe('PubMatic adapter', function () {
expect(data.imp[0].ext.pmZoneId).to.equal(bidRequests[0].params.pmzoneid.split(',').slice(0, 50).map(id => id.trim()).join()); // pmzoneid
});
+ it('Request params check with USP/CCPA Consent', function () {
+ let bidRequest = {
+ uspConsent: '1NYN'
+ };
+ let request = spec.buildRequests(bidRequests, bidRequest);
+ let data = JSON.parse(request.data);
+ expect(data.regs.ext.us_privacy).to.equal('1NYN');// USP/CCPAs
+ expect(data.at).to.equal(1); // auction type
+ expect(data.cur[0]).to.equal('USD'); // currency
+ expect(data.site.domain).to.be.a('string'); // domain should be set
+ expect(data.site.page).to.equal(bidRequests[0].params.kadpageurl); // forced pageURL
+ expect(data.site.publisher.id).to.equal(bidRequests[0].params.publisherId); // publisher Id
+ expect(data.user.yob).to.equal(parseInt(bidRequests[0].params.yob)); // YOB
+ expect(data.user.gender).to.equal(bidRequests[0].params.gender); // Gender
+ expect(data.device.geo.lat).to.equal(parseFloat(bidRequests[0].params.lat)); // Latitude
+ expect(data.device.geo.lon).to.equal(parseFloat(bidRequests[0].params.lon)); // Lognitude
+ expect(data.user.geo.lat).to.equal(parseFloat(bidRequests[0].params.lat)); // Latitude
+ expect(data.user.geo.lon).to.equal(parseFloat(bidRequests[0].params.lon)); // Lognitude
+ expect(data.ext.wrapper.wv).to.equal($$REPO_AND_VERSION$$); // Wrapper Version
+ expect(data.ext.wrapper.transactionId).to.equal(bidRequests[0].transactionId); // Prebid TransactionId
+ expect(data.ext.wrapper.wiid).to.equal(bidRequests[0].params.wiid); // OpenWrap: Wrapper Impression ID
+ expect(data.ext.wrapper.profile).to.equal(parseInt(bidRequests[0].params.profId)); // OpenWrap: Wrapper Profile ID
+ expect(data.ext.wrapper.version).to.equal(parseInt(bidRequests[0].params.verId)); // OpenWrap: Wrapper Profile Version ID
+
+ expect(data.imp[0].id).to.equal(bidRequests[0].bidId); // Prebid bid id is passed as id
+ expect(data.imp[0].bidfloor).to.equal(parseFloat(bidRequests[0].params.kadfloor)); // kadfloor
+ expect(data.imp[0].tagid).to.equal('/15671365/DMDemo'); // tagid
+ expect(data.imp[0].banner.w).to.equal(300); // width
+ expect(data.imp[0].banner.h).to.equal(250); // height
+ expect(data.imp[0].ext.pmZoneId).to.equal(bidRequests[0].params.pmzoneid.split(',').slice(0, 50).map(id => id.trim()).join()); // pmzoneid
+
+ // second request without USP/CCPA
+ let request2 = spec.buildRequests(bidRequests, {});
+ let data2 = JSON.parse(request2.data);
+ expect(data2.regs).to.equal(undefined);// USP/CCPAs
+ });
+
it('Request should have digitrust params', function() {
window.DigiTrust = {
getUser: function () {
@@ -2444,5 +2481,77 @@ describe('PubMatic adapter', function () {
expect(response[0].mediaType).to.equal('native');
});
});
+
+ describe('getUserSyncs', function() {
+ const syncurl = 'https://ads.pubmatic.com/AdServer/js/showad.js#PIX&kdntuid=1&p=5670';
+ let sandbox;
+ beforeEach(function () {
+ sandbox = sinon.sandbox.create();
+ });
+ afterEach(function() {
+ sandbox.restore();
+ })
+
+ it('execute only if iframeEnabled', function() {
+ expect(spec.getUserSyncs({ iframeEnabled: true }, {}, undefined, undefined)).to.deep.equal([{
+ type: 'iframe', url: syncurl
+ }]);
+ expect(spec.getUserSyncs({ iframeEnabled: false }, {}, undefined, undefined)).to.equal(undefined);
+ });
+
+ it('CCPA/USP', function() {
+ expect(spec.getUserSyncs({ iframeEnabled: true }, {}, undefined, '1NYN')).to.deep.equal([{
+ type: 'iframe', url: `${syncurl}&us_privacy=1NYN`
+ }]);
+ });
+
+ it('GDPR', function() {
+ expect(spec.getUserSyncs({ iframeEnabled: true }, {}, {gdprApplies: true, consentString: 'foo'}, undefined)).to.deep.equal([{
+ type: 'iframe', url: `${syncurl}&gdpr=1&gdpr_consent=foo`
+ }]);
+ expect(spec.getUserSyncs({ iframeEnabled: true }, {}, {gdprApplies: false, consentString: 'foo'}, undefined)).to.deep.equal([{
+ type: 'iframe', url: `${syncurl}&gdpr=0&gdpr_consent=foo`
+ }]);
+ expect(spec.getUserSyncs({ iframeEnabled: true }, {}, {gdprApplies: true, consentString: undefined}, undefined)).to.deep.equal([{
+ type: 'iframe', url: `${syncurl}&gdpr=1&gdpr_consent=`
+ }]);
+ });
+
+ it('COPPA: true', function() {
+ sandbox.stub(config, 'getConfig').callsFake(key => {
+ const config = {
+ 'coppa': true
+ };
+ return config[key];
+ });
+ expect(spec.getUserSyncs({ iframeEnabled: true }, {}, undefined, undefined)).to.deep.equal([{
+ type: 'iframe', url: `${syncurl}&coppa=1`
+ }]);
+ });
+
+ it('COPPA: false', function() {
+ sandbox.stub(config, 'getConfig').callsFake(key => {
+ const config = {
+ 'coppa': false
+ };
+ return config[key];
+ });
+ expect(spec.getUserSyncs({ iframeEnabled: true }, {}, undefined, undefined)).to.deep.equal([{
+ type: 'iframe', url: `${syncurl}`
+ }]);
+ });
+
+ it('GDPR + COPPA:true + CCPA/USP', function() {
+ sandbox.stub(config, 'getConfig').callsFake(key => {
+ const config = {
+ 'coppa': true
+ };
+ return config[key];
+ });
+ expect(spec.getUserSyncs({ iframeEnabled: true }, {}, {gdprApplies: true, consentString: 'foo'}, '1NYN')).to.deep.equal([{
+ type: 'iframe', url: `${syncurl}&gdpr=1&gdpr_consent=foo&us_privacy=1NYN&coppa=1`
+ }]);
+ });
+ });
});
});
From c037292303f255d9d181f0a07975c30f18a12f96 Mon Sep 17 00:00:00 2001
From: adxcgcom <31470944+adxcgcom@users.noreply.github.com>
Date: Mon, 9 Dec 2019 15:19:32 +0000
Subject: [PATCH 03/41] Update adxcgBidAdapter.js - native fix (#4534)
* Update adxcgBidAdapter.js - native fix
* trigger CI
* trigger CI
* Code reformat and adding ending semicolons. No other changes
Reformatted the code in separate commit before real changes
* update adxcgBidAdapter_spec
general cleanup - removed duplicated jsons
added native size check
added many url querystring http call parameter checks
* trigger CI
---
modules/adxcgBidAdapter.js | 10 +-
test/spec/modules/adxcgBidAdapter_spec.js | 883 ++++++++++++----------
2 files changed, 484 insertions(+), 409 deletions(-)
diff --git a/modules/adxcgBidAdapter.js b/modules/adxcgBidAdapter.js
index f9cdeda536ab..5e460217e8a1 100644
--- a/modules/adxcgBidAdapter.js
+++ b/modules/adxcgBidAdapter.js
@@ -12,7 +12,7 @@ import includes from 'core-js/library/fn/array/includes'
* updated to pass aditional auction and impression level parameters. added pass for video targeting parameters
* updated to fix native support for image width/height and icon 2019.03.17
* updated support for userid - pubcid,ttid 2019.05.28
- * updated to support prebid 3.0 -remove non https, move to banner.xx.sizes, remove utils.getTopWindowLocation,remove utils.getTopWindowUrl(),remove utils.getTopWindowReferrer()
+ * updated to support prebid 3.0 - remove non https, move to banner.xx.sizes, remove utils.getTopWindowLocation,remove utils.getTopWindowUrl(),remove utils.getTopWindowReferrer()
*/
const BIDDER_CODE = 'adxcg'
@@ -131,6 +131,10 @@ export const spec = {
sizes.push(utils.parseSizesInput(bid.mediaTypes.banner.sizes).join('|'))
}
+ if (isNativeRequest(bid)) {
+ sizes.push('0x0')
+ }
+
let bidfloor = utils.getBidIdParameter('bidfloor', bid.params) || 0
bidfloors.push(bidfloor)
// copy video params
@@ -293,4 +297,8 @@ function isBannerRequest (bid) {
return bid.mediaType === 'banner' || !!utils.deepAccess(bid, 'mediaTypes.banner')
}
+function isNativeRequest (bid) {
+ return bid.mediaType === 'native' || !!utils.deepAccess(bid, 'mediaTypes.native')
+}
+
registerBidder(spec)
diff --git a/test/spec/modules/adxcgBidAdapter_spec.js b/test/spec/modules/adxcgBidAdapter_spec.js
index 8daad7a9f865..3e73479259c7 100644
--- a/test/spec/modules/adxcgBidAdapter_spec.js
+++ b/test/spec/modules/adxcgBidAdapter_spec.js
@@ -1,482 +1,549 @@
-import { expect } from 'chai'
-import * as url from 'src/url'
-import { spec } from 'modules/adxcgBidAdapter'
+import {expect} from 'chai';
+import * as url from 'src/url';
+import {spec} from 'modules/adxcgBidAdapter';
+import {deepClone} from '../../../src/utils';
describe('AdxcgAdapter', function () {
- describe('isBidRequestValid', function () {
- let bidBanner = {
- 'bidder': 'adxcg',
- 'params': {
- 'adzoneid': '1'
- },
- 'adUnitCode': 'adunit-code',
- 'mediaTypes': {
- 'banner': {
- 'sizes': [[300, 250], [640, 360], [1, 1]]
- }
- },
- 'bidId': '84ab500420319d',
- 'bidderRequestId': '7101db09af0db2',
- 'auctionId': '1d1a030790a475',
- }
-
- let bidVideo = {
- 'bidder': 'adxcg',
- 'params': {
- 'adzoneid': '1',
- 'api': [2],
- 'protocols': [1, 2],
- 'mimes': ['video/mp4', 'video/x-flv'],
- 'maxduration': 30
- },
- 'mediaTypes': {
- 'video': {
- 'context': 'instream',
- 'playerSize': [[640, 480]]
+ let bidBanner = {
+ bidder: 'adxcg',
+ params: {
+ adzoneid: '1'
+ },
+ adUnitCode: 'adunit-code',
+ mediaTypes: {
+ banner: {
+ sizes: [
+ [300, 250],
+ [640, 360],
+ [1, 1]
+ ]
+ }
+ },
+ bidId: '84ab500420319d',
+ bidderRequestId: '7101db09af0db2',
+ auctionId: '1d1a030790a475'
+ };
+
+ let bidVideo = {
+ bidder: 'adxcg',
+ params: {
+ adzoneid: '20',
+ video: {
+ api: [2],
+ protocols: [1, 2],
+ mimes: ['video/mp4'],
+ maxduration: 30
+ }
+ },
+ mediaTypes: {
+ video: {
+ context: 'instream',
+ playerSize: [[640, 480]]
+ }
+ },
+ adUnitCode: 'adunit-code',
+ bidId: '84ab500420319d',
+ bidderRequestId: '7101db09af0db2',
+ auctionId: '1d1a030790a475'
+ };
+
+ let bidNative = {
+ bidder: 'adxcg',
+ params: {
+ adzoneid: '2379'
+ },
+ mediaTypes: {
+ native: {
+ image: {
+ sendId: false,
+ required: true,
+ sizes: [80, 80]
+ },
+ title: {
+ required: true,
+ len: 75
+ },
+ body: {
+ required: true,
+ len: 200
+ },
+ sponsoredBy: {
+ required: false,
+ len: 20
}
- },
- 'adUnitCode': 'adunit-code',
- 'bidId': '84ab500420319d',
- 'bidderRequestId': '7101db09af0db2',
- 'auctionId': '1d1a030790a475',
- }
+ }
+ },
+ adUnitCode: 'adunit-code',
+ bidId: '84ab500420319d',
+ bidderRequestId: '7101db09af0db2',
+ auctionId: '1d1a030790a475'
+ };
+
+ describe('isBidRequestValid', function () {
+ it('should return true when required params found bidNative', function () {
+ expect(spec.isBidRequestValid(bidNative)).to.equal(true);
+ });
- it('should return true when required params found', function () {
- expect(spec.isBidRequestValid(bidBanner)).to.equal(true)
- })
+ it('should return true when required params found bidVideo', function () {
+ expect(spec.isBidRequestValid(bidVideo)).to.equal(true);
+ });
+
+ it('should return true when required params found bidBanner', function () {
+ expect(spec.isBidRequestValid(bidBanner)).to.equal(true);
+ });
it('should return true when required params not found', function () {
- expect(spec.isBidRequestValid({})).to.be.false
- })
+ expect(spec.isBidRequestValid({})).to.be.false;
+ });
it('should return false when required params are not passed', function () {
- let bid = Object.assign({}, bidBanner)
- delete bid.params
- bid.params = {}
- expect(spec.isBidRequestValid(bid)).to.equal(false)
- })
+ let bid = Object.assign({}, bidBanner);
+ delete bid.params;
+ bid.params = {};
+ expect(spec.isBidRequestValid(bid)).to.equal(false);
+ });
it('should return true when required video params not found', function () {
- const simpleVideo = JSON.parse(JSON.stringify(bidVideo))
- simpleVideo.params.adzoneid = 123
- expect(spec.isBidRequestValid(simpleVideo)).to.be.false
- simpleVideo.params.mimes = [1, 2, 3]
- expect(spec.isBidRequestValid(simpleVideo)).to.be.false
- simpleVideo.params.mimes = 'bad type'
- expect(spec.isBidRequestValid(simpleVideo)).to.be.false
- })
- })
+ const simpleVideo = JSON.parse(JSON.stringify(bidVideo));
+ simpleVideo.params.adzoneid = 123;
+ expect(spec.isBidRequestValid(simpleVideo)).to.be.false;
+ simpleVideo.params.mimes = [1, 2, 3];
+ expect(spec.isBidRequestValid(simpleVideo)).to.be.false;
+ simpleVideo.params.mimes = 'bad type';
+ expect(spec.isBidRequestValid(simpleVideo)).to.be.false;
+ });
+ });
describe('request function http', function () {
- let bid = {
- 'bidder': 'adxcg',
- 'params': {
- 'adzoneid': '1'
- },
- 'adUnitCode': 'adunit-code',
- 'mediaTypes': {
- 'banner': {
- 'sizes': [[300, 250], [640, 360], [1, 1]]
- }
- },
- 'bidId': '84ab500420319d',
- 'bidderRequestId': '7101db09af0db2',
- 'auctionId': '1d1a030790a475',
- }
-
- it('creates a valid adxcg request url', function () {
- let request = spec.buildRequests([bid])
- expect(request).to.exist
- expect(request.method).to.equal('GET')
- let parsedRequestUrl = url.parse(request.url)
- expect(parsedRequestUrl.hostname).to.equal('hbps.adxcg.net')
- expect(parsedRequestUrl.pathname).to.equal('/get/adi')
-
- let query = parsedRequestUrl.search
- expect(query.renderformat).to.equal('javascript')
- expect(query.ver).to.equal('r20191128PB30')
- expect(query.source).to.equal('pbjs10')
- expect(query.pbjs).to.equal('$prebid.version$')
- expect(query.adzoneid).to.equal('1')
- expect(query.format).to.equal('300x250|640x360|1x1')
- expect(query.jsonp).to.be.undefined
- expect(query.prebidBidIds).to.equal('84ab500420319d')
- })
- })
+ it('creates a valid adxcg request url bidBanner', function () {
+ let request = spec.buildRequests([bidBanner]);
+ expect(request).to.exist;
+ expect(request.method).to.equal('GET');
+ let parsedRequestUrl = url.parse(request.url);
+ expect(parsedRequestUrl.hostname).to.equal('hbps.adxcg.net');
+ expect(parsedRequestUrl.pathname).to.equal('/get/adi');
+
+ let query = parsedRequestUrl.search;
+ expect(query.renderformat).to.equal('javascript');
+ expect(query.ver).to.equal('r20191128PB30');
+ expect(query.source).to.equal('pbjs10');
+ expect(query.pbjs).to.equal('$prebid.version$');
+ expect(query.adzoneid).to.equal('1');
+ expect(query.format).to.equal('300x250|640x360|1x1');
+ expect(query.jsonp).to.be.undefined;
+ expect(query.prebidBidIds).to.equal('84ab500420319d');
+ expect(query.bidfloors).to.equal('0');
+
+ expect(query).to.have.property('secure');
+ expect(query).to.have.property('uw');
+ expect(query).to.have.property('uh');
+ expect(query).to.have.property('dpr');
+ expect(query).to.have.property('bt');
+ expect(query).to.have.property('cookies');
+ expect(query).to.have.property('tz');
+ expect(query).to.have.property('dt');
+ expect(query).to.have.property('iob');
+ expect(query).to.have.property('rndid');
+ expect(query).to.have.property('ref');
+ expect(query).to.have.property('url');
+ });
+
+ it('creates a valid adxcg request url bidVideo', function () {
+ let request = spec.buildRequests([bidVideo]);
+ expect(request).to.exist;
+ expect(request.method).to.equal('GET');
+ let parsedRequestUrl = url.parse(request.url);
+ expect(parsedRequestUrl.hostname).to.equal('hbps.adxcg.net');
+ expect(parsedRequestUrl.pathname).to.equal('/get/adi');
+
+ let query = parsedRequestUrl.search;
+ // general part
+ expect(query.renderformat).to.equal('javascript');
+ expect(query.ver).to.equal('r20191128PB30');
+ expect(query.source).to.equal('pbjs10');
+ expect(query.pbjs).to.equal('$prebid.version$');
+ expect(query.adzoneid).to.equal('20');
+ expect(query.format).to.equal('640x480');
+ expect(query.jsonp).to.be.undefined;
+ expect(query.prebidBidIds).to.equal('84ab500420319d');
+ expect(query.bidfloors).to.equal('0');
+
+ expect(query).to.have.property('secure');
+ expect(query).to.have.property('uw');
+ expect(query).to.have.property('uh');
+ expect(query).to.have.property('dpr');
+ expect(query).to.have.property('bt');
+ expect(query).to.have.property('cookies');
+ expect(query).to.have.property('tz');
+ expect(query).to.have.property('dt');
+ expect(query).to.have.property('iob');
+ expect(query).to.have.property('rndid');
+ expect(query).to.have.property('ref');
+ expect(query).to.have.property('url');
+
+ // video specific part
+ expect(query['video.maxduration.0']).to.equal('30');
+ expect(query['video.mimes.0']).to.equal('video/mp4');
+ expect(query['video.context.0']).to.equal('instream');
+ });
+
+ it('creates a valid adxcg request url bidNative', function () {
+ let request = spec.buildRequests([bidNative]);
+ expect(request).to.exist;
+ expect(request.method).to.equal('GET');
+ let parsedRequestUrl = url.parse(request.url);
+ expect(parsedRequestUrl.hostname).to.equal('hbps.adxcg.net');
+ expect(parsedRequestUrl.pathname).to.equal('/get/adi');
+
+ let query = parsedRequestUrl.search;
+ expect(query.renderformat).to.equal('javascript');
+ expect(query.ver).to.equal('r20191128PB30');
+ expect(query.source).to.equal('pbjs10');
+ expect(query.pbjs).to.equal('$prebid.version$');
+ expect(query.adzoneid).to.equal('2379');
+ expect(query.format).to.equal('0x0');
+ expect(query.jsonp).to.be.undefined;
+ expect(query.prebidBidIds).to.equal('84ab500420319d');
+ expect(query.bidfloors).to.equal('0');
+
+ expect(query).to.have.property('secure');
+ expect(query).to.have.property('uw');
+ expect(query).to.have.property('uh');
+ expect(query).to.have.property('dpr');
+ expect(query).to.have.property('bt');
+ expect(query).to.have.property('cookies');
+ expect(query).to.have.property('tz');
+ expect(query).to.have.property('dt');
+ expect(query).to.have.property('iob');
+ expect(query).to.have.property('rndid');
+ expect(query).to.have.property('ref');
+ expect(query).to.have.property('url');
+ });
+ });
describe('gdpr compliance', function () {
- let bid = {
- 'bidder': 'adxcg',
- 'params': {
- 'adzoneid': '1'
- },
- 'adUnitCode': 'adunit-code',
- 'mediaTypes': {
- 'banner': {
- 'sizes': [[300, 250], [640, 360], [1, 1]]
- }
- },
- 'bidId': '84ab500420319d',
- 'bidderRequestId': '7101db09af0db2',
- 'auctionId': '1d1a030790a475',
- }
-
it('should send GDPR Consent data if gdprApplies', function () {
- let request = spec.buildRequests([bid], {gdprConsent: {gdprApplies: true, consentString: 'consentDataString'}})
- let parsedRequestUrl = url.parse(request.url)
- let query = parsedRequestUrl.search
+ let request = spec.buildRequests([bidBanner], {
+ gdprConsent: {
+ gdprApplies: true,
+ consentString: 'consentDataString'
+ }
+ });
+ let parsedRequestUrl = url.parse(request.url);
+ let query = parsedRequestUrl.search;
- expect(query.gdpr).to.equal('1')
- expect(query.gdpr_consent).to.equal('consentDataString')
- })
+ expect(query.gdpr).to.equal('1');
+ expect(query.gdpr_consent).to.equal('consentDataString');
+ });
it('should not send GDPR Consent data if gdprApplies is false or undefined', function () {
- let request = spec.buildRequests([bid], {
+ let request = spec.buildRequests([bidBanner], {
gdprConsent: {
gdprApplies: false,
consentString: 'consentDataString'
}
- })
- let parsedRequestUrl = url.parse(request.url)
- let query = parsedRequestUrl.search
+ });
+ let parsedRequestUrl = url.parse(request.url);
+ let query = parsedRequestUrl.search;
- expect(query.gdpr).to.be.undefined
- expect(query.gdpr_consent).to.be.undefined
- })
- })
+ expect(query.gdpr).to.be.undefined;
+ expect(query.gdpr_consent).to.be.undefined;
+ });
+ });
describe('userid pubcid should be passed to querystring', function () {
- let bid = [{
- 'bidder': 'adxcg',
- 'params': {
- 'adzoneid': '1'
- },
- 'adUnitCode': 'adunit-code',
- 'mediaTypes': {
- 'banner': {
- 'sizes': [[300, 250], [640, 360], [1, 1]]
- }
- },
- 'bidId': '84ab500420319d',
- 'bidderRequestId': '7101db09af0db2',
- 'auctionId': '1d1a030790a475',
- }]
-
let bidderRequests = {};
-
- bid[0].userId = {'pubcid': 'pubcidabcd'};
+ let bid = deepClone([bidBanner]);
+ bid[0].userId = {pubcid: 'pubcidabcd'};
it('should send pubcid if available', function () {
- let request = spec.buildRequests(bid, bidderRequests)
- let parsedRequestUrl = url.parse(request.url)
- let query = parsedRequestUrl.search
- expect(query.pubcid).to.equal('pubcidabcd')
- })
- })
+ let request = spec.buildRequests(bid, bidderRequests);
+ let parsedRequestUrl = url.parse(request.url);
+ let query = parsedRequestUrl.search;
+ expect(query.pubcid).to.equal('pubcidabcd');
+ });
+ });
describe('userid tdid should be passed to querystring', function () {
- let bid = [{
- 'bidder': 'adxcg',
- 'params': {
- 'adzoneid': '1'
- },
- 'adUnitCode': 'adunit-code',
- 'mediaTypes': {
- 'banner': {
- 'sizes': [[300, 250], [640, 360], [1, 1]]
- }
- },
- 'bidId': '84ab500420319d',
- 'bidderRequestId': '7101db09af0db2',
- 'auctionId': '1d1a030790a475',
- }]
-
+ let bid = deepClone([bidBanner]);
let bidderRequests = {};
- bid[0].userId = {'tdid': 'tdidabcd'};
+ bid[0].userId = {tdid: 'tdidabcd'};
it('should send pubcid if available', function () {
- let request = spec.buildRequests(bid, bidderRequests)
- let parsedRequestUrl = url.parse(request.url)
- let query = parsedRequestUrl.search
+ let request = spec.buildRequests(bid, bidderRequests);
+ let parsedRequestUrl = url.parse(request.url);
+ let query = parsedRequestUrl.search;
expect(query.tdid).to.equal('tdidabcd');
- })
- })
+ });
+ });
describe('userid id5id should be passed to querystring', function () {
- let bid = [{
- 'bidder': 'adxcg',
- 'params': {
- 'adzoneid': '1'
- },
- 'adUnitCode': 'adunit-code',
- 'mediaTypes': {
- 'banner': {
- 'sizes': [[300, 250], [640, 360], [1, 1]]
- }
- },
- 'bidId': '84ab500420319d',
- 'bidderRequestId': '7101db09af0db2',
- 'auctionId': '1d1a030790a475',
- }]
-
+ let bid = deepClone([bidBanner]);
let bidderRequests = {};
- bid[0].userId = {'id5id': 'id5idsample'};
+ bid[0].userId = {id5id: 'id5idsample'};
it('should send pubcid if available', function () {
- let request = spec.buildRequests(bid, bidderRequests)
- let parsedRequestUrl = url.parse(request.url)
- let query = parsedRequestUrl.search
+ let request = spec.buildRequests(bid, bidderRequests);
+ let parsedRequestUrl = url.parse(request.url);
+ let query = parsedRequestUrl.search;
expect(query.id5id).to.equal('id5idsample');
- })
- })
+ });
+ });
describe('userid idl_env should be passed to querystring', function () {
- let bid = [{
- 'bidder': 'adxcg',
- 'params': {
- 'adzoneid': '1'
- },
- 'adUnitCode': 'adunit-code',
- 'mediaTypes': {
- 'banner': {
- 'sizes': [[300, 250], [640, 360], [1, 1]]
- }
- },
- 'bidId': '84ab500420319d',
- 'bidderRequestId': '7101db09af0db2',
- 'auctionId': '1d1a030790a475',
- }]
-
+ let bid = deepClone([bidBanner]);
let bidderRequests = {};
- bid[0].userId = {'idl_env': 'idl_envsample'};
+ bid[0].userId = {idl_env: 'idl_envsample'};
it('should send pubcid if available', function () {
- let request = spec.buildRequests(bid, bidderRequests)
- let parsedRequestUrl = url.parse(request.url)
- let query = parsedRequestUrl.search
+ let request = spec.buildRequests(bid, bidderRequests);
+ let parsedRequestUrl = url.parse(request.url);
+ let query = parsedRequestUrl.search;
expect(query.idl_env).to.equal('idl_envsample');
- })
- })
+ });
+ });
describe('response handler', function () {
let BIDDER_REQUEST = {
- 'bidder': 'adxcg',
- 'params': {
- 'adzoneid': '1'
+ bidder: 'adxcg',
+ params: {
+ adzoneid: '1'
},
- 'adUnitCode': 'adunit-code',
- 'mediaTypes': {
- 'banner': {
- 'sizes': [[300, 250], [640, 360], [1, 1]]
+ adUnitCode: 'adunit-code',
+ mediaTypes: {
+ banner: {
+ sizes: [
+ [300, 250],
+ [640, 360],
+ [1, 1]
+ ]
}
},
- 'bidId': '84ab500420319d',
- 'bidderRequestId': '7101db09af0db2',
- 'auctionId': '1d1a030790a475',
- }
-
- let BANNER_RESPONSE =
- {
- body: [{
- 'bidId': '84ab500420319d',
- 'bidderCode': 'adxcg',
- 'width': 300,
- 'height': 250,
- 'creativeId': '42',
- 'cpm': 0.45,
- 'currency': 'USD',
- 'netRevenue': true,
- 'ad': ''
- }],
- header: {'someheader': 'fakedata'}
- }
-
- let BANNER_RESPONSE_WITHDEALID =
- {
- body: [{
- 'bidId': '84ab500420319d',
- 'bidderCode': 'adxcg',
- 'width': 300,
- 'height': 250,
- 'deal_id': '7722',
- 'creativeId': '42',
- 'cpm': 0.45,
- 'currency': 'USD',
- 'netRevenue': true,
- 'ad': ''
- }],
- header: {'someheader': 'fakedata'}
- }
-
- let VIDEO_RESPONSE =
- {
- body: [{
- 'bidId': '84ab500420319d',
- 'bidderCode': 'adxcg',
- 'width': 640,
- 'height': 360,
- 'creativeId': '42',
- 'cpm': 0.45,
- 'currency': 'USD',
- 'netRevenue': true,
- 'vastUrl': 'vastContentUrl'
- }],
- header: {'someheader': 'fakedata'}
- }
-
- let NATIVE_RESPONSE =
- {
- body: [{
- 'bidId': '84ab500420319d',
- 'bidderCode': 'adxcg',
- 'width': 0,
- 'height': 0,
- 'creativeId': '42',
- 'cpm': 0.45,
- 'currency': 'USD',
- 'netRevenue': true,
- 'nativeResponse': {
- 'assets': [{
- 'id': 1,
- 'required': 0,
- 'title': {
- 'text': 'titleContent'
- }
- }, {
- 'id': 2,
- 'required': 0,
- 'img': {
- 'url': 'imageContent',
- 'w': 600,
- 'h': 600
- }
- }, {
- 'id': 3,
- 'required': 0,
- 'data': {
- 'label': 'DESC',
- 'value': 'descriptionContent'
- }
- }, {
- 'id': 0,
- 'required': 0,
- 'data': {
- 'label': 'SPONSORED',
- 'value': 'sponsoredByContent'
- }
- }, {
- 'id': 5,
- 'required': 0,
- 'icon': {
- 'url': 'iconContent',
- 'w': 400,
- 'h': 400
+ bidId: '84ab500420319d',
+ bidderRequestId: '7101db09af0db2',
+ auctionId: '1d1a030790a475'
+ };
+
+ let BANNER_RESPONSE = {
+ body: [
+ {
+ bidId: '84ab500420319d',
+ bidderCode: 'adxcg',
+ width: 300,
+ height: 250,
+ creativeId: '42',
+ cpm: 0.45,
+ currency: 'USD',
+ netRevenue: true,
+ ad: ''
+ }
+ ],
+ header: {someheader: 'fakedata'}
+ };
+
+ let BANNER_RESPONSE_WITHDEALID = {
+ body: [
+ {
+ bidId: '84ab500420319d',
+ bidderCode: 'adxcg',
+ width: 300,
+ height: 250,
+ deal_id: '7722',
+ creativeId: '42',
+ cpm: 0.45,
+ currency: 'USD',
+ netRevenue: true,
+ ad: ''
+ }
+ ],
+ header: {someheader: 'fakedata'}
+ };
+
+ let VIDEO_RESPONSE = {
+ body: [
+ {
+ bidId: '84ab500420319d',
+ bidderCode: 'adxcg',
+ width: 640,
+ height: 360,
+ creativeId: '42',
+ cpm: 0.45,
+ currency: 'USD',
+ netRevenue: true,
+ vastUrl: 'vastContentUrl'
+ }
+ ],
+ header: {someheader: 'fakedata'}
+ };
+
+ let NATIVE_RESPONSE = {
+ body: [
+ {
+ bidId: '84ab500420319d',
+ bidderCode: 'adxcg',
+ width: 0,
+ height: 0,
+ creativeId: '42',
+ cpm: 0.45,
+ currency: 'USD',
+ netRevenue: true,
+ nativeResponse: {
+ assets: [
+ {
+ id: 1,
+ required: 0,
+ title: {
+ text: 'titleContent'
+ }
+ },
+ {
+ id: 2,
+ required: 0,
+ img: {
+ url: 'imageContent',
+ w: 600,
+ h: 600
+ }
+ },
+ {
+ id: 3,
+ required: 0,
+ data: {
+ label: 'DESC',
+ value: 'descriptionContent'
+ }
+ },
+ {
+ id: 0,
+ required: 0,
+ data: {
+ label: 'SPONSORED',
+ value: 'sponsoredByContent'
+ }
+ },
+ {
+ id: 5,
+ required: 0,
+ icon: {
+ url: 'iconContent',
+ w: 400,
+ h: 400
+ }
}
- }],
- 'link': {
- 'url': 'linkContent'
+ ],
+ link: {
+ url: 'linkContent'
},
- 'imptrackers': ['impressionTracker1', 'impressionTracker2']
+ imptrackers: ['impressionTracker1', 'impressionTracker2']
}
- }],
- header: {'someheader': 'fakedata'}
- }
+ }
+ ],
+ header: {someheader: 'fakedata'}
+ };
it('handles regular responses', function () {
- let result = spec.interpretResponse(BANNER_RESPONSE, BIDDER_REQUEST)
-
- expect(result).to.have.lengthOf(1)
-
- expect(result[0]).to.exist
- expect(result[0].width).to.equal(300)
- expect(result[0].height).to.equal(250)
- expect(result[0].creativeId).to.equal(42)
- expect(result[0].cpm).to.equal(0.45)
- expect(result[0].ad).to.equal('')
- expect(result[0].currency).to.equal('USD')
- expect(result[0].netRevenue).to.equal(true)
- expect(result[0].ttl).to.equal(300)
- expect(result[0].dealId).to.not.exist
- })
+ let result = spec.interpretResponse(BANNER_RESPONSE, BIDDER_REQUEST);
+
+ expect(result).to.have.lengthOf(1);
+
+ expect(result[0]).to.exist;
+ expect(result[0].width).to.equal(300);
+ expect(result[0].height).to.equal(250);
+ expect(result[0].creativeId).to.equal(42);
+ expect(result[0].cpm).to.equal(0.45);
+ expect(result[0].ad).to.equal('');
+ expect(result[0].currency).to.equal('USD');
+ expect(result[0].netRevenue).to.equal(true);
+ expect(result[0].ttl).to.equal(300);
+ expect(result[0].dealId).to.not.exist;
+ });
it('handles regular responses with dealid', function () {
- let result = spec.interpretResponse(BANNER_RESPONSE_WITHDEALID, BIDDER_REQUEST)
-
- expect(result).to.have.lengthOf(1)
-
- expect(result[0].width).to.equal(300)
- expect(result[0].height).to.equal(250)
- expect(result[0].creativeId).to.equal(42)
- expect(result[0].cpm).to.equal(0.45)
- expect(result[0].ad).to.equal('')
- expect(result[0].currency).to.equal('USD')
- expect(result[0].netRevenue).to.equal(true)
- expect(result[0].ttl).to.equal(300)
- })
+ let result = spec.interpretResponse(
+ BANNER_RESPONSE_WITHDEALID,
+ BIDDER_REQUEST
+ );
+
+ expect(result).to.have.lengthOf(1);
+
+ expect(result[0].width).to.equal(300);
+ expect(result[0].height).to.equal(250);
+ expect(result[0].creativeId).to.equal(42);
+ expect(result[0].cpm).to.equal(0.45);
+ expect(result[0].ad).to.equal('');
+ expect(result[0].currency).to.equal('USD');
+ expect(result[0].netRevenue).to.equal(true);
+ expect(result[0].ttl).to.equal(300);
+ });
it('handles video responses', function () {
- let result = spec.interpretResponse(VIDEO_RESPONSE, BIDDER_REQUEST)
- expect(result).to.have.lengthOf(1)
-
- expect(result[0].width).to.equal(640)
- expect(result[0].height).to.equal(360)
- expect(result[0].mediaType).to.equal('video')
- expect(result[0].creativeId).to.equal(42)
- expect(result[0].cpm).to.equal(0.45)
- expect(result[0].vastUrl).to.equal('vastContentUrl')
- expect(result[0].currency).to.equal('USD')
- expect(result[0].netRevenue).to.equal(true)
- expect(result[0].ttl).to.equal(300)
- })
+ let result = spec.interpretResponse(VIDEO_RESPONSE, BIDDER_REQUEST);
+ expect(result).to.have.lengthOf(1);
+
+ expect(result[0].width).to.equal(640);
+ expect(result[0].height).to.equal(360);
+ expect(result[0].mediaType).to.equal('video');
+ expect(result[0].creativeId).to.equal(42);
+ expect(result[0].cpm).to.equal(0.45);
+ expect(result[0].vastUrl).to.equal('vastContentUrl');
+ expect(result[0].currency).to.equal('USD');
+ expect(result[0].netRevenue).to.equal(true);
+ expect(result[0].ttl).to.equal(300);
+ });
it('handles native responses', function () {
- let result = spec.interpretResponse(NATIVE_RESPONSE, BIDDER_REQUEST)
-
- expect(result[0].width).to.equal(0)
- expect(result[0].height).to.equal(0)
- expect(result[0].mediaType).to.equal('native')
- expect(result[0].creativeId).to.equal(42)
- expect(result[0].cpm).to.equal(0.45)
- expect(result[0].currency).to.equal('USD')
- expect(result[0].netRevenue).to.equal(true)
- expect(result[0].ttl).to.equal(300)
-
- expect(result[0].native.clickUrl).to.equal('linkContent')
- expect(result[0].native.impressionTrackers).to.deep.equal(['impressionTracker1', 'impressionTracker2'])
- expect(result[0].native.title).to.equal('titleContent')
-
- expect(result[0].native.image.url).to.equal('imageContent')
- expect(result[0].native.image.height).to.equal(600)
- expect(result[0].native.image.width).to.equal(600)
-
- expect(result[0].native.icon.url).to.equal('iconContent')
- expect(result[0].native.icon.height).to.equal(400)
- expect(result[0].native.icon.width).to.equal(400)
-
- expect(result[0].native.body).to.equal('descriptionContent')
- expect(result[0].native.sponsoredBy).to.equal('sponsoredByContent')
- })
+ let result = spec.interpretResponse(NATIVE_RESPONSE, BIDDER_REQUEST);
+
+ expect(result[0].width).to.equal(0);
+ expect(result[0].height).to.equal(0);
+ expect(result[0].mediaType).to.equal('native');
+ expect(result[0].creativeId).to.equal(42);
+ expect(result[0].cpm).to.equal(0.45);
+ expect(result[0].currency).to.equal('USD');
+ expect(result[0].netRevenue).to.equal(true);
+ expect(result[0].ttl).to.equal(300);
+
+ expect(result[0].native.clickUrl).to.equal('linkContent');
+ expect(result[0].native.impressionTrackers).to.deep.equal([
+ 'impressionTracker1',
+ 'impressionTracker2'
+ ]);
+ expect(result[0].native.title).to.equal('titleContent');
+
+ expect(result[0].native.image.url).to.equal('imageContent');
+ expect(result[0].native.image.height).to.equal(600);
+ expect(result[0].native.image.width).to.equal(600);
+
+ expect(result[0].native.icon.url).to.equal('iconContent');
+ expect(result[0].native.icon.height).to.equal(400);
+ expect(result[0].native.icon.width).to.equal(400);
+
+ expect(result[0].native.body).to.equal('descriptionContent');
+ expect(result[0].native.sponsoredBy).to.equal('sponsoredByContent');
+ });
it('handles nobid responses', function () {
- let response = []
- let bidderRequest = BIDDER_REQUEST
+ let response = [];
+ let bidderRequest = BIDDER_REQUEST;
- let result = spec.interpretResponse(response, bidderRequest)
- expect(result.length).to.equal(0)
- })
- })
+ let result = spec.interpretResponse(response, bidderRequest);
+ expect(result.length).to.equal(0);
+ });
+ });
describe('getUserSyncs', function () {
let syncoptionsIframe = {
- 'iframeEnabled': 'true'
- }
+ iframeEnabled: 'true'
+ };
it('should return iframe sync option', function () {
- expect(spec.getUserSyncs(syncoptionsIframe)[0].type).to.equal('iframe')
- expect(spec.getUserSyncs(syncoptionsIframe)[0].url).to.equal('https://cdn.adxcg.net/pb-sync.html')
- })
- })
-})
+ expect(spec.getUserSyncs(syncoptionsIframe)[0].type).to.equal('iframe');
+ expect(spec.getUserSyncs(syncoptionsIframe)[0].url).to.equal(
+ 'https://cdn.adxcg.net/pb-sync.html'
+ );
+ });
+ });
+});
From d1adb8460ea9a3a9cec79f150a4ef405ad2da43d Mon Sep 17 00:00:00 2001
From: adxcgcom <31470944+adxcgcom@users.noreply.github.com>
Date: Mon, 9 Dec 2019 15:20:10 +0000
Subject: [PATCH 04/41] Update adxcgBidAdapter.js - native fix (#4534)
* Update adxcgBidAdapter.js - native fix
* trigger CI
* trigger CI
* Code reformat and adding ending semicolons. No other changes
Reformatted the code in separate commit before real changes
* update adxcgBidAdapter_spec
general cleanup - removed duplicated jsons
added native size check
added many url querystring http call parameter checks
* trigger CI
From 1a30dea588781a25ad6a12b3de9faa7728ac1f2e Mon Sep 17 00:00:00 2001
From: PWyrembak
Date: Mon, 9 Dec 2019 18:28:00 +0300
Subject: [PATCH 05/41] Added US Privacy support in TrustX Bid Adapter (#4529)
* Add trustx adapter and tests for it
* update integration example
* Update trustx adapter
* Post-review fixes of Trustx adapter
* Code improvement for trustx adapter: changed default price type from gross to net
* Update TrustX adapter to support the 1.0 version
* Make requested changes for TrustX adapter
* Updated markdown file for TrustX adapter
* Fix TrustX adapter and spec file
* Update TrustX adapter: r parameter was added to ad request as cache buster
* Add support of gdpr to Trustx Bid Adapter
* Add wtimeout to ad request params for TrustX Bid Adapter
* TrustX Bid Adapter: remove last ampersand in the ad request
* Update TrustX Bid Adapter to support identical uids in parameters
* Update TrustX Bid Adapter to ignore bids that sizes do not match the size of the request
* Update TrustX Bid Adapter to support instream and outstream video
* Added wrapperType and wrapperVersion parameters in ad request for TrustX Bid Adapter
* Update TrustX Bid Adapter to use refererInfo instead depricated function utils.getTopWindowUrl
* HOTFIX for referrer encodind in TrustX Bid Adapter
* Fix test for TrustX Bid Adapter
* TrustX Bid Adapter: added keywords passing support
* TrustX Bid Adapter: added us_privacy parameter in bid request
* TrustX Bid Adapter: fix us_privacy parameter in bid request
---
modules/trustxBidAdapter.js | 3 +++
test/spec/modules/trustxBidAdapter_spec.js | 8 ++++++++
2 files changed, 11 insertions(+)
diff --git a/modules/trustxBidAdapter.js b/modules/trustxBidAdapter.js
index 00c86dec0d34..94d541d1fe2c 100644
--- a/modules/trustxBidAdapter.js
+++ b/modules/trustxBidAdapter.js
@@ -121,6 +121,9 @@ export const spec = {
(typeof bidderRequest.gdprConsent.gdprApplies === 'boolean')
? Number(bidderRequest.gdprConsent.gdprApplies) : 1;
}
+ if (bidderRequest.uspConsent) {
+ payload.us_privacy = bidderRequest.uspConsent;
+ }
}
return {
diff --git a/test/spec/modules/trustxBidAdapter_spec.js b/test/spec/modules/trustxBidAdapter_spec.js
index 4256012ba0bb..aee6311cb857 100644
--- a/test/spec/modules/trustxBidAdapter_spec.js
+++ b/test/spec/modules/trustxBidAdapter_spec.js
@@ -168,6 +168,14 @@ describe('TrustXAdapter', function () {
expect(payload).to.have.property('gdpr_applies', '1');
});
+ it('if usPrivacy is present payload must have us_privacy param', function () {
+ const bidderRequestWithUSP = Object.assign({uspConsent: '1YNN'}, bidderRequest);
+ const request = spec.buildRequests(bidRequests, bidderRequestWithUSP);
+ expect(request.data).to.be.an('string');
+ const payload = parseRequest(request.data);
+ expect(payload).to.have.property('us_privacy', '1YNN');
+ });
+
it('should convert keyword params to proper form and attaches to request', function () {
const bidRequestWithKeywords = [].concat(bidRequests);
bidRequestWithKeywords[1] = Object.assign({},
From d45523c30c56aaf6ec9a30551a92311e49dd0572 Mon Sep 17 00:00:00 2001
From: Mike Groh
Date: Mon, 9 Dec 2019 15:08:24 -0500
Subject: [PATCH 06/41] Trion interactive query param additions (#4522)
* Adding files associated with the trion adapter update to the newest prebid version(1.0).
* Updating pull request with safer checks for user sync and general clean up/consistency of tests.
* removing a call to bidder code for pull request review. also removing the test that requires it
* there were some changes to the bid factory after our initial release that we didn't account for. Changing adapter to account for response body and required params.
* Revert "there were some changes to the bid factory after our initial release that we didn't account for. Changing adapter to account for response body and required params."
This reverts commit 324d15785fb61c92db9c0a37f1001f47721e3a25.
* there were some changes to the bid factory after our initial release that we didn't account for. Changing adapter to account for response body and required params.
* adding safety checks to Trion adapter
* Sending up to trion endpoint if there is bot traffic or the browser tab is not visible.
* sending the wrong param in the test.
* Trion test cleanup. returning document and window states to their original form after tests.
* Trion test cleanup. using before and after to alter window and document objects in tests.
---
modules/trionBidAdapter.js | 6 +++
test/spec/modules/trionBidAdapter_spec.js | 55 +++++++++++++++++++++++
2 files changed, 61 insertions(+)
diff --git a/modules/trionBidAdapter.js b/modules/trionBidAdapter.js
index 97f82f57b852..3595b709a51d 100644
--- a/modules/trionBidAdapter.js
+++ b/modules/trionBidAdapter.js
@@ -84,6 +84,9 @@ function buildTrionUrlParams(bid) {
var re = utils.getBidIdParameter('re', bid.params);
var url = utils.getTopWindowUrl();
var sizes = utils.parseSizesInput(bid.sizes).join(',');
+ var isAutomated = (navigator && navigator.webdriver) ? 1 : 0;
+ var isHidden = (document.hidden) ? 1 : 0;
+ var visibilityState = encodeURIComponent(document.visibilityState);
var intT = window.TR_INT_T && window.TR_INT_T != -1 ? window.TR_INT_T : null;
if (!intT) {
@@ -108,6 +111,9 @@ function buildTrionUrlParams(bid) {
if (intT) {
trionUrl = utils.tryAppendQueryString(trionUrl, 'int_t', encodeURIComponent(intT));
}
+ trionUrl = utils.tryAppendQueryString(trionUrl, 'tr_wd', isAutomated);
+ trionUrl = utils.tryAppendQueryString(trionUrl, 'tr_hd', isHidden);
+ trionUrl = utils.tryAppendQueryString(trionUrl, 'tr_vs', visibilityState);
// remove the trailing "&"
if (trionUrl.lastIndexOf('&') === trionUrl.length - 1) {
diff --git a/test/spec/modules/trionBidAdapter_spec.js b/test/spec/modules/trionBidAdapter_spec.js
index 805ae70a3396..63c2b71a31a7 100644
--- a/test/spec/modules/trionBidAdapter_spec.js
+++ b/test/spec/modules/trionBidAdapter_spec.js
@@ -119,6 +119,61 @@ describe('Trion adapter tests', function () {
expect(bidUrlParams).to.include(utils.getTopWindowUrl());
delete params.re;
});
+
+ describe('webdriver', function () {
+ let originalWD;
+
+ beforeEach(function () {
+ originalWD = window.navigator.webdriver;
+ window.navigator['__defineGetter__']('webdriver', function () {
+ return 1;
+ });
+ });
+
+ afterEach(function () {
+ window.navigator['__defineGetter__']('webdriver', function () {
+ return originalWD;
+ });
+ });
+
+ it('should send the correct state when there is non human traffic', function () {
+ let bidRequests = spec.buildRequests(TRION_BID_REQUEST);
+ let bidUrlParams = bidRequests[0].data;
+ expect(bidUrlParams).to.include('tr_wd=1');
+ });
+ });
+
+ describe('visibility', function () {
+ let originalHD;
+ let originalVS;
+
+ beforeEach(function () {
+ originalHD = document.hidden;
+ originalVS = document.visibilityState;
+ document['__defineGetter__']('hidden', function () {
+ return 1;
+ });
+ document['__defineGetter__']('visibilityState', function () {
+ return 'hidden';
+ });
+ });
+
+ afterEach(function () {
+ document['__defineGetter__']('hidden', function () {
+ return originalHD;
+ });
+ document['__defineGetter__']('visibilityState', function () {
+ return originalVS;
+ });
+ });
+
+ it('should send the correct states when the document is not visible', function () {
+ let bidRequests = spec.buildRequests(TRION_BID_REQUEST);
+ let bidUrlParams = bidRequests[0].data;
+ expect(bidUrlParams).to.include('tr_hd=1');
+ expect(bidUrlParams).to.include('tr_vs=hidden');
+ });
+ });
});
describe('interpretResponse', function () {
From 3c853dcb97d086ef2784a323891c8003243b4fc1 Mon Sep 17 00:00:00 2001
From: Vadim Mazzherin
Date: Tue, 10 Dec 2019 03:22:03 +0600
Subject: [PATCH 07/41] ShowHeroes Adapter - naming convention issue (#4525)
* add ShowHeroes Adapter
* ShowHeroes adapter - expanded outstream support
* Revert "ShowHeroes adapter - expanded outstream support"
This reverts commit bfcdb913b52012b5afbf95a84956b906518a4b51.
* ShowHeroes adapter - expanded outstream support
* ShowHeroes adapter - fixes (#4222)
* ShowHeroes adapter - banner and outstream fixes (#4222)
* ShowHeroes adapter - description and outstream changes (#4222)
* ShowHeroes adapter - increase test coverage and small fix
* ShowHeroes Adapter - naming convention issue
---
modules/{shBidAdapter.js => showheroes-bsBidAdapter.js} | 0
modules/{shBidAdapter.md => showheroes-bsBidAdapter.md} | 0
.../{shBidAdapter_spec.js => showheroes-bsBidAdapter_spec.js} | 2 +-
3 files changed, 1 insertion(+), 1 deletion(-)
rename modules/{shBidAdapter.js => showheroes-bsBidAdapter.js} (100%)
rename modules/{shBidAdapter.md => showheroes-bsBidAdapter.md} (100%)
rename test/spec/modules/{shBidAdapter_spec.js => showheroes-bsBidAdapter_spec.js} (99%)
diff --git a/modules/shBidAdapter.js b/modules/showheroes-bsBidAdapter.js
similarity index 100%
rename from modules/shBidAdapter.js
rename to modules/showheroes-bsBidAdapter.js
diff --git a/modules/shBidAdapter.md b/modules/showheroes-bsBidAdapter.md
similarity index 100%
rename from modules/shBidAdapter.md
rename to modules/showheroes-bsBidAdapter.md
diff --git a/test/spec/modules/shBidAdapter_spec.js b/test/spec/modules/showheroes-bsBidAdapter_spec.js
similarity index 99%
rename from test/spec/modules/shBidAdapter_spec.js
rename to test/spec/modules/showheroes-bsBidAdapter_spec.js
index 525642da7d65..124f98600d54 100644
--- a/test/spec/modules/shBidAdapter_spec.js
+++ b/test/spec/modules/showheroes-bsBidAdapter_spec.js
@@ -1,5 +1,5 @@
import {expect} from 'chai'
-import {spec} from 'modules/shBidAdapter'
+import {spec} from 'modules/showheroes-bsBidAdapter'
import {newBidder} from 'src/adapters/bidderFactory'
import {VIDEO, BANNER} from 'src/mediaTypes'
From 4eb1e446500949fba5cdf2c3a64e6762f6898e31 Mon Sep 17 00:00:00 2001
From: Denis Logachov
Date: Mon, 9 Dec 2019 23:23:32 +0200
Subject: [PATCH 08/41] Adkernel: tmax support (#4548)
---
modules/adkernelBidAdapter.js | 29 ++++++--------------
test/spec/modules/adkernelBidAdapter_spec.js | 9 +++++-
2 files changed, 17 insertions(+), 21 deletions(-)
diff --git a/modules/adkernelBidAdapter.js b/modules/adkernelBidAdapter.js
index a8cd4fecb41e..29c234528142 100644
--- a/modules/adkernelBidAdapter.js
+++ b/modules/adkernelBidAdapter.js
@@ -36,11 +36,11 @@ export const spec = {
},
buildRequests: function(bidRequests, bidderRequest) {
let impDispatch = dispatchImps(bidRequests, bidderRequest.refererInfo);
- const {gdprConsent, auctionId} = bidderRequest;
+ const {gdprConsent, auctionId, refererInfo, timeout} = bidderRequest;
const requests = [];
Object.keys(impDispatch).forEach(host => {
Object.keys(impDispatch[host]).forEach(zoneId => {
- const request = buildRtbRequest(impDispatch[host][zoneId], auctionId, gdprConsent, bidderRequest.refererInfo);
+ const request = buildRtbRequest(impDispatch[host][zoneId], auctionId, gdprConsent, refererInfo, timeout);
requests.push({
method: 'POST',
url: `https://${host}/hb?zone=${zoneId}&v=${VERSION}`,
@@ -107,8 +107,7 @@ function dispatchImps(bidRequests, refererInfo) {
return bidRequests.map(bidRequest => buildImp(bidRequest, secure))
.reduce((acc, curr, index) => {
let bidRequest = bidRequests[index];
- let zoneId = bidRequest.params.zoneId;
- let host = bidRequest.params.host;
+ let {zoneId, host} = bidRequest.params;
acc[host] = acc[host] || {};
acc[host][zoneId] = acc[host][zoneId] || [];
acc[host][zoneId].push(curr);
@@ -126,14 +125,14 @@ function buildImp(bidRequest, secure) {
};
if (utils.deepAccess(bidRequest, `mediaTypes.banner`)) {
- let sizes = canonicalizeSizesArray(bidRequest.mediaTypes.banner.sizes);
+ let sizes = utils.getAdUnitSizes(bidRequest);
imp.banner = {
format: sizes.map(wh => utils.parseGPTSingleSizeArrayToRtbSize(wh)),
topframe: 0
};
} else if (utils.deepAccess(bidRequest, 'mediaTypes.video')) {
- let size = canonicalizeSizesArray(bidRequest.mediaTypes.video.playerSize)[0];
- imp.video = utils.parseGPTSingleSizeArrayToRtbSize(size);
+ let sizes = bidRequest.mediaTypes.video.playerSize || [];
+ imp.video = utils.parseGPTSingleSizeArrayToRtbSize(sizes[0]) || {};
if (bidRequest.params.video) {
Object.keys(bidRequest.params.video)
.filter(key => includes(VIDEO_TARGETING, key))
@@ -146,27 +145,16 @@ function buildImp(bidRequest, secure) {
return imp;
}
-/**
- * Convert input array of sizes to canonical form Array[Array[Number]]
- * @param sizes
- * @return Array[Array[Number]]
- */
-function canonicalizeSizesArray(sizes) {
- if (sizes.length === 2 && !utils.isArray(sizes[0])) {
- return [sizes];
- }
- return sizes;
-}
-
/**
* Builds complete rtb request
* @param imps collection of impressions
* @param auctionId
* @param gdprConsent
* @param refInfo
+ * @param timeout
* @return Object complete rtb request
*/
-function buildRtbRequest(imps, auctionId, gdprConsent, refInfo) {
+function buildRtbRequest(imps, auctionId, gdprConsent, refInfo, timeout) {
let req = {
'id': auctionId,
'imp': imps,
@@ -178,6 +166,7 @@ function buildRtbRequest(imps, auctionId, gdprConsent, refInfo) {
'js': 1,
'language': getLanguage()
},
+ 'tmax': parseInt(timeout),
'ext': {
'adk_usersync': 1
}
diff --git a/test/spec/modules/adkernelBidAdapter_spec.js b/test/spec/modules/adkernelBidAdapter_spec.js
index c41c56043646..5b3d76ef0713 100644
--- a/test/spec/modules/adkernelBidAdapter_spec.js
+++ b/test/spec/modules/adkernelBidAdapter_spec.js
@@ -161,9 +161,10 @@ describe('Adkernel adapter', function () {
};
function buildBidderRequest(url = 'https://example.com/index.html', params = {}) {
- return Object.assign({}, params, {refererInfo: {referer: url, reachedTop: true}})
+ return Object.assign({}, params, {refererInfo: {referer: url, reachedTop: true}, timeout: 3000});
}
const DEFAULT_BIDDER_REQUEST = buildBidderRequest();
+
function buildRequest(bidRequests, bidderRequest = DEFAULT_BIDDER_REQUEST, dnt = true) {
let dntmock = sinon.stub(utils, 'getDNT').callsFake(() => dnt);
let pbRequests = spec.buildRequests(bidRequests, bidderRequest);
@@ -266,6 +267,12 @@ describe('Adkernel adapter', function () {
let [_, bidRequests] = buildRequest([bid1_zone1], DEFAULT_BIDDER_REQUEST, false);
expect(bidRequests[0].device).to.not.have.property('dnt');
});
+
+ it('should forward default bidder timeout', function() {
+ let [_, bidRequests] = buildRequest([bid1_zone1], DEFAULT_BIDDER_REQUEST);
+ let bidRequest = bidRequests[0];
+ expect(bidRequests[0]).to.have.property('tmax', 3000);
+ });
});
describe('video request building', function () {
From b640d0bf40cab09846d6946ad1cdb1af704420e7 Mon Sep 17 00:00:00 2001
From: jsnellbaker <31102355+jsnellbaker@users.noreply.github.com>
Date: Mon, 9 Dec 2019 16:24:41 -0500
Subject: [PATCH 09/41] move uspDataHandler out of gdprDataHandler (#4562)
* move uspDataHandler out of gdprDataHandler
* add missing semi-colon
---
src/adapterManager.js | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/adapterManager.js b/src/adapterManager.js
index 99e2e31e9e18..4f5f63534a4b 100644
--- a/src/adapterManager.js
+++ b/src/adapterManager.js
@@ -271,6 +271,11 @@ adapterManager.makeBidRequests = function(adUnits, auctionStart, auctionId, cbTi
if (gdprDataHandler.getConsentData()) {
bidRequests.forEach(bidRequest => {
bidRequest['gdprConsent'] = gdprDataHandler.getConsentData();
+ });
+ }
+
+ if (uspDataHandler.getConsentData()) {
+ bidRequests.forEach(bidRequest => {
bidRequest['uspConsent'] = uspDataHandler.getConsentData();
});
}
From 42d856beee4319100270238dd8a2b7538d6ac4ca Mon Sep 17 00:00:00 2001
From: Robert Ray Martinez III
Date: Mon, 9 Dec 2019 14:26:13 -0800
Subject: [PATCH 10/41] Rubicon bid adapter: fix netRev (#4552)
* fix netRev
* adding comments and more tests
---
modules/rubiconBidAdapter.js | 4 +-
test/spec/modules/rubiconBidAdapter_spec.js | 116 +++++++++++++++++++-
2 files changed, 116 insertions(+), 4 deletions(-)
diff --git a/modules/rubiconBidAdapter.js b/modules/rubiconBidAdapter.js
index 075eabc208e1..f42ed0be5b69 100644
--- a/modules/rubiconBidAdapter.js
+++ b/modules/rubiconBidAdapter.js
@@ -559,7 +559,7 @@ export const spec = {
cpm: bid.price || 0,
bidderCode: seatbid.seat,
ttl: 300,
- netRevenue: config.getConfig('rubicon.netRevenue') || true,
+ netRevenue: config.getConfig('rubicon.netRevenue') !== false, // If anything other than false, netRev is true
width: bid.w || utils.deepAccess(bidRequest, 'mediaTypes.video.w') || utils.deepAccess(bidRequest, 'params.video.playerWidth'),
height: bid.h || utils.deepAccess(bidRequest, 'mediaTypes.video.h') || utils.deepAccess(bidRequest, 'params.video.playerHeight'),
};
@@ -639,7 +639,7 @@ export const spec = {
cpm: ad.cpm || 0,
dealId: ad.deal,
ttl: 300, // 5 minutes
- netRevenue: config.getConfig('rubicon.netRevenue') || false,
+ netRevenue: config.getConfig('rubicon.netRevenue') !== false, // If anything other than false, netRev is true
rubicon: {
advertiserId: ad.advertiser, networkId: ad.network
},
diff --git a/test/spec/modules/rubiconBidAdapter_spec.js b/test/spec/modules/rubiconBidAdapter_spec.js
index c0ed4245cbf0..c69415846520 100644
--- a/test/spec/modules/rubiconBidAdapter_spec.js
+++ b/test/spec/modules/rubiconBidAdapter_spec.js
@@ -1760,7 +1760,7 @@ describe('the rubicon adapter', function () {
expect(bids[0].height).to.equal(50);
expect(bids[0].cpm).to.equal(0.911);
expect(bids[0].ttl).to.equal(300);
- expect(bids[0].netRevenue).to.equal(false);
+ expect(bids[0].netRevenue).to.equal(true);
expect(bids[0].rubicon.advertiserId).to.equal(7);
expect(bids[0].rubicon.networkId).to.equal(8);
expect(bids[0].creativeId).to.equal('crid-9');
@@ -1775,7 +1775,7 @@ describe('the rubicon adapter', function () {
expect(bids[1].height).to.equal(250);
expect(bids[1].cpm).to.equal(0.811);
expect(bids[1].ttl).to.equal(300);
- expect(bids[1].netRevenue).to.equal(false);
+ expect(bids[1].netRevenue).to.equal(true);
expect(bids[1].rubicon.advertiserId).to.equal(7);
expect(bids[1].rubicon.networkId).to.equal(8);
expect(bids[1].creativeId).to.equal('crid-9');
@@ -1787,6 +1787,118 @@ describe('the rubicon adapter', function () {
expect(bids[1].rubiconTargeting.rpfl_14062).to.equal('15_tier_all_test');
});
+ it('should pass netRevenue correctly if set in setConfig', function () {
+ let response = {
+ 'status': 'ok',
+ 'account_id': 14062,
+ 'site_id': 70608,
+ 'zone_id': 530022,
+ 'size_id': 15,
+ 'alt_size_ids': [
+ 43
+ ],
+ 'tracking': '',
+ 'inventory': {},
+ 'ads': [
+ {
+ 'status': 'ok',
+ 'impression_id': '153dc240-8229-4604-b8f5-256933b9374c',
+ 'size_id': '15',
+ 'ad_id': '6',
+ 'advertiser': 7,
+ 'network': 8,
+ 'creative_id': 'crid-9',
+ 'type': 'script',
+ 'script': 'alert(\'foo\')',
+ 'campaign_id': 10,
+ 'cpm': 0.811,
+ 'targeting': [
+ {
+ 'key': 'rpfl_14062',
+ 'values': [
+ '15_tier_all_test'
+ ]
+ }
+ ]
+ },
+ {
+ 'status': 'ok',
+ 'impression_id': '153dc240-8229-4604-b8f5-256933b9374d',
+ 'size_id': '43',
+ 'ad_id': '7',
+ 'advertiser': 7,
+ 'network': 8,
+ 'creative_id': 'crid-9',
+ 'type': 'script',
+ 'script': 'alert(\'foo\')',
+ 'campaign_id': 10,
+ 'cpm': 0.911,
+ 'targeting': [
+ {
+ 'key': 'rpfl_14062',
+ 'values': [
+ '43_tier_all_test'
+ ]
+ }
+ ]
+ }
+ ]
+ };
+
+ // Set to false => false
+ config.setConfig({
+ rubicon: {
+ netRevenue: false
+ }
+ });
+ let bids = spec.interpretResponse({body: response}, {
+ bidRequest: bidderRequest.bids[0]
+ });
+ expect(bids).to.be.lengthOf(2);
+ expect(bids[0].netRevenue).to.equal(false);
+ expect(bids[1].netRevenue).to.equal(false);
+
+ // Set to true => true
+ config.setConfig({
+ rubicon: {
+ netRevenue: true
+ }
+ });
+ bids = spec.interpretResponse({body: response}, {
+ bidRequest: bidderRequest.bids[0]
+ });
+ expect(bids).to.be.lengthOf(2);
+ expect(bids[0].netRevenue).to.equal(true);
+ expect(bids[1].netRevenue).to.equal(true);
+
+ // Set to undefined => true
+ config.setConfig({
+ rubicon: {
+ netRevenue: undefined
+ }
+ });
+ bids = spec.interpretResponse({body: response}, {
+ bidRequest: bidderRequest.bids[0]
+ });
+ expect(bids).to.be.lengthOf(2);
+ expect(bids[0].netRevenue).to.equal(true);
+ expect(bids[1].netRevenue).to.equal(true);
+
+ // Set to string => true
+ config.setConfig({
+ rubicon: {
+ netRevenue: 'someString'
+ }
+ });
+ bids = spec.interpretResponse({body: response}, {
+ bidRequest: bidderRequest.bids[0]
+ });
+ expect(bids).to.be.lengthOf(2);
+ expect(bids[0].netRevenue).to.equal(true);
+ expect(bids[1].netRevenue).to.equal(true);
+
+ config.resetConfig();
+ });
it('should use "network-advertiser" if no creative_id', function () {
let response = {
'status': 'ok',
From 1a1dd2f56a5098f0ad68154de04c53a6020dea28 Mon Sep 17 00:00:00 2001
From: Rich Audience
Date: Tue, 10 Dec 2019 15:26:32 +0100
Subject: [PATCH 11/41] RichAudience: Support userIDs + Prebid 3.0 (#4504)
* Support userIDs + Prebid 3.0
* Fix bug in richAudienceBidAddapter_spec.js
* Fix bug pubCommonId
* Fix bug RichaudienceAdapter
* Fix UserID5
* Fix bug ID5 change Source for Value
* Fix bug richaudienceAdapter && Add userSync pixelEnabled
* Fix bug richaudienceAdapter
---
modules/richaudienceBidAdapter.js | 112 ++++--
.../modules/richaudienceBidAdapter_spec.js | 353 ++++++++++++++++--
2 files changed, 404 insertions(+), 61 deletions(-)
mode change 100644 => 100755 modules/richaudienceBidAdapter.js
diff --git a/modules/richaudienceBidAdapter.js b/modules/richaudienceBidAdapter.js
old mode 100644
new mode 100755
index bd47e481a765..2a4fa03c7d62
--- a/modules/richaudienceBidAdapter.js
+++ b/modules/richaudienceBidAdapter.js
@@ -4,6 +4,7 @@ import {BANNER, VIDEO} from '../src/mediaTypes';
import * as utils from '../src/utils';
const BIDDER_CODE = 'richaudience';
+let REFERER = '';
export const spec = {
code: BIDDER_CODE,
@@ -39,22 +40,22 @@ export const spec = {
bidder: bid.bidder,
bidderRequestId: bid.bidderRequestId,
tagId: bid.adUnitCode,
- sizes: bid.sizes.map(size => ({
- w: size[0],
- h: size[1],
- })),
+ sizes: raiGetSizes(bid),
referer: (typeof bidderRequest.refererInfo.referer != 'undefined' ? encodeURIComponent(bidderRequest.refererInfo.referer) : null),
numIframes: (typeof bidderRequest.refererInfo.numIframes != 'undefined' ? bidderRequest.refererInfo.numIframes : null),
transactionId: bid.transactionId,
timeout: config.getConfig('bidderTimeout'),
+ user: raiSetEids(bid)
};
+ REFERER = (typeof bidderRequest.refererInfo.referer != 'undefined' ? encodeURIComponent(bidderRequest.refererInfo.referer) : null)
+
+ payload.gdpr_consent = '';
+ payload.gdpr = null;
+
if (bidderRequest && bidderRequest.gdprConsent) {
payload.gdpr_consent = bidderRequest.gdprConsent.consentString;
- payload.gdpr = bidderRequest.gdprConsent.gdprApplies; // we're handling the undefined case server side
- } else {
- payload.gdpr_consent = '';
- payload.gdpr = null;
+ payload.gdpr = bidderRequest.gdprConsent.gdprApplies;
}
var payloadString = JSON.stringify(payload);
@@ -76,34 +77,29 @@ export const spec = {
*/
interpretResponse: function (serverResponse, bidRequest) {
const bidResponses = [];
-
+ // try catch
var response = serverResponse.body;
+ if (response) {
+ var bidResponse = {
+ requestId: JSON.parse(bidRequest.data).bidId,
+ cpm: response.cpm,
+ width: response.width,
+ height: response.height,
+ creativeId: response.creative_id,
+ mediaType: response.media_type,
+ netRevenue: response.netRevenue,
+ currency: response.currency,
+ ttl: response.ttl,
+ dealId: response.dealId,
+ };
- try {
- if (response) {
- var bidResponse = {
- requestId: JSON.parse(bidRequest.data).bidId,
- cpm: response.cpm,
- width: response.width,
- height: response.height,
- creativeId: response.creative_id,
- mediaType: response.media_type,
- netRevenue: response.netRevenue,
- currency: response.currency,
- ttl: response.ttl,
- dealId: response.dealId,
- };
-
- if (response.media_type === 'video') {
- bidResponse.vastXml = response.vastXML;
- } else {
- bidResponse.ad = response.adm
- }
-
- bidResponses.push(bidResponse);
+ if (response.media_type === 'video') {
+ bidResponse.vastXml = response.vastXML;
+ } else {
+ bidResponse.ad = response.adm
}
- } catch (error) {
- utils.logError('Error while parsing Rich Audience response', error);
+
+ bidResponses.push(bidResponse);
}
return bidResponses
},
@@ -121,20 +117,60 @@ export const spec = {
var rand = Math.floor(Math.random() * 9999999999);
var syncUrl = '';
- if (gdprConsent && typeof gdprConsent.consentString === 'string') {
- syncUrl = 'https://sync.richaudience.com/dcf3528a0b8aa83634892d50e91c306e/?ord=' + rand + '&pubconsent=' + gdprConsent.consentString + '&euconsent=' + gdprConsent.consentString;
- } else {
- syncUrl = 'https://sync.richaudience.com/dcf3528a0b8aa83634892d50e91c306e/?ord=' + rand;
- }
+ gdprConsent && typeof gdprConsent.consentString === 'string' ? syncUrl = 'https://sync.richaudience.com/dcf3528a0b8aa83634892d50e91c306e/?ord=' + rand + '&pubconsent=' + gdprConsent.consentString + '&euconsent=' + gdprConsent.consentString : syncUrl = 'https://sync.richaudience.com/dcf3528a0b8aa83634892d50e91c306e/?ord=' + rand;
if (syncOptions.iframeEnabled) {
syncs.push({
type: 'iframe',
url: syncUrl
});
+ } else if (syncOptions.pixelEnabled && REFERER != null) {
+ syncs.push({
+ type: 'image',
+ url: `https://sync.richaudience.com/bf7c142f4339da0278e83698a02b0854/?euconsent=${gdprConsent.consentString}&referrer=${REFERER}`
+ });
}
return syncs
},
};
registerBidder(spec);
+
+function raiGetSizes(bid) {
+ let raiNewSizes;
+ if (bid.mediaTypes && bid.mediaTypes.banner && bid.mediaTypes.banner.sizes) {
+ raiNewSizes = bid.mediaTypes.banner.sizes
+ } else {
+ raiNewSizes = bid.sizes
+ }
+ if (raiNewSizes != null) {
+ return raiNewSizes.map(size => ({
+ w: size[0],
+ h: size[1]
+ }));
+ }
+}
+
+function raiSetEids(bid) {
+ let eids = [];
+
+ if (bid && bid.userId) {
+ raiSetUserId(bid, eids, 'id5-sync.com', utils.deepAccess(bid, `userId.id5id`));
+ raiSetUserId(bid, eids, 'pubcommon', utils.deepAccess(bid, `userId.pubcid`));
+ raiSetUserId(bid, eids, 'criteo.com', utils.deepAccess(bid, `userId.criteoId`));
+ raiSetUserId(bid, eids, 'liveramp.com', utils.deepAccess(bid, `userId.idl_env`));
+ raiSetUserId(bid, eids, 'liveintent.com', utils.deepAccess(bid, `userId.lipb.lipbid`));
+ raiSetUserId(bid, eids, 'adserver.org', utils.deepAccess(bid, `userId.tdid`));
+ }
+
+ return eids;
+}
+
+function raiSetUserId(bid, eids, source, value) {
+ if (utils.isStr(value)) {
+ eids.push({
+ userId: value,
+ source: source
+ });
+ }
+}
diff --git a/test/spec/modules/richaudienceBidAdapter_spec.js b/test/spec/modules/richaudienceBidAdapter_spec.js
index 16d67ce7ceb4..6c7030676c7e 100644
--- a/test/spec/modules/richaudienceBidAdapter_spec.js
+++ b/test/spec/modules/richaudienceBidAdapter_spec.js
@@ -25,7 +25,30 @@ describe('Richaudience adapter tests', function () {
auctionId: '0cb3144c-d084-4686-b0d6-f5dbe917c563',
bidRequestsCount: 1,
bidderRequestId: '1858b7382993ca',
- transactionId: '29df2112-348b-4961-8863-1b33684d95e6'
+ transactionId: '29df2112-348b-4961-8863-1b33684d95e6',
+ user: {}
+ }];
+
+ var DEFAULT_PARAMS_NEW_SIZES = [{
+ adUnitCode: 'test-div',
+ bidId: '2c7c8e9c900244',
+ mediaTypes: {
+ banner: {
+ sizes: [
+ [300, 250], [300, 600], [728, 90], [970, 250]]
+ }
+ },
+ bidder: 'richaudience',
+ params: {
+ bidfloor: 0.5,
+ pid: 'ADb1f40rmi',
+ supplyType: 'site'
+ },
+ auctionId: '0cb3144c-d084-4686-b0d6-f5dbe917c563',
+ bidRequestsCount: 1,
+ bidderRequestId: '1858b7382993ca',
+ transactionId: '29df2112-348b-4961-8863-1b33684d95e6',
+ user: {}
}];
var DEFAULT_PARAMS_APP = [{
@@ -101,6 +124,17 @@ describe('Richaudience adapter tests', function () {
}
};
+ var DEFAULT_PARAMS_GDPR = {
+ gdprConsent: {
+ consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
+ gdprApplies: true
+ },
+ refererInfo: {
+ referer: 'http://domain.com',
+ numIframes: 0
+ }
+ }
+
it('Verify build request', function () {
config.setConfig({
'currency': {
@@ -108,7 +142,40 @@ describe('Richaudience adapter tests', function () {
}
});
+ const request = spec.buildRequests(DEFAULT_PARAMS, DEFAULT_PARAMS_GDPR);
+
+ expect(request[0]).to.have.property('method').and.to.equal('POST');
+ const requestContent = JSON.parse(request[0].data);
+ expect(requestContent).to.have.property('sizes');
+ expect(requestContent.sizes[0]).to.have.property('w').and.to.equal(300);
+ expect(requestContent.sizes[0]).to.have.property('h').and.to.equal(250);
+ expect(requestContent.sizes[1]).to.have.property('w').and.to.equal(300);
+ expect(requestContent.sizes[1]).to.have.property('h').and.to.equal(600);
+ expect(requestContent.sizes[2]).to.have.property('w').and.to.equal(728);
+ expect(requestContent.sizes[2]).to.have.property('h').and.to.equal(90);
+ expect(requestContent.sizes[3]).to.have.property('w').and.to.equal(970);
+ expect(requestContent.sizes[3]).to.have.property('h').and.to.equal(250);
+ });
+
+ it('Referer undefined', function() {
+ config.setConfig({
+ 'currency': {'adServerCurrency': 'USD'}
+ })
+
const request = spec.buildRequests(DEFAULT_PARAMS, {
+ gdprConsent: {
+ consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
+ gdprApplies: true
+ },
+ refererInfo: {}
+ })
+ const requestContent = JSON.parse(request[0].data);
+ expect(requestContent).to.have.property('referer').and.to.equal(null);
+ expect(requestContent).to.have.property('referer').and.to.equal(null);
+ })
+
+ it('Verify build request to prebid 3.0', function() {
+ const request = spec.buildRequests(DEFAULT_PARAMS_NEW_SIZES, {
gdprConsent: {
consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
gdprApplies: true
@@ -131,14 +198,18 @@ describe('Richaudience adapter tests', function () {
expect(requestContent).to.have.property('bidderRequestId').and.to.equal('1858b7382993ca');
expect(requestContent).to.have.property('tagId').and.to.equal('test-div');
expect(requestContent).to.have.property('referer').and.to.equal('http%3A%2F%2Fdomain.com');
- expect(requestContent).to.have.property('sizes');
expect(requestContent.sizes[0]).to.have.property('w').and.to.equal(300);
expect(requestContent.sizes[0]).to.have.property('h').and.to.equal(250);
expect(requestContent.sizes[1]).to.have.property('w').and.to.equal(300);
expect(requestContent.sizes[1]).to.have.property('h').and.to.equal(600);
+ expect(requestContent.sizes[2]).to.have.property('w').and.to.equal(728);
+ expect(requestContent.sizes[2]).to.have.property('h').and.to.equal(90);
+ expect(requestContent.sizes[3]).to.have.property('w').and.to.equal(970);
+ expect(requestContent.sizes[3]).to.have.property('h').and.to.equal(250);
expect(requestContent).to.have.property('transactionId').and.to.equal('29df2112-348b-4961-8863-1b33684d95e6');
expect(requestContent).to.have.property('timeout').and.to.equal(3000);
- });
+ expect(requestContent).to.have.property('numIframes').and.to.equal(0);
+ })
describe('gdpr test', function () {
it('Verify build request with GDPR', function () {
@@ -153,31 +224,15 @@ describe('Richaudience adapter tests', function () {
}
});
- const request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, {
- gdprConsent: {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true
- },
- refererInfo: {
- referer: 'http://domain.com',
- numIframes: 0
- }
- });
+ const request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
const requestContent = JSON.parse(request[0].data);
expect(requestContent).to.have.property('gdpr_consent').and.to.equal('BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA');
});
it('Verify adding ifa when supplyType equal to app', function () {
- const request = spec.buildRequests(DEFAULT_PARAMS_APP, {
- gdprConsent: {
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
- gdprApplies: true
- },
- refererInfo: {
- referer: 'http://domain.com',
- numIframes: 0
- }
- });
+ const request = spec.buildRequests(DEFAULT_PARAMS_APP, DEFAULT_PARAMS_GDPR);
+ const requestContent = JSON.parse(request[0].data);
+ expect(requestContent).to.have.property('gdpr_consent').and.to.equal('BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA');
});
it('Verify build request with GDPR without gdprApplies', function () {
@@ -206,6 +261,224 @@ describe('Richaudience adapter tests', function () {
});
});
+ describe('UID test', function () {
+ pbjs.setConfig({
+ consentManagement: {
+ cmpApi: 'iab',
+ timeout: 5000,
+ allowAuctionWithoutConsent: true
+ }
+ });
+ it('Verify build id5', function () {
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId = {};
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.id5id = 'id5-user-id';
+
+ var request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ var requestContent = JSON.parse(request[0].data);
+
+ expect(requestContent.user).to.deep.equal([{
+ 'userId': 'id5-user-id',
+ 'source': 'id5-sync.com'
+ }]);
+
+ var request;
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId = {};
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.id5id = 1;
+ request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ var requestContent = JSON.parse(request[0].data);
+
+ expect(requestContent.user.eids).to.equal(undefined);
+
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.id5id = [];
+ request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ requestContent = JSON.parse(request[0].data);
+ expect(requestContent.user.eids).to.equal(undefined);
+
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.id5id = null;
+ request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ requestContent = JSON.parse(request[0].data);
+ expect(requestContent.user.eids).to.equal(undefined);
+
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.id5id = {};
+ request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ requestContent = JSON.parse(request[0].data);
+ expect(requestContent.user.eids).to.equal(undefined);
+ });
+
+ it('Verify build pubCommonId', function () {
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId = {};
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.pubcid = 'pub_common_user_id';
+
+ var request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ var requestContent = JSON.parse(request[0].data);
+
+ expect(requestContent.user).to.deep.equal([{
+ 'userId': 'pub_common_user_id',
+ 'source': 'pubcommon'
+ }]);
+
+ var request;
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId = {};
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.pubcid = 1;
+ request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ var requestContent = JSON.parse(request[0].data);
+ expect(requestContent.user.eids).to.equal(undefined);
+
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.pubcid = [];
+ request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ requestContent = JSON.parse(request[0].data);
+ expect(requestContent.user.eids).to.equal(undefined);
+
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.pubcid = null;
+ request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ requestContent = JSON.parse(request[0].data);
+ expect(requestContent.user.eids).to.equal(undefined);
+
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.pubcid = {};
+ request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ requestContent = JSON.parse(request[0].data);
+ expect(requestContent.user.eids).to.equal(undefined);
+ });
+
+ it('Verify build criteoId', function () {
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId = {};
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.criteoId = 'criteo-user-id';
+
+ var request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ var requestContent = JSON.parse(request[0].data);
+
+ expect(requestContent.user).to.deep.equal([{
+ 'userId': 'criteo-user-id',
+ 'source': 'criteo.com'
+ }]);
+
+ var request;
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId = {};
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.criteoId = 1;
+ request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ var requestContent = JSON.parse(request[0].data);
+ expect(requestContent.user.eids).to.equal(undefined);
+
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.criteoId = [];
+ request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ requestContent = JSON.parse(request[0].data);
+ expect(requestContent.user.eids).to.equal(undefined);
+
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.criteoId = null;
+ request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ requestContent = JSON.parse(request[0].data);
+ expect(requestContent.user.eids).to.equal(undefined);
+
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.criteoId = {};
+ request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ requestContent = JSON.parse(request[0].data);
+ expect(requestContent.user.eids).to.equal(undefined);
+ });
+
+ it('Verify build identityLink', function () {
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId = {};
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.idl_env = 'identity-link-user-id';
+
+ var request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ var requestContent = JSON.parse(request[0].data);
+
+ expect(requestContent.user).to.deep.equal([{
+ 'userId': 'identity-link-user-id',
+ 'source': 'liveramp.com'
+ }]);
+
+ var request;
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId = {};
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.idl_env = 1;
+ request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ var requestContent = JSON.parse(request[0].data);
+ expect(requestContent.user.eids).to.equal(undefined);
+
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.criteoId = [];
+ request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ requestContent = JSON.parse(request[0].data);
+ expect(requestContent.user.eids).to.equal(undefined);
+
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.idl_env = null;
+ request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ requestContent = JSON.parse(request[0].data);
+ expect(requestContent.user.eids).to.equal(undefined);
+
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.idl_env = {};
+ request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ requestContent = JSON.parse(request[0].data);
+ expect(requestContent.user.eids).to.equal(undefined);
+ });
+ it('Verify build liveIntentId', function () {
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId = {};
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.idl_env = 'identity-link-user-id';
+
+ var request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ var requestContent = JSON.parse(request[0].data)
+
+ expect(requestContent.user).to.deep.equal([{
+ 'userId': 'identity-link-user-id',
+ 'source': 'liveramp.com'
+ }]);
+
+ var request;
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId = {};
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.idl_env = 1;
+ request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ var requestContent = JSON.parse(request[0].data);
+ expect(requestContent.user.eids).to.equal(undefined);
+
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.criteoId = [];
+ request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ requestContent = JSON.parse(request[0].data);
+ expect(requestContent.user.eids).to.equal(undefined);
+
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.idl_env = null;
+ request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ requestContent = JSON.parse(request[0].data);
+ expect(requestContent.user.eids).to.equal(undefined);
+
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.idl_env = {};
+ request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ requestContent = JSON.parse(request[0].data);
+ expect(requestContent.user.eids).to.equal(undefined);
+ });
+ it('Verify build TradeDesk', function () {
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId = {};
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.tdid = 'tdid-user-id';
+
+ var request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ var requestContent = JSON.parse(request[0].data)
+
+ expect(requestContent.user).to.deep.equal([{
+ 'userId': 'tdid-user-id',
+ 'source': 'adserver.org'
+ }]);
+
+ request;
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId = {};
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.idl_env = 1;
+ request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ requestContent = JSON.parse(request[0].data);
+ expect(requestContent.user.eids).to.equal(undefined);
+
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.criteoId = [];
+ request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ requestContent = JSON.parse(request[0].data);
+ expect(requestContent.user.eids).to.equal(undefined);
+
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.idl_env = null;
+ request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ requestContent = JSON.parse(request[0].data);
+ expect(requestContent.user.eids).to.equal(undefined);
+
+ DEFAULT_PARAMS_WO_OPTIONAL[0].userId.idl_env = {};
+ request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, DEFAULT_PARAMS_GDPR);
+ requestContent = JSON.parse(request[0].data);
+ expect(requestContent.user.eids).to.equal(undefined);
+ });
+ });
+
it('Verify interprete response', function () {
const request = spec.buildRequests(DEFAULT_PARAMS, {
gdprConsent: {
@@ -343,5 +616,39 @@ describe('Richaudience adapter tests', function () {
iframeEnabled: true
}, [], {consentString: '', gdprApplies: false});
expect(syncs).to.have.lengthOf(1);
+
+ syncs = spec.getUserSyncs({
+ iframeEnabled: false
+ }, [], {consentString: '', gdprApplies: true});
+ expect(syncs).to.have.lengthOf(0);
+
+ pbjs.setConfig({
+ consentManagement: {
+ cmpApi: 'iab',
+ timeout: 5000,
+ allowAuctionWithoutConsent: true,
+ pixelEnabled: true
+ }
+ });
+
+ syncs = spec.getUserSyncs({
+ pixelEnabled: true
+ }, [], {
+ consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
+ referer: 'http://domain.com',
+ gdprApplies: true
+ })
+ expect(syncs).to.have.lengthOf(1);
+ expect(syncs[0].type).to.equal('image');
+
+ syncs = spec.getUserSyncs({
+ pixelEnabled: true
+ }, [], {
+ consentString: '',
+ referer: 'http://domain.com',
+ gdprApplies: true
+ })
+ expect(syncs).to.have.lengthOf(1);
+ expect(syncs[0].type).to.equal('image');
});
});
From 2a5cfaa6c7e1274090ec72d649442dc14aa6bf29 Mon Sep 17 00:00:00 2001
From: Bill Newman
Date: Tue, 10 Dec 2019 16:56:54 +0200
Subject: [PATCH 12/41] CCPA and Schain support (#4537)
* add video&native traffic colossus ssp
* Native obj validation
* Native obj validation #2
* Added size field in requests
* fixed test
* fix merge conflicts
* move to 3.0
* move to 3.0
* fix IE11 new URL issue
* fix IE11 new URL issue
* fix IE11 new URL issue
* https for 3.0
* add https test
* add ccp and schain features
* fix test
* sync with upstream, fix conflicts
* Update colossussspBidAdapter.js
remove commented code
* Update colossussspBidAdapter.js
lint fix
---
modules/colossussspBidAdapter.js | 9 ++++
.../modules/colossussspBidAdapter_spec.js | 41 +++++++++++++++++--
2 files changed, 46 insertions(+), 4 deletions(-)
diff --git a/modules/colossussspBidAdapter.js b/modules/colossussspBidAdapter.js
index 9f02f5057c14..adcd5df9fb62 100644
--- a/modules/colossussspBidAdapter.js
+++ b/modules/colossussspBidAdapter.js
@@ -63,6 +63,12 @@ export const spec = {
'placements': placements
};
+ if (bidderRequest) {
+ if (bidderRequest.uspConsent) {
+ request.ccpa = bidderRequest.uspConsent;
+ }
+ }
+
for (let i = 0; i < validBidRequests.length; i++) {
let bid = validBidRequests[i];
let traff = bid.params.traffic || BANNER
@@ -72,6 +78,9 @@ export const spec = {
sizes: bid.mediaTypes[traff].sizes,
traffic: traff
};
+ if (bid.schain) {
+ placement.schain = bid.schain;
+ }
placements.push(placement);
}
return {
diff --git a/test/spec/modules/colossussspBidAdapter_spec.js b/test/spec/modules/colossussspBidAdapter_spec.js
index f50422206107..9ed2dbe6e6b6 100644
--- a/test/spec/modules/colossussspBidAdapter_spec.js
+++ b/test/spec/modules/colossussspBidAdapter_spec.js
@@ -16,8 +16,36 @@ describe('ColossussspAdapter', function () {
sizes: [[300, 250]]
}
},
- transactionId: '3bb2f6da-87a6-4029-aeb0-bfe951372e62'
+ transactionId: '3bb2f6da-87a6-4029-aeb0-bfe951372e62',
+ schain: {
+ ver: '1.0',
+ complete: 1,
+ nodes: [
+ {
+ asi: 'example.com',
+ sid: '0',
+ hp: 1,
+ rid: 'bidrequestid',
+ // name: 'alladsallthetime',
+ domain: 'example.com'
+ }
+ ]
+ }
};
+ let bidderRequest = {
+ bidderCode: 'colossus',
+ auctionId: 'fffffff-ffff-ffff-ffff-ffffffffffff',
+ bidderRequestId: 'ffffffffffffff',
+ start: 1472239426002,
+ auctionStart: 1472239426000,
+ timeout: 5000,
+ uspConsent: '1YN-',
+ refererInfo: {
+ referer: 'http://www.example.com',
+ reachedTop: true,
+ },
+ bids: [bid]
+ }
describe('isBidRequestValid', function () {
it('Should return true when placement_id can be cast to a number', function () {
@@ -30,7 +58,7 @@ describe('ColossussspAdapter', function () {
});
describe('buildRequests', function () {
- let serverRequest = spec.buildRequests([bid]);
+ let serverRequest = spec.buildRequests([bid], bidderRequest);
it('Creates a ServerRequest object with method, URL and data', function () {
expect(serverRequest).to.exist;
expect(serverRequest.method).to.exist;
@@ -43,10 +71,14 @@ describe('ColossussspAdapter', function () {
it('Returns valid URL', function () {
expect(serverRequest.url).to.equal('https://colossusssp.com/?c=o&m=multi');
});
+ it('Should contain ccpa', function() {
+ expect(serverRequest.data.ccpa).to.be.an('string')
+ })
+
it('Returns valid data if array of bids is valid', function () {
let data = serverRequest.data;
expect(data).to.be.an('object');
- expect(data).to.have.all.keys('deviceWidth', 'deviceHeight', 'language', 'secure', 'host', 'page', 'placements');
+ expect(data).to.have.all.keys('deviceWidth', 'deviceHeight', 'language', 'secure', 'host', 'page', 'placements', 'ccpa');
expect(data.deviceWidth).to.be.a('number');
expect(data.deviceHeight).to.be.a('number');
expect(data.language).to.be.a('string');
@@ -56,7 +88,8 @@ describe('ColossussspAdapter', function () {
let placements = data['placements'];
for (let i = 0; i < placements.length; i++) {
let placement = placements[i];
- expect(placement).to.have.all.keys('placementId', 'bidId', 'traffic', 'sizes');
+ expect(placement).to.have.all.keys('placementId', 'bidId', 'traffic', 'sizes', 'schain');
+ expect(placement.schain).to.be.an('object')
expect(placement.placementId).to.be.a('number');
expect(placement.bidId).to.be.a('string');
expect(placement.traffic).to.be.a('string');
From 847b35357596cac7b55f8777f1b1e4eb6b22eda3 Mon Sep 17 00:00:00 2001
From: r-schweitzer <50628828+r-schweitzer@users.noreply.github.com>
Date: Tue, 10 Dec 2019 10:25:28 -0500
Subject: [PATCH 13/41] added check in register syncs to not sync aliased
bidders (#4435)
---
src/adapters/bidderFactory.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/adapters/bidderFactory.js b/src/adapters/bidderFactory.js
index 18408e78d179..602d9e53b03b 100644
--- a/src/adapters/bidderFactory.js
+++ b/src/adapters/bidderFactory.js
@@ -331,7 +331,7 @@ export function newBidder(spec) {
});
function registerSyncs(responses, gdprConsent, uspConsent) {
- if (spec.getUserSyncs) {
+ if (spec.getUserSyncs && !adapterManager.aliasRegistry[spec.code]) {
let filterConfig = config.getConfig('userSync.filterSettings');
let syncs = spec.getUserSyncs({
iframeEnabled: !!(config.getConfig('userSync.iframeEnabled') || (filterConfig && (filterConfig.iframe || filterConfig.all))),
From 99a1822e966b1d9750dd78a73d1aa288e27efddc Mon Sep 17 00:00:00 2001
From: susyt
Date: Tue, 10 Dec 2019 07:47:09 -0800
Subject: [PATCH 14/41] GumGum: adds inScreenPubID param (#4490)
* adds schain param
* adds pubId param depending on inScreen val type
* sets pubId param if inScreenPubID is present
* update test
* fixed test description
---
modules/gumgumBidAdapter.js | 4 ++++
test/spec/modules/gumgumBidAdapter_spec.js | 11 +++++++++++
2 files changed, 15 insertions(+)
diff --git a/modules/gumgumBidAdapter.js b/modules/gumgumBidAdapter.js
index df6ca1971ee0..2325e1bc4483 100644
--- a/modules/gumgumBidAdapter.js
+++ b/modules/gumgumBidAdapter.js
@@ -176,6 +176,10 @@ function buildRequests (validBidRequests, bidderRequest) {
if (params.bidfloor) {
data.fp = params.bidfloor;
}
+ if (params.inScreenPubID) {
+ data.pubId = params.inScreenPubID;
+ data.pi = 2;
+ }
if (params.inScreen) {
data.t = params.inScreen;
data.pi = 2;
diff --git a/test/spec/modules/gumgumBidAdapter_spec.js b/test/spec/modules/gumgumBidAdapter_spec.js
index 97897a11ed3b..cbd71cc82f06 100644
--- a/test/spec/modules/gumgumBidAdapter_spec.js
+++ b/test/spec/modules/gumgumBidAdapter_spec.js
@@ -118,6 +118,17 @@ describe('gumgumAdapter', function () {
expect(bidRequest.data).to.include.any.keys('t');
expect(bidRequest.data).to.include.any.keys('fp');
});
+ it('should send pubId if inScreenPubID param is specified', function () {
+ const request = Object.assign({}, bidRequests[0]);
+ delete request.params;
+ request.params = {
+ 'inScreenPubID': 123
+ };
+ const bidRequest = spec.buildRequests([request])[0];
+ expect(bidRequest.data).to.include.any.keys('pubId');
+ expect(bidRequest.data.pubId).to.equal(request.params.inScreenPubID);
+ expect(bidRequest.data).to.not.include.any.keys('t');
+ });
it('should correctly set the request paramters depending on params field', function () {
const request = Object.assign({}, bidRequests[0]);
delete request.params;
From 5b57f48a19c659eba50e0948b5f41138bb630047 Mon Sep 17 00:00:00 2001
From: Paul Yang
Date: Tue, 10 Dec 2019 07:54:30 -0800
Subject: [PATCH 15/41] Use 'pubcid.org' as the source for pubcid in extended
IDs (#4561)
---
modules/prebidServerBidAdapter/index.js | 6 +++---
test/spec/modules/prebidServerBidAdapter_spec.js | 16 ++++++++--------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/modules/prebidServerBidAdapter/index.js b/modules/prebidServerBidAdapter/index.js
index 3f0150aca41e..b7f3f082ccec 100644
--- a/modules/prebidServerBidAdapter/index.js
+++ b/modules/prebidServerBidAdapter/index.js
@@ -646,7 +646,7 @@ const OPEN_RTB_PROTOCOL = {
});
if (!imps.length) {
- utils.logError('Request to Prebid Server rejected due to invalid media type(s) in adUnit.')
+ utils.logError('Request to Prebid Server rejected due to invalid media type(s) in adUnit.');
return;
}
const request = {
@@ -721,7 +721,7 @@ const OPEN_RTB_PROTOCOL = {
if (bidUserId.pubcid) {
request.user.ext.eids.push({
- source: 'pubcommon',
+ source: 'pubcid.org',
uids: [{
id: bidUserId.pubcid,
}]
@@ -955,7 +955,7 @@ const isOpenRtb = () => {
const endpoint = (_s2sConfig && _s2sConfig.endpoint) || '';
return ~endpoint.indexOf(OPEN_RTB_PATH);
-}
+};
/*
* Returns the required protocol adapter to communicate with the configured
diff --git a/test/spec/modules/prebidServerBidAdapter_spec.js b/test/spec/modules/prebidServerBidAdapter_spec.js
index cdb674509cbe..c198502d4b3c 100644
--- a/test/spec/modules/prebidServerBidAdapter_spec.js
+++ b/test/spec/modules/prebidServerBidAdapter_spec.js
@@ -580,7 +580,7 @@ describe('S2S Adapter', function () {
it('should not add outstrean without renderer', function () {
let ortb2Config = utils.deepClone(CONFIG);
- ortb2Config.endpoint = 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction'
+ ortb2Config.endpoint = 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction';
config.setConfig({ s2sConfig: ortb2Config });
adapter.callBids(OUTSTREAM_VIDEO_REQUEST, BID_REQUESTS, addBidResponse, done, ajax);
@@ -611,7 +611,7 @@ describe('S2S Adapter', function () {
it('adds gdpr consent information to ortb2 request depending on presence of module', function () {
let ortb2Config = utils.deepClone(CONFIG);
- ortb2Config.endpoint = 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction'
+ ortb2Config.endpoint = 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction';
let consentConfig = { consentManagement: { cmpApi: 'iab' }, s2sConfig: ortb2Config };
config.setConfig(consentConfig);
@@ -710,7 +710,7 @@ describe('S2S Adapter', function () {
it('is added to ortb2 request when in bidRequest', function () {
let ortb2Config = utils.deepClone(CONFIG);
- ortb2Config.endpoint = 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction'
+ ortb2Config.endpoint = 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction';
config.setConfig({ s2sConfig: ortb2Config });
let uspBidRequest = utils.deepClone(BID_REQUESTS);
@@ -755,7 +755,7 @@ describe('S2S Adapter', function () {
it('is added to ortb2 request when in bidRequest', function () {
let ortb2Config = utils.deepClone(CONFIG);
- ortb2Config.endpoint = 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction'
+ ortb2Config.endpoint = 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction';
config.setConfig({ s2sConfig: ortb2Config });
let consentBidRequest = utils.deepClone(BID_REQUESTS);
@@ -984,7 +984,7 @@ describe('S2S Adapter', function () {
const _config = {
s2sConfig: s2sConfig,
- }
+ };
config.setConfig(_config);
adapter.callBids(REQUEST, BID_REQUESTS, addBidResponse, done, ajax);
@@ -1200,8 +1200,8 @@ describe('S2S Adapter', function () {
expect(requestBid.user.ext.eids.filter(eid => eid.source === 'adserver.org')[0].uids[0].id).is.equal('abc123');
expect(requestBid.user.ext.eids.filter(eid => eid.source === 'criteo.com')).is.not.empty;
expect(requestBid.user.ext.eids.filter(eid => eid.source === 'criteo.com')[0].uids[0].id).is.equal('44VmRDeUE3ZGJ5MzRkRVJHU3BIUlJ6TlFPQUFU');
- expect(requestBid.user.ext.eids.filter(eid => eid.source === 'pubcommon')).is.not.empty;
- expect(requestBid.user.ext.eids.filter(eid => eid.source === 'pubcommon')[0].uids[0].id).is.equal('1234');
+ expect(requestBid.user.ext.eids.filter(eid => eid.source === 'pubcid.org')).is.not.empty;
+ expect(requestBid.user.ext.eids.filter(eid => eid.source === 'pubcid.org')[0].uids[0].id).is.equal('1234');
expect(requestBid.user.ext.eids.filter(eid => eid.source === 'parrable.com')).is.not.empty;
expect(requestBid.user.ext.eids.filter(eid => eid.source === 'parrable.com')[0].uids[0].id).is.equal('01.1563917337.test-eid');
expect(requestBid.user.ext.eids.filter(eid => eid.source === 'liveintent.com')).is.not.empty;
@@ -1768,7 +1768,7 @@ describe('S2S Adapter', function () {
const _config = {
s2sConfig: s2sConfig,
- }
+ };
config.setConfig(_config);
config.setConfig({ s2sConfig: CONFIG });
From df35628acc0dc42fab81a7e7c900788ad4e39749 Mon Sep 17 00:00:00 2001
From: Alex Khmelnitsky
Date: Tue, 10 Dec 2019 18:03:42 +0200
Subject: [PATCH 16/41] added additional ad unit counters (#4448)
---
src/adUnits.js | 72 ++++++++++++++++++++++++++++++----
src/adapterManager.js | 5 ++-
src/prebid.js | 4 +-
test/spec/unit/adUnits_spec.js | 48 +++++++++++++++++------
4 files changed, 108 insertions(+), 21 deletions(-)
diff --git a/src/adUnits.js b/src/adUnits.js
index bbdc82b60736..aa88cf6eac5f 100644
--- a/src/adUnits.js
+++ b/src/adUnits.js
@@ -2,15 +2,47 @@ import { deepAccess } from './utils';
let adUnits = {};
+function ensureAdUnit(adunit, bidderCode) {
+ let adUnit = adUnits[adunit] = adUnits[adunit] || { bidders: {} };
+ if (bidderCode) {
+ return adUnit.bidders[bidderCode] = adUnit.bidders[bidderCode] || {}
+ }
+ return adUnit;
+}
+
+function incrementAdUnitCount(adunit, counter, bidderCode) {
+ let adUnit = ensureAdUnit(adunit, bidderCode);
+ adUnit[counter] = (adUnit[counter] || 0) + 1;
+ return adUnit[counter];
+}
+
/**
* Increments and returns current Adunit counter
* @param {string} adunit id
* @returns {number} current adunit count
*/
-function incrementCounter(adunit) {
- adUnits[adunit] = adUnits[adunit] || {};
- adUnits[adunit].counter = (deepAccess(adUnits, `${adunit}.counter`) + 1) || 1;
- return adUnits[adunit].counter;
+function incrementRequestsCounter(adunit) {
+ return incrementAdUnitCount(adunit, 'requestsCounter');
+}
+
+/**
+ * Increments and returns current Adunit requests counter for a bidder
+ * @param {string} adunit id
+ * @param {string} bidderCode code
+ * @returns {number} current adunit bidder requests count
+ */
+function incrementBidderRequestsCounter(adunit, bidderCode) {
+ return incrementAdUnitCount(adunit, 'requestsCounter', bidderCode);
+}
+
+/**
+ * Increments and returns current Adunit wins counter for a bidder
+ * @param {string} adunit id
+ * @param {string} bidderCode code
+ * @returns {number} current adunit bidder requests count
+ */
+function incrementBidderWinsCounter(adunit, bidderCode) {
+ return incrementAdUnitCount(adunit, 'winsCounter', bidderCode);
}
/**
@@ -18,8 +50,28 @@ function incrementCounter(adunit) {
* @param {string} adunit id
* @returns {number} current adunit count
*/
-function getCounter(adunit) {
- return deepAccess(adUnits, `${adunit}.counter`) || 0;
+function getRequestsCounter(adunit) {
+ return deepAccess(adUnits, `${adunit}.requestsCounter`) || 0;
+}
+
+/**
+ * Returns current Adunit requests counter for a specific bidder code
+ * @param {string} adunit id
+ * @param {string} bidder code
+ * @returns {number} current adunit bidder requests count
+ */
+function getBidderRequestsCounter(adunit, bidder) {
+ return deepAccess(adUnits, `${adunit}.bidders.${bidder}.requestsCounter`) || 0;
+}
+
+/**
+ * Returns current Adunit requests counter for a specific bidder code
+ * @param {string} adunit id
+ * @param {string} bidder code
+ * @returns {number} current adunit bidder requests count
+ */
+function getBidderWinsCounter(adunit, bidder) {
+ return deepAccess(adUnits, `${adunit}.bidders.${bidder}.winsCounter`) || 0;
}
/**
@@ -27,8 +79,12 @@ function getCounter(adunit) {
* @module adunitCounter
*/
let adunitCounter = {
- incrementCounter,
- getCounter
+ incrementRequestsCounter,
+ incrementBidderRequestsCounter,
+ incrementBidderWinsCounter,
+ getRequestsCounter,
+ getBidderRequestsCounter,
+ getBidderWinsCounter
}
export { adunitCounter };
diff --git a/src/adapterManager.js b/src/adapterManager.js
index 4f5f63534a4b..f4b63a4d58b1 100644
--- a/src/adapterManager.js
+++ b/src/adapterManager.js
@@ -100,7 +100,9 @@ function getBids({bidderCode, auctionId, bidderRequestId, adUnits, labels, src})
bidderRequestId,
auctionId,
src,
- bidRequestsCount: adunitCounter.getCounter(adUnit.code),
+ bidRequestsCount: adunitCounter.getRequestsCounter(adUnit.code),
+ bidderRequestsCount: adunitCounter.getBidderRequestsCounter(adUnit.code, bid.bidder),
+ bidderWinsCount: adunitCounter.getBidderWinsCounter(adUnit.code, bid.bidder),
}));
}
return bids;
@@ -518,6 +520,7 @@ adapterManager.callTimedOutBidders = function(adUnits, timedOutBidders, cbTimeou
adapterManager.callBidWonBidder = function(bidder, bid, adUnits) {
// Adding user configured params to bidWon event data
bid.params = utils.getUserConfiguredParams(adUnits, bid.adUnitCode, bid.bidder);
+ adunitCounter.incrementBidderWinsCounter(bid.adUnitCode, bid.bidder);
tryCallBidderMethod(bidder, 'onBidWon', bid);
};
diff --git a/src/prebid.js b/src/prebid.js
index 44649d7d444c..20d93372837d 100644
--- a/src/prebid.js
+++ b/src/prebid.js
@@ -456,9 +456,11 @@ $$PREBID_GLOBAL$$.requestBids = hook('async', function ({ bidsBackHandler, timeo
// drop the bidder from the ad unit if it's not compatible
utils.logWarn(utils.unsupportedBidderMessage(adUnit, bidder));
adUnit.bids = adUnit.bids.filter(bid => bid.bidder !== bidder);
+ } else {
+ adunitCounter.incrementBidderRequestsCounter(adUnit.code, bidder);
}
});
- adunitCounter.incrementCounter(adUnit.code);
+ adunitCounter.incrementRequestsCounter(adUnit.code);
});
if (!adUnits || adUnits.length === 0) {
diff --git a/test/spec/unit/adUnits_spec.js b/test/spec/unit/adUnits_spec.js
index ff77315ba4ad..fb666feb9b8b 100644
--- a/test/spec/unit/adUnits_spec.js
+++ b/test/spec/unit/adUnits_spec.js
@@ -4,20 +4,46 @@ import { adunitCounter } from 'src/adUnits';
describe('Adunit Counter', function () {
const ADUNIT_ID_1 = 'test1';
const ADUNIT_ID_2 = 'test2';
+ const BIDDER_ID_1 = 'bidder1';
+ const BIDDER_ID_2 = 'bidder2';
- it('increments and checks counter of adunit 1', function () {
- adunitCounter.incrementCounter(ADUNIT_ID_1);
- expect(adunitCounter.getCounter(ADUNIT_ID_1)).to.be.equal(1);
+ it('increments and checks requests counter of adunit 1', function () {
+ adunitCounter.incrementRequestsCounter(ADUNIT_ID_1);
+ expect(adunitCounter.getRequestsCounter(ADUNIT_ID_1)).to.be.equal(1);
});
- it('checks counter of adunit 2', function () {
- expect(adunitCounter.getCounter(ADUNIT_ID_2)).to.be.equal(0);
+ it('checks requests counter of adunit 2', function () {
+ expect(adunitCounter.getRequestsCounter(ADUNIT_ID_2)).to.be.equal(0);
});
- it('increments and checks counter of adunit 1', function () {
- adunitCounter.incrementCounter(ADUNIT_ID_1);
- expect(adunitCounter.getCounter(ADUNIT_ID_1)).to.be.equal(2);
+ it('increments and checks requests counter of adunit 1', function () {
+ adunitCounter.incrementRequestsCounter(ADUNIT_ID_1);
+ expect(adunitCounter.getRequestsCounter(ADUNIT_ID_1)).to.be.equal(2);
});
- it('increments and checks counter of adunit 2', function () {
- adunitCounter.incrementCounter(ADUNIT_ID_2);
- expect(adunitCounter.getCounter(ADUNIT_ID_2)).to.be.equal(1);
+ it('increments and checks requests counter of adunit 2', function () {
+ adunitCounter.incrementRequestsCounter(ADUNIT_ID_2);
+ expect(adunitCounter.getRequestsCounter(ADUNIT_ID_2)).to.be.equal(1);
+ });
+ it('increments and checks requests counter of adunit 1 for bidder 1', function () {
+ adunitCounter.incrementBidderRequestsCounter(ADUNIT_ID_1, BIDDER_ID_1);
+ expect(adunitCounter.getBidderRequestsCounter(ADUNIT_ID_1, BIDDER_ID_1)).to.be.equal(1);
+ });
+ it('increments and checks requests counter of adunit 1 for bidder 2', function () {
+ adunitCounter.incrementBidderRequestsCounter(ADUNIT_ID_1, BIDDER_ID_2);
+ expect(adunitCounter.getBidderRequestsCounter(ADUNIT_ID_1, BIDDER_ID_2)).to.be.equal(1);
+ });
+ it('increments and checks requests counter of adunit 1 for bidder 1', function () {
+ adunitCounter.incrementBidderRequestsCounter(ADUNIT_ID_1, BIDDER_ID_1);
+ expect(adunitCounter.getBidderRequestsCounter(ADUNIT_ID_1, BIDDER_ID_1)).to.be.equal(2);
+ });
+ it('increments and checks wins counter of adunit 1 for bidder 1', function () {
+ adunitCounter.incrementBidderWinsCounter(ADUNIT_ID_1, BIDDER_ID_1);
+ expect(adunitCounter.getBidderWinsCounter(ADUNIT_ID_1, BIDDER_ID_1)).to.be.equal(1);
+ });
+ it('increments and checks wins counter of adunit 2 for bidder 1', function () {
+ adunitCounter.incrementBidderWinsCounter(ADUNIT_ID_2, BIDDER_ID_1);
+ expect(adunitCounter.getBidderWinsCounter(ADUNIT_ID_2, BIDDER_ID_1)).to.be.equal(1);
+ });
+ it('increments and checks wins counter of adunit 1 for bidder 2', function () {
+ adunitCounter.incrementBidderWinsCounter(ADUNIT_ID_1, BIDDER_ID_2);
+ expect(adunitCounter.getBidderWinsCounter(ADUNIT_ID_1, BIDDER_ID_2)).to.be.equal(1);
});
});
From a7c5b803fe509e428a3321f85fc1d1a9803da02c Mon Sep 17 00:00:00 2001
From: hdwmsconfig
Date: Tue, 10 Dec 2019 15:35:38 -0300
Subject: [PATCH 17/41] Add viewability to e-planning bid adapter (#4471)
* add viewability e-planning bid adapter
* change viewability and spaces name
* fix in viewability
* fix in viewability
---
modules/eplanningBidAdapter.js | 263 ++++++++++++-
test/spec/modules/eplanningBidAdapter_spec.js | 371 +++++++++++++++++-
2 files changed, 609 insertions(+), 25 deletions(-)
diff --git a/modules/eplanningBidAdapter.js b/modules/eplanningBidAdapter.js
index 01a956d1bd85..d9e145544836 100644
--- a/modules/eplanningBidAdapter.js
+++ b/modules/eplanningBidAdapter.js
@@ -11,9 +11,12 @@ const NET_REVENUE = true;
const TTL = 120;
const NULL_SIZE = '1x1';
const FILE = 'file';
+const STORAGE_RENDER_PREFIX = 'pbsr_';
+const STORAGE_VIEW_PREFIX = 'pbvi_';
export const spec = {
code: BIDDER_CODE,
+
isBidRequestValid: function(bid) {
return Boolean(bid.params.ci) || Boolean(bid.params.t);
},
@@ -26,21 +29,26 @@ export const spec = {
let params;
const urlConfig = getUrlConfig(bidRequests);
const pcrs = getCharset();
-
+ const spaces = getSpaces(bidRequests);
if (urlConfig.t) {
url = urlConfig.isv + '/layers/t_pbjs_2.json';
params = {};
} else {
url = '//' + (urlConfig.sv || DEFAULT_SV) + '/hb/1/' + urlConfig.ci + '/' + dfpClientId + '/' + (utils.getTopWindowLocation().hostname || FILE) + '/' + sec;
const referrerUrl = utils.getTopWindowReferrer();
- const spacesString = getSpacesString(bidRequests);
+
+ if (utils.hasLocalStorage()) {
+ registerViewabilityAllBids(bidRequests);
+ }
+
params = {
rnd: rnd,
- e: spacesString,
+ e: spaces.str,
ur: utils.getTopWindowUrl() || FILE,
r: 'pbjs',
pbv: '$prebid.version$',
- ncb: '1'
+ ncb: '1',
+ vs: spaces.vs
};
if (pcrs) {
@@ -56,7 +64,7 @@ export const spec = {
method: method,
url: url,
data: params,
- adUnitToBidId: getBidIdMap(bidRequests),
+ adUnitToBidId: spaces.map,
};
},
interpretResponse: function(serverResponse, request) {
@@ -111,9 +119,6 @@ export const spec = {
},
}
-function cleanName(name) {
- return name.replace(/_|\.|-|\//g, '').replace(/\)\(|\(|\)|:/g, '_').replace(/^_+|_+$/g, '');
-}
function getUrlConfig(bidRequests) {
if (isTestRequest(bidRequests)) {
return getTestConfig(bidRequests.filter(br => br.params.t));
@@ -135,9 +140,12 @@ function getUrlConfig(bidRequests) {
return config;
}
function isTestRequest(bidRequests) {
- let isTest = false;
- bidRequests.forEach(bid => isTest = bid.params.t);
- return isTest;
+ for (let i = 0; i < bidRequests.length; i++) {
+ if (bidRequests[i].params.t) {
+ return true;
+ }
+ }
+ return false;
}
function getTestConfig(bidRequests) {
let isv;
@@ -147,14 +155,55 @@ function getTestConfig(bidRequests) {
isv: '//' + (isv || DEFAULT_ISV)
};
}
-function getSpacesString(bids) {
- const spacesString = bids.map(bid =>
- cleanName(bid.adUnitCode) + ':' + (bid.sizes && bid.sizes.length ? utils.parseSizesInput(bid.sizes).join(',') : NULL_SIZE)
- ).join('+');
- return spacesString;
+function getSize(bid, first) {
+ return bid.sizes && bid.sizes.length ? utils.parseSizesInput(first ? bid.sizes[0] : bid.sizes).join(',') : NULL_SIZE;
+}
+
+function getSpacesStruct(bids) {
+ let e = {};
+ bids.forEach(bid => {
+ let size = getSize(bid, true);
+ e[size] = e[size] ? e[size] : [];
+ e[size].push(bid);
+ });
+
+ return e;
+}
+
+function getSpaces(bidRequests) {
+ let spacesStruct = getSpacesStruct(bidRequests);
+ let es = {str: '', vs: '', map: {}};
+ es.str = Object.keys(spacesStruct).map(size => spacesStruct[size].map((bid, i) => {
+ es.vs += getVs(bid);
+ let name = getSize(bid, true) + '_' + i;
+ es.map[name] = bid.bidId;
+ return name + ':' + getSize(bid);
+ }).join('+')).join('+');
+ return es;
+}
+
+function getVs(bid) {
+ let s;
+ let vs = '';
+ if (utils.hasLocalStorage()) {
+ s = getViewabilityData(bid);
+ vs += s.render >= 4 ? s.ratio.toString(16) : 'F';
+ } else {
+ vs += 'F';
+ }
+ return vs;
}
+function getViewabilityData(bid) {
+ let r = utils.getDataFromLocalStorage(STORAGE_RENDER_PREFIX + bid.adUnitCode) || 0;
+ let v = utils.getDataFromLocalStorage(STORAGE_VIEW_PREFIX + bid.adUnitCode) || 0;
+ let ratio = r > 0 ? (v / r) : 0;
+ return {
+ render: r,
+ ratio: window.parseInt(ratio * 10, 10)
+ };
+}
function getCharset() {
try {
return window.top.document.charset || window.top.document.characterSet;
@@ -163,10 +212,184 @@ function getCharset() {
}
}
-function getBidIdMap(bidRequests) {
- let map = {};
- bidRequests.forEach(bid => map[cleanName(bid.adUnitCode)] = bid.bidId);
- return map;
+function waitForElementsPresent(elements) {
+ const observer = new MutationObserver(function (mutationList, observer) {
+ if (mutationList && Array.isArray(mutationList)) {
+ mutationList.forEach(mr => {
+ if (mr && mr.addedNodes && Array.isArray(mr.addedNodes)) {
+ mr.addedNodes.forEach(ad => {
+ let index = elements.indexOf(ad.id);
+ if (index >= 0) {
+ registerViewability(ad);
+ elements.splice(index, 1);
+ if (!elements.length) {
+ observer.disconnect();
+ }
+ }
+ });
+ }
+ });
+ }
+ });
+ const config = {childList: true, subtree: true, characterData: true, attributes: true, attributeOldValue: true};
+ observer.observe(document.body, config);
+}
+
+function registerViewability(div) {
+ visibilityHandler({
+ name: div.id,
+ div: div
+ });
+}
+
+function registerViewabilityAllBids(bids) {
+ let elementsNotPresent = [];
+ bids.forEach(bid => {
+ let div = document.getElementById(bid.adUnitCode);
+ if (div) {
+ registerViewability(div);
+ } else {
+ elementsNotPresent.push(bid.adUnitCode);
+ }
+ });
+ if (elementsNotPresent.length) {
+ waitForElementsPresent(elementsNotPresent);
+ }
}
+function getViewabilityTracker() {
+ let TIME_PARTITIONS = 5;
+ let VIEWABILITY_TIME = 1000;
+ let VIEWABILITY_MIN_RATIO = 0.5;
+ let publicApi;
+ let context;
+
+ function segmentIsOutsideTheVisibleRange(visibleRangeEnd, p1, p2) {
+ return p1 > visibleRangeEnd || p2 < 0;
+ }
+
+ function segmentBeginsBeforeTheVisibleRange(p1) {
+ return p1 < 0;
+ }
+
+ function segmentEndsAfterTheVisibleRange(visibleRangeEnd, p2) {
+ return p2 < visibleRangeEnd;
+ }
+
+ function axialVisibilityRatio(visibleRangeEnd, p1, p2) {
+ let visibilityRatio = 0;
+ if (!segmentIsOutsideTheVisibleRange(visibleRangeEnd, p1, p2)) {
+ if (segmentBeginsBeforeTheVisibleRange(p1)) {
+ visibilityRatio = p2 / (p2 - p1);
+ } else {
+ visibilityRatio = segmentEndsAfterTheVisibleRange(visibleRangeEnd, p2) ? 1 : (visibleRangeEnd - p1) / (p2 - p1);
+ }
+ }
+ return visibilityRatio;
+ }
+
+ function isNotHiddenByNonFriendlyIframe() {
+ return (window === window.top) || window.frameElement;
+ }
+
+ function defineContext(e) {
+ context = e && window.document.body.contains(e) ? window : (window.top.document.body.contains(e) ? top : undefined);
+ return context;
+ }
+
+ function getContext(e) {
+ return context;
+ }
+
+ function verticalVisibilityRatio(position) {
+ return axialVisibilityRatio(getContext().innerHeight, position.top, position.bottom);
+ }
+
+ function horizontalVisibilityRatio(position) {
+ return axialVisibilityRatio(getContext().innerWidth, position.left, position.right);
+ }
+
+ function itIsNotHiddenByBannerAreaPosition(e) {
+ let position = e.getBoundingClientRect();
+ return (verticalVisibilityRatio(position) * horizontalVisibilityRatio(position)) > VIEWABILITY_MIN_RATIO;
+ }
+
+ function itIsNotHiddenByDisplayStyleCascade(e) {
+ return e.offsetHeight > 0 && e.offsetWidth > 0;
+ }
+
+ function itIsNotHiddenByOpacityStyleCascade(e) {
+ let s = e.style;
+ let p = e.parentNode;
+ return !(s && parseFloat(s.opacity) === 0) && (!p || itIsNotHiddenByOpacityStyleCascade(p));
+ }
+
+ function itIsNotHiddenByVisibilityStyleCascade(e) {
+ return getContext().getComputedStyle(e).visibility !== 'hidden';
+ }
+
+ function itIsNotHiddenByTabFocus() {
+ return getContext().top.document.hasFocus();
+ }
+
+ function isDefined(e) {
+ return (e !== null) && (typeof e !== 'undefined');
+ }
+
+ function itIsNotHiddenByOrphanBranch() {
+ return isDefined(getContext());
+ }
+
+ function isContextInAnIframe() {
+ return isDefined(getContext().frameElement);
+ }
+
+ function processIntervalVisibilityStatus(elapsedVisibleIntervals, element, callback) {
+ let visibleIntervals = isVisible(element) ? (elapsedVisibleIntervals + 1) : 0;
+ if (visibleIntervals === TIME_PARTITIONS) {
+ callback();
+ } else {
+ setTimeout(processIntervalVisibilityStatus.bind(this, visibleIntervals, element, callback), VIEWABILITY_TIME / TIME_PARTITIONS);
+ }
+ }
+
+ function isVisible(element) {
+ defineContext(element);
+ return isNotHiddenByNonFriendlyIframe() &&
+ itIsNotHiddenByOrphanBranch() &&
+ itIsNotHiddenByTabFocus() &&
+ itIsNotHiddenByDisplayStyleCascade(element) &&
+ itIsNotHiddenByVisibilityStyleCascade(element) &&
+ itIsNotHiddenByOpacityStyleCascade(element) &&
+ itIsNotHiddenByBannerAreaPosition(element) &&
+ (!isContextInAnIframe() || isVisible(getContext().frameElement));
+ }
+
+ publicApi = {
+ isVisible: isVisible,
+ onView: processIntervalVisibilityStatus.bind(this, 0)
+ };
+
+ return publicApi;
+};
+
+function visibilityHandler(obj) {
+ if (obj.div) {
+ registerAuction(STORAGE_RENDER_PREFIX + obj.name);
+ getViewabilityTracker().onView(obj.div, registerAuction.bind(undefined, STORAGE_VIEW_PREFIX + obj.name));
+ }
+}
+
+function registerAuction(storageID) {
+ let value;
+ try {
+ value = utils.getDataFromLocalStorage(storageID);
+ value = value ? window.parseInt(value, 10) + 1 : 1;
+ utils.setDataInLocalStorage(storageID, value);
+ } catch (exc) {
+ return false;
+ }
+
+ return true;
+}
registerBidder(spec);
diff --git a/test/spec/modules/eplanningBidAdapter_spec.js b/test/spec/modules/eplanningBidAdapter_spec.js
index 93290229ce3b..3152c43c6ffc 100644
--- a/test/spec/modules/eplanningBidAdapter_spec.js
+++ b/test/spec/modules/eplanningBidAdapter_spec.js
@@ -8,10 +8,14 @@ describe('E-Planning Adapter', function () {
const CI = '12345';
const ADUNIT_CODE = 'adunit-co:de';
const ADUNIT_CODE2 = 'adunit-code-dos';
- const CLEAN_ADUNIT_CODE2 = 'adunitcodedos';
- const CLEAN_ADUNIT_CODE = 'adunitco_de';
+ const ADUNIT_CODE_VIEW = 'adunit-code-view';
+ const ADUNIT_CODE_VIEW2 = 'adunit-code-view2';
+ const ADUNIT_CODE_VIEW3 = 'adunit-code-view3';
+ const CLEAN_ADUNIT_CODE2 = '300x250_1';
+ const CLEAN_ADUNIT_CODE = '300x250_0';
const BID_ID = '123456789';
const BID_ID2 = '987654321';
+ const BID_ID3 = '998877665';
const CPM = 1.3;
const W = '300';
const H = '250';
@@ -37,6 +41,33 @@ describe('E-Planning Adapter', function () {
'adUnitCode': ADUNIT_CODE2,
'sizes': [[300, 250], [300, 600]],
};
+ const validBidView = {
+ 'bidder': 'eplanning',
+ 'bidId': BID_ID,
+ 'params': {
+ 'ci': CI,
+ },
+ 'adUnitCode': ADUNIT_CODE_VIEW,
+ 'sizes': [[300, 250], [300, 600]],
+ };
+ const validBidView2 = {
+ 'bidder': 'eplanning',
+ 'bidId': BID_ID2,
+ 'params': {
+ 'ci': CI,
+ },
+ 'adUnitCode': ADUNIT_CODE_VIEW2,
+ 'sizes': [[300, 250], [300, 600]],
+ };
+ const validBidView3 = {
+ 'bidder': 'eplanning',
+ 'bidId': BID_ID3,
+ 'params': {
+ 'ci': CI,
+ },
+ 'adUnitCode': ADUNIT_CODE_VIEW3,
+ 'sizes': [[300, 250], [300, 600]],
+ };
const testBid = {
'bidder': 'eplanning',
'params': {
@@ -212,7 +243,7 @@ describe('E-Planning Adapter', function () {
it('should return e parameter with value according to the adunit sizes', function () {
const e = spec.buildRequests(bidRequests).data.e;
- expect(e).to.equal(CLEAN_ADUNIT_CODE + ':300x250,300x600');
+ expect(e).to.equal('300x250_0:300x250,300x600');
});
it('should return correct e parameter with more than one adunit', function () {
@@ -229,7 +260,7 @@ describe('E-Planning Adapter', function () {
bidRequests.push(anotherBid);
const e = spec.buildRequests(bidRequests).data.e;
- expect(e).to.equal(CLEAN_ADUNIT_CODE + ':300x250,300x600+' + CLEAN_NEW_CODE + ':100x100');
+ expect(e).to.equal('300x250_0:300x250,300x600+100x100_0:100x100');
});
it('should return correct e parameter when the adunit has no size', function () {
@@ -242,7 +273,7 @@ describe('E-Planning Adapter', function () {
};
const e = spec.buildRequests([noSizeBid]).data.e;
- expect(e).to.equal(CLEAN_ADUNIT_CODE + ':1x1');
+ expect(e).to.equal('1x1_0:1x1');
});
it('should return ur parameter with current window url', function () {
@@ -360,4 +391,334 @@ describe('E-Planning Adapter', function () {
expect(responses[1].requestId).to.equal(BID_ID2);
});
});
+ describe('viewability', function() {
+ let storageIdRender = 'pbsr_' + validBidView.adUnitCode;
+ let storageIdView = 'pbvi_' + validBidView.adUnitCode;
+ let bidRequests = [validBidView];
+ let bidRequestMultiple = [validBidView, validBidView2, validBidView3];
+ let getLocalStorageSpy;
+ let setDataInLocalStorageSpy;
+ let hasLocalStorageStub;
+ let clock;
+ let element;
+ let getBoundingClientRectStub;
+ let sandbox = sinon.sandbox.create();
+ let focusStub;
+ function createElement(id) {
+ element = document.createElement('div');
+ element.id = id || ADUNIT_CODE_VIEW;
+ element.style.width = '50px';
+ element.style.height = '50px';
+ if (frameElement) {
+ frameElement.style.width = '100px';
+ frameElement.style.height = '100px';
+ }
+ element.style.background = 'black';
+ document.body.appendChild(element);
+ }
+ function createElementVisible(id) {
+ createElement(id);
+ sandbox.stub(element, 'getBoundingClientRect').returns({
+ x: 0,
+ y: 0,
+ width: 50,
+ height: 50,
+ top: 0,
+ right: 50,
+ bottom: 50,
+ left: 0,
+ });
+ }
+ function createElementOutOfView(id) {
+ createElement(id);
+ sandbox.stub(element, 'getBoundingClientRect').returns({
+ x: 100,
+ y: 100,
+ width: 250,
+ height: 250,
+ top: 100,
+ right: 350,
+ bottom: 350,
+ left: 100,
+ });
+ }
+
+ function createPartiallyVisibleElement(id) {
+ createElement(id);
+ sandbox.stub(element, 'getBoundingClientRect').returns({
+ x: 0,
+ y: 0,
+ width: 50,
+ height: 150,
+ top: 0,
+ right: 50,
+ bottom: 150,
+ left: 0,
+ });
+ }
+ function createPartiallyInvisibleElement(id) {
+ createElement(id);
+ sandbox.stub(element, 'getBoundingClientRect').returns({
+ x: 0,
+ y: 0,
+ width: 150,
+ height: 150,
+ top: 0,
+ right: 150,
+ bottom: 150,
+ left: 0,
+ });
+ }
+ function createElementOutOfRange(id) {
+ createElement(id);
+ sandbox.stub(element, 'getBoundingClientRect').returns({
+ x: 200,
+ y: 200,
+ width: 350,
+ height: 350,
+ top: 200,
+ right: 350,
+ bottom: 350,
+ left: 200,
+ });
+ }
+ beforeEach(function () {
+ getLocalStorageSpy = sandbox.spy(utils, 'getDataFromLocalStorage');
+ setDataInLocalStorageSpy = sandbox.spy(utils, 'setDataInLocalStorage');
+
+ hasLocalStorageStub = sandbox.stub(utils, 'hasLocalStorage');
+ hasLocalStorageStub.returns(true);
+
+ clock = sandbox.useFakeTimers();
+
+ focusStub = sandbox.stub(window.top.document, 'hasFocus');
+ focusStub.returns(true);
+ });
+ afterEach(function () {
+ sandbox.restore();
+ if (document.getElementById(ADUNIT_CODE_VIEW)) {
+ document.body.removeChild(element);
+ }
+ window.top.localStorage.removeItem(storageIdRender);
+ window.top.localStorage.removeItem(storageIdView);
+ });
+
+ it('should create the url correctly without LocalStorage', function() {
+ createElementVisible();
+ hasLocalStorageStub.returns(false);
+ const response = spec.buildRequests(bidRequests);
+
+ expect(response.url).to.equal('//ads.us.e-planning.net/hb/1/' + CI + '/1/localhost/ROS');
+ expect(response.data.vs).to.equal('F');
+
+ sinon.assert.notCalled(getLocalStorageSpy);
+ sinon.assert.notCalled(setDataInLocalStorageSpy);
+ });
+
+ it('should create the url correctly with LocalStorage', function() {
+ createElementVisible();
+ const response = spec.buildRequests(bidRequests);
+ expect(response.url).to.equal('//ads.us.e-planning.net/hb/1/' + CI + '/1/localhost/ROS');
+
+ expect(response.data.vs).to.equal('F');
+
+ sinon.assert.called(getLocalStorageSpy);
+ sinon.assert.called(setDataInLocalStorageSpy);
+ sinon.assert.calledWith(getLocalStorageSpy, storageIdRender);
+ sinon.assert.calledWith(setDataInLocalStorageSpy, storageIdRender);
+
+ expect(utils.getDataFromLocalStorage(storageIdRender)).to.equal('1');
+ });
+
+ context('when element is fully in view', function() {
+ let respuesta;
+ beforeEach(function () {
+ createElementVisible();
+ });
+ it('when you have a render', function() {
+ respuesta = spec.buildRequests(bidRequests);
+ clock.tick(1005);
+
+ expect(respuesta.data.vs).to.equal('F');
+
+ expect(utils.getDataFromLocalStorage(storageIdRender)).to.equal('1');
+ expect(utils.getDataFromLocalStorage(storageIdView)).to.equal('1');
+ });
+ it('when you have more than four render', function() {
+ utils.setDataInLocalStorage(storageIdRender, 4);
+ respuesta = spec.buildRequests(bidRequests);
+ clock.tick(1005);
+
+ expect(respuesta.data.vs).to.equal('0');
+
+ expect(utils.getDataFromLocalStorage(storageIdRender)).to.equal('5');
+ expect(utils.getDataFromLocalStorage(storageIdView)).to.equal('1');
+ });
+ it('when you have more than four render and already record visibility', function() {
+ utils.setDataInLocalStorage(storageIdRender, 4);
+ utils.setDataInLocalStorage(storageIdView, 4);
+ respuesta = spec.buildRequests(bidRequests);
+ clock.tick(1005);
+
+ expect(respuesta.data.vs).to.equal('a');
+
+ expect(utils.getDataFromLocalStorage(storageIdRender)).to.equal('5');
+ expect(utils.getDataFromLocalStorage(storageIdView)).to.equal('5');
+ });
+ });
+
+ context('when element is out of view', function() {
+ let respuesta;
+ beforeEach(function () {
+ createElementOutOfView();
+ });
+
+ it('when you have a render', function() {
+ respuesta = spec.buildRequests(bidRequests);
+ clock.tick(1005);
+ expect(respuesta.data.vs).to.equal('F');
+
+ expect(utils.getDataFromLocalStorage(storageIdRender)).to.equal('1');
+ expect(utils.getDataFromLocalStorage(storageIdView)).to.equal(null);
+ });
+ it('when you have more than four render', function() {
+ utils.setDataInLocalStorage(storageIdRender, 4);
+ respuesta = spec.buildRequests(bidRequests);
+ clock.tick(1005);
+ expect(respuesta.data.vs).to.equal('0');
+
+ expect(utils.getDataFromLocalStorage(storageIdRender)).to.equal('5');
+ expect(utils.getDataFromLocalStorage(storageIdView)).to.equal(null);
+ });
+ });
+
+ context('when element is partially in view', function() {
+ let respuesta;
+ it('should register visibility with more than 50%', function() {
+ createPartiallyVisibleElement();
+ respuesta = spec.buildRequests(bidRequests);
+ clock.tick(1005);
+
+ expect(utils.getDataFromLocalStorage(storageIdRender)).to.equal('1');
+ expect(utils.getDataFromLocalStorage(storageIdView)).to.equal('1');
+ });
+ it('you should not register visibility with less than 50%', function() {
+ createPartiallyInvisibleElement();
+ respuesta = spec.buildRequests(bidRequests);
+ clock.tick(1005);
+
+ expect(utils.getDataFromLocalStorage(storageIdRender)).to.equal('1');
+ expect(utils.getDataFromLocalStorage(storageIdView)).to.equal(null);
+ });
+ });
+ context('when width or height of the element is zero', function() {
+ beforeEach(function () {
+ createElementVisible();
+ });
+ it('if the width is zero but the height is within the range', function() {
+ element.style.width = '0px';
+ spec.buildRequests(bidRequests)
+ clock.tick(1005);
+
+ expect(utils.getDataFromLocalStorage(storageIdRender)).to.equal('1');
+ expect(utils.getDataFromLocalStorage(storageIdView)).to.equal(null);
+ });
+ it('if the height is zero but the width is within the range', function() {
+ element.style.height = '0px';
+ spec.buildRequests(bidRequests)
+ clock.tick(1005);
+
+ expect(utils.getDataFromLocalStorage(storageIdRender)).to.equal('1');
+ expect(utils.getDataFromLocalStorage(storageIdView)).to.equal(null);
+ });
+ it('if both are zero', function() {
+ element.style.height = '0px';
+ element.style.width = '0px';
+ spec.buildRequests(bidRequests)
+ clock.tick(1005);
+
+ expect(utils.getDataFromLocalStorage(storageIdRender)).to.equal('1');
+ expect(utils.getDataFromLocalStorage(storageIdView)).to.equal(null);
+ });
+ });
+ context('when tab is inactive', function() {
+ it('I should not register if it is not in focus', function() {
+ createElementVisible();
+ focusStub.returns(false);
+ spec.buildRequests(bidRequests);
+ clock.tick(1005);
+ expect(utils.getDataFromLocalStorage(storageIdRender)).to.equal('1');
+ expect(utils.getDataFromLocalStorage(storageIdView)).to.equal(null);
+ });
+ });
+ context('segmentBeginsBeforeTheVisibleRange', function() {
+ it('segmentBeginsBeforeTheVisibleRange', function() {
+ createElementOutOfRange();
+ spec.buildRequests(bidRequests);
+ clock.tick(1005);
+ expect(utils.getDataFromLocalStorage(storageIdRender)).to.equal('1');
+ expect(utils.getDataFromLocalStorage(storageIdView)).to.equal(null);
+ });
+ });
+ context('when there are multiple adunit', function() {
+ let respuesta;
+ beforeEach(function () {
+ [ADUNIT_CODE_VIEW, ADUNIT_CODE_VIEW2, ADUNIT_CODE_VIEW3].forEach(ac => {
+ utils.setDataInLocalStorage('pbsr_' + ac, 5);
+ utils.setDataInLocalStorage('pbvi_' + ac, 5);
+ });
+ });
+ afterEach(function () {
+ [ADUNIT_CODE_VIEW, ADUNIT_CODE_VIEW2, ADUNIT_CODE_VIEW3].forEach(ac => {
+ if (document.getElementById(ac)) {
+ document.body.removeChild(document.getElementById(ac));
+ }
+ window.top.localStorage.removeItem(ac);
+ window.top.localStorage.removeItem(ac);
+ });
+ });
+ it('all visibles', function() {
+ createElementVisible(ADUNIT_CODE_VIEW);
+ createElementVisible(ADUNIT_CODE_VIEW2);
+ createElementVisible(ADUNIT_CODE_VIEW3);
+
+ respuesta = spec.buildRequests(bidRequestMultiple);
+ clock.tick(1005);
+ [ADUNIT_CODE_VIEW, ADUNIT_CODE_VIEW2, ADUNIT_CODE_VIEW3].forEach(ac => {
+ expect(utils.getDataFromLocalStorage('pbsr_' + ac)).to.equal('6');
+ expect(utils.getDataFromLocalStorage('pbvi_' + ac)).to.equal('6');
+ });
+ expect('aaa').to.equal(respuesta.data.vs);
+ });
+ it('none visible', function() {
+ createElementOutOfView(ADUNIT_CODE_VIEW);
+ createElementOutOfView(ADUNIT_CODE_VIEW2);
+ createElementOutOfView(ADUNIT_CODE_VIEW3);
+
+ respuesta = spec.buildRequests(bidRequestMultiple);
+ clock.tick(1005);
+ [ADUNIT_CODE_VIEW, ADUNIT_CODE_VIEW2, ADUNIT_CODE_VIEW3].forEach(ac => {
+ expect(utils.getDataFromLocalStorage('pbsr_' + ac)).to.equal('6');
+ expect(utils.getDataFromLocalStorage('pbvi_' + ac)).to.equal('5');
+ });
+
+ expect('aaa').to.equal(respuesta.data.vs);
+ });
+ it('some visible and others not visible', function() {
+ createElementVisible(ADUNIT_CODE_VIEW);
+ createElementOutOfView(ADUNIT_CODE_VIEW2);
+ createElementOutOfView(ADUNIT_CODE_VIEW3);
+
+ respuesta = spec.buildRequests(bidRequestMultiple);
+ clock.tick(1005);
+ expect(utils.getDataFromLocalStorage('pbsr_' + ADUNIT_CODE_VIEW)).to.equal('6');
+ expect(utils.getDataFromLocalStorage('pbvi_' + ADUNIT_CODE_VIEW)).to.equal('6');
+ [ADUNIT_CODE_VIEW2, ADUNIT_CODE_VIEW3].forEach(ac => {
+ expect(utils.getDataFromLocalStorage('pbsr_' + ac)).to.equal('6');
+ expect(utils.getDataFromLocalStorage('pbvi_' + ac)).to.equal('5');
+ });
+ expect('aaa').to.equal(respuesta.data.vs);
+ });
+ });
+ });
});
From 5047aff546fde16919704d3b56e9cdb4e7428749 Mon Sep 17 00:00:00 2001
From: Tomas Kovtun
Date: Tue, 10 Dec 2019 20:44:17 +0200
Subject: [PATCH 18/41] adformBidAdapter. Outstream renderer condition (#4523)
* Must not apply a renderer if media type is not 'video'
https://github.com/prebid/Prebid.js/pull/4363#discussion_r352583927
* The change fixes 2 incorrect behaviours.
1. Sizes were taken from the bid object shallowly. Now, with the help of utils.getAdUnitSizes the adapter supports sizes from the bid object and from mediaType. Latter has the priority.
2. A dimension pair can be written in both ways, [width, height] and [[width, height]]. Previously, only nested arrays would work correctly.
* ensure renderer is not applied to banners
---
modules/adformBidAdapter.js | 4 ++--
test/spec/modules/adformBidAdapter_spec.js | 11 ++++++-----
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/modules/adformBidAdapter.js b/modules/adformBidAdapter.js
index 0ac083e7e7c7..d344908c6384 100644
--- a/modules/adformBidAdapter.js
+++ b/modules/adformBidAdapter.js
@@ -98,7 +98,7 @@ export const spec = {
response = responses[i];
type = response.response === 'banner' ? BANNER : VIDEO;
bid = bids[i];
- if (VALID_RESPONSES[response.response] && (verifySize(response, bid.sizes) || type === VIDEO)) {
+ if (VALID_RESPONSES[response.response] && (verifySize(response, utils.getAdUnitSizes(bid)) || type === VIDEO)) {
bidObject = {
requestId: bid.bidId,
cpm: response.win_bid,
@@ -117,7 +117,7 @@ export const spec = {
mediaType: type
};
- if (!bid.renderer && utils.deepAccess(bid, 'mediaTypes.video.context') === 'outstream') {
+ if (!bid.renderer && type === VIDEO && utils.deepAccess(bid, 'mediaTypes.video.context') === 'outstream') {
bidObject.renderer = Renderer.install({id: bid.bidId, url: OUTSTREAM_RENDERER_URL});
bidObject.renderer.setRender(renderer);
}
diff --git a/test/spec/modules/adformBidAdapter_spec.js b/test/spec/modules/adformBidAdapter_spec.js
index 17eef06c603b..80f89614c5e0 100644
--- a/test/spec/modules/adformBidAdapter_spec.js
+++ b/test/spec/modules/adformBidAdapter_spec.js
@@ -258,11 +258,12 @@ describe('Adform adapter', function () {
};
});
- it('should set a renderer for an outstream context', function () {
- serverResponse.body = [serverResponse.body[3]];
- bidRequest.bids = [bidRequest.bids[6]];
+ it('should set a renderer only for an outstream context', function () {
+ serverResponse.body = [serverResponse.body[3], serverResponse.body[2]];
+ bidRequest.bids = [bidRequest.bids[6], bidRequest.bids[6]];
let result = spec.interpretResponse(serverResponse, bidRequest);
assert.ok(result[0].renderer);
+ assert.equal(result[1].renderer, undefined);
});
describe('verifySizes', function () {
@@ -314,9 +315,9 @@ describe('Adform adapter', function () {
beforeEach(function () {
config.setConfig({ currency: {} });
- let sizes = [[250, 300], [300, 250], [300, 600]];
+ let sizes = [[250, 300], [300, 250], [300, 600], [600, 300]];
let placementCode = ['div-01', 'div-02', 'div-03', 'div-04', 'div-05'];
- let mediaTypes = [{video: {context: 'outstream'}}];
+ let mediaTypes = [{video: {context: 'outstream'}, banner: {sizes: sizes[3]}}];
let params = [{ mid: 1, url: 'some// there' }, {adxDomain: null, mid: 2, someVar: 'someValue', pt: 'gross'}, { adxDomain: null, mid: 3, pdom: 'home' }, {mid: 5, pt: 'net'}, {mid: 6, pt: 'gross'}];
bids = [
{
From 6de34748efac9a2b37ea71d4ebcb4a5d4eed7cd5 Mon Sep 17 00:00:00 2001
From: sourabhg
Date: Wed, 11 Dec 2019 00:24:30 +0530
Subject: [PATCH 19/41] feat(displaymanager): added displaymanager and version
with user object (#4546)
* feat(displaymanager): added displaymanager and version with user object
* feat(custom params): wrapped custom params in deepintent object
---
modules/deepintentBidAdapter.js | 44 +++++++++++++++----
.../spec/modules/deepintentBidAdapter_spec.js | 27 +++++++++---
2 files changed, 56 insertions(+), 15 deletions(-)
diff --git a/modules/deepintentBidAdapter.js b/modules/deepintentBidAdapter.js
index 27aa4e2c8a6b..39866086cfa7 100644
--- a/modules/deepintentBidAdapter.js
+++ b/modules/deepintentBidAdapter.js
@@ -4,7 +4,7 @@ import * as utils from '../src/utils';
const BIDDER_CODE = 'deepintent';
const BIDDER_ENDPOINT = 'https://prebid.deepintent.com/prebid';
const USER_SYNC_URL = 'https://beacon.deepintent.com/usersync.html';
-
+const DI_M_V = '1.0.0';
export const spec = {
code: BIDDER_CODE,
supportedMediaTypes: [BANNER],
@@ -29,18 +29,15 @@ export const spec = {
return responses;
},
buildRequests: function (validBidRequests, bidderRequest) {
+ var user = validBidRequests.map(bid => buildUser(bid));
+ clean(user);
const openRtbBidRequest = {
id: utils.generateUUID(),
at: 1,
imp: validBidRequests.map(bid => buildImpression(bid)),
site: buildSite(bidderRequest),
device: buildDevice(),
- source: {
- fd: 0,
- ext: {
- type: 2
- }
- }
+ user: user && user.length == 1 ? user[0] : {}
};
return {
@@ -65,6 +62,13 @@ export const spec = {
}
};
+function clean(obj) {
+ for (let propName in obj) {
+ if (obj[propName] === null || obj[propName] === undefined) {
+ delete obj[propName];
+ }
+ }
+}
function formatResponse(bid) {
return {
@@ -87,9 +91,33 @@ function buildImpression(bid) {
tagid: bid.params.tagId || '',
secure: window.location.protocol === 'https' ? 1 : 0,
banner: buildBanner(bid),
- ext: bid.params.custom ? bid.params.custom : {}
+ displaymanager: 'di_prebid',
+ displaymanagerver: DI_M_V,
+ ext: buildCustomParams(bid)
};
}
+function buildCustomParams(bid) {
+ if (bid.params && bid.params.custom) {
+ return {
+ deepintent: bid.params.custom
+
+ }
+ } else {
+ return {}
+ }
+}
+function buildUser(bid) {
+ if (bid && bid.params && bid.params.user) {
+ return {
+ id: bid.params.user.id && typeof bid.params.user.id == 'string' ? bid.params.user.id : undefined,
+ buyeruid: bid.params.user.buyeruid && typeof bid.params.user.buyeruid == 'string' ? bid.params.user.buyeruid : undefined,
+ yob: bid.params.user.yob && typeof bid.params.user.yob == 'number' ? bid.params.user.yob : null,
+ gender: bid.params.user.gender && typeof bid.params.user.gender == 'string' ? bid.params.user.gender : undefined,
+ keywords: bid.params.user.keywords && typeof bid.params.user.keywords == 'string' ? bid.params.user.keywords : undefined,
+ customdata: bid.params.user.customdata && typeof bid.params.user.customdata == 'string' ? bid.params.user.customdata : undefined
+ }
+ }
+}
function buildBanner(bid) {
if (utils.deepAccess(bid, 'mediaTypes.banner')) {
diff --git a/test/spec/modules/deepintentBidAdapter_spec.js b/test/spec/modules/deepintentBidAdapter_spec.js
index 353a815eb8c1..f4adad7faf21 100644
--- a/test/spec/modules/deepintentBidAdapter_spec.js
+++ b/test/spec/modules/deepintentBidAdapter_spec.js
@@ -19,9 +19,14 @@ describe('Deepintent adapter', function () {
tagId: '100013',
w: 728,
h: 90,
+ user: {
+ id: 'di_testuid',
+ buyeruid: 'di_testbuyeruid',
+ yob: 2002,
+ gender: 'F'
+ },
custom: {
- user_gender: 'female',
- user_max_age: 25
+ 'position': 'right-box'
}
}
}
@@ -122,14 +127,22 @@ describe('Deepintent adapter', function () {
let bRequest = spec.buildRequests(request);
let data = JSON.parse(bRequest.data);
expect(data.imp[0].ext).to.be.a('object');
- expect(data.imp[0].ext.user_gender).to.equal('female');
- expect(data.imp[0].ext.user_max_age).to.equal(25);
+ expect(data.imp[0].ext.deepintent.position).to.equal('right-box');
});
- it('bid request check: source params', function () {
+ it('bid request check: displaymanager check', function() {
let bRequest = spec.buildRequests(request);
let data = JSON.parse(bRequest.data);
- expect(data.source.fd).to.equal(0);
- expect(data.source.ext.type).to.equal(2);
+ expect(data.imp[0].displaymanager).to.equal('di_prebid');
+ expect(data.imp[0].displaymanagerver).to.equal('1.0.0');
+ });
+ it('bid request check: user object check', function () {
+ let bRequest = spec.buildRequests(request);
+ let data = JSON.parse(bRequest.data);
+ expect(data.user).to.be.a('object');
+ expect(data.user.id).to.equal('di_testuid');
+ expect(data.user.buyeruid).to.equal('di_testbuyeruid');
+ expect(data.user.yob).to.equal(2002);
+ expect(data.user.gender).to.equal('F');
})
});
describe('user sync check', function () {
From 5926b49eb77f8fc00ff8dc704b50c9c12c1d0af5 Mon Sep 17 00:00:00 2001
From: "Isaac A. Dettman"
Date: Tue, 10 Dec 2019 14:47:58 -0800
Subject: [PATCH 20/41] Fix for Outstream and MediaTypePriceGranularity (#4544)
* Add microadBidAdapter
* Remove unnecessary encodeURIComponent from microadBidAdapter
* Submit Advangelists Prebid Adapter
* Submit Advangelists Prebid Adapter 1.1
* Correct procudtion endpoint for prebid
* analytics update with wrapper name
* reverted error merge
* update changed default value of netRevenue to true
* fix video mediaTypes granularity for instream and outstream
* refactor inline code to geMediaTypeGranularity method since its used in two location
* fix missing import for INSTREAM
* added test and small code change to optimize conditionals
* add test
* refactor with added test
* added more tests, small fixes
* remove redundant comment
* updates to tests
* tiny update to comment
* updated tests
* updated with fixes test updates
---
src/auction.js | 55 +++++++++++++++++-----
src/config.js | 16 +++++++
test/spec/auctionmanager_spec.js | 81 +++++++++++++++++++++++++++++++-
test/spec/config_spec.js | 17 +++++--
4 files changed, 152 insertions(+), 17 deletions(-)
diff --git a/src/auction.js b/src/auction.js
index 9b6951c6b7a6..fe1b70085e92 100644
--- a/src/auction.js
+++ b/src/auction.js
@@ -27,8 +27,17 @@
*/
/**
- * @typedef {Object} BidRequest
- * //TODO add all properties
+ * @typedef {Object} BidderRequest
+ *
+ * @property {string} bidderCode - adUnit bidder
+ * @property {number} auctionId - random UUID
+ * @property {string} bidderRequestId - random string, unique key set on all bidRequest.bids[]
+ * @property {Array.} bids
+ * @property {number} auctionStart - Date.now() at auction start
+ * @property {number} timeout - callback timeout
+ * @property {refererInfo} refererInfo - referer info object
+ * @property {string} [tid] - random UUID (used for s2s)
+ * @property {string} [src] - s2s or client (used for s2s)
*/
/**
@@ -48,7 +57,7 @@
* @property {function(): void} callBids - sends requests to all adapters for bids
*/
-import { flatten, timestamp, adUnitsFilter, deepAccess, getBidRequest, getValue } from './utils';
+import {flatten, timestamp, adUnitsFilter, deepAccess, getBidRequest, getValue} from './utils';
import { parse as parseURL } from './url';
import { getPriceBucketString } from './cpmBucketManager';
import { getNativeTargeting } from './native';
@@ -59,6 +68,7 @@ import { userSync } from './userSync';
import { hook } from './hook';
import find from 'core-js/library/fn/array/find';
import { OUTSTREAM } from './video';
+import { VIDEO } from './mediaTypes';
const { syncUsers } = userSync;
const utils = require('./utils');
@@ -85,7 +95,11 @@ const queuedCalls = [];
*
* @param {Object} requestConfig
* @param {AdUnit} requestConfig.adUnits
- * @param {AdUnitCode} requestConfig.adUnitCode
+ * @param {AdUnitCode} requestConfig.adUnitCodes
+ * @param {function():void} requestConfig.callback
+ * @param {number} requestConfig.cbTimeout
+ * @param {Array.} requestConfig.labels
+ * @param {string} requestConfig.auctionId
*
* @returns {Auction} auction instance
*/
@@ -490,8 +504,7 @@ function getPreparedBidForAuction({adUnitCode, bid, bidderRequest, auctionId}) {
}
// Use the config value 'mediaTypeGranularity' if it has been defined for mediaType, else use 'customPriceBucket'
- const mediaTypeGranularity = config.getConfig(`mediaTypePriceGranularity.${bid.mediaType}`);
-
+ const mediaTypeGranularity = getMediaTypeGranularity(bid.mediaType, bidReq, config.getConfig('mediaTypePriceGranularity'));
const priceStringsObj = getPriceBucketString(
bidObject.cpm,
(typeof mediaTypeGranularity === 'object') ? mediaTypeGranularity : config.getConfig('customPriceBucket'),
@@ -518,14 +531,33 @@ function setupBidTargeting(bidObject, bidderRequest) {
bidObject.adserverTargeting = Object.assign(bidObject.adserverTargeting || {}, keyValues);
}
+/**
+ * @param {MediaType} mediaType
+ * @param {Bid} [bidReq]
+ * @param {MediaTypePriceGranularity} [mediaTypePriceGranularity]
+ * @returns {(Object|string|undefined)}
+ */
+export function getMediaTypeGranularity(mediaType, bidReq, mediaTypePriceGranularity) {
+ if (mediaType && mediaTypePriceGranularity) {
+ if (mediaType === VIDEO) {
+ const context = deepAccess(bidReq, `mediaTypes.${VIDEO}.context`, 'instream');
+ if (mediaTypePriceGranularity[`${VIDEO}-${context}`]) {
+ return mediaTypePriceGranularity[`${VIDEO}-${context}`];
+ }
+ }
+ return mediaTypePriceGranularity[mediaType];
+ }
+}
+
/**
* This function returns the price granularity defined. It can be either publisher defined or default value
* @param {string} mediaType
+ * @param {BidRequest} bidReq
* @returns {string} granularity
*/
-export const getPriceGranularity = (mediaType) => {
+export const getPriceGranularity = (mediaType, bidReq) => {
// Use the config value 'mediaTypeGranularity' if it has been set for mediaType, else use 'priceGranularity'
- const mediaTypeGranularity = config.getConfig(`mediaTypePriceGranularity.${mediaType}`);
+ const mediaTypeGranularity = getMediaTypeGranularity(mediaType, bidReq, config.getConfig('mediaTypePriceGranularity'));
const granularity = (typeof mediaType === 'string' && mediaTypeGranularity) ? ((typeof mediaTypeGranularity === 'string') ? mediaTypeGranularity : 'custom') : config.getConfig('priceGranularity');
return granularity;
}
@@ -556,9 +588,10 @@ export const getPriceByGranularity = (granularity) => {
/**
* @param {string} mediaType
* @param {string} bidderCode
+ * @param {BidRequest} bidReq
* @returns {*}
*/
-export function getStandardBidderSettings(mediaType, bidderCode) {
+export function getStandardBidderSettings(mediaType, bidderCode, bidReq) {
// factory for key value objs
function createKeyVal(key, value) {
return {
@@ -573,7 +606,7 @@ export function getStandardBidderSettings(mediaType, bidderCode) {
};
}
const TARGETING_KEYS = CONSTANTS.TARGETING_KEYS;
- const granularity = getPriceGranularity(mediaType);
+ const granularity = getPriceGranularity(mediaType, bidReq);
let bidderSettings = $$PREBID_GLOBAL$$.bidderSettings;
if (!bidderSettings[CONSTANTS.JSON_MAPPING.BD_SETTING_STANDARD]) {
@@ -627,7 +660,7 @@ export function getKeyValueTargetingPairs(bidderCode, custBidObj, bidReq) {
// 1) set the keys from "standard" setting or from prebid defaults
if (bidderSettings) {
// initialize default if not set
- const standardSettings = getStandardBidderSettings(custBidObj.mediaType, bidderCode);
+ const standardSettings = getStandardBidderSettings(custBidObj.mediaType, bidderCode, bidReq);
setKeys(keyValues, standardSettings, custBidObj);
// 2) set keys from specific bidder setting override if they exist
diff --git a/src/config.js b/src/config.js
index 38697c363b36..19a582e86d57 100644
--- a/src/config.js
+++ b/src/config.js
@@ -1,6 +1,17 @@
/*
* Module for getting and setting Prebid configuration.
*/
+
+/**
+ * @typedef {Object} MediaTypePriceGranularity
+ *
+ * @property {(string|Object)} [banner]
+ * @property {(string|Object)} [native]
+ * @property {(string|Object)} [video]
+ * @property {(string|Object)} [video-instream]
+ * @property {(string|Object)} [video-outstream]
+ */
+
import { isValidPriceConfig } from './cpmBucketManager';
import find from 'core-js/library/fn/array/find';
import includes from 'core-js/library/fn/array/includes';
@@ -106,7 +117,12 @@ export function newConfig() {
return this._customPriceBucket;
},
+ /**
+ * mediaTypePriceGranularity
+ * @type {MediaTypePriceGranularity}
+ */
_mediaTypePriceGranularity: {},
+
get mediaTypePriceGranularity() {
return this._mediaTypePriceGranularity;
},
diff --git a/test/spec/auctionmanager_spec.js b/test/spec/auctionmanager_spec.js
index 577b1bec3330..970bc61cc61c 100644
--- a/test/spec/auctionmanager_spec.js
+++ b/test/spec/auctionmanager_spec.js
@@ -1,6 +1,6 @@
import { getKeyValueTargetingPairs, auctionCallbacks, AUCTION_COMPLETED } from 'src/auction';
import CONSTANTS from 'src/constants.json';
-import { adjustBids } from 'src/auction';
+import { adjustBids, getMediaTypeGranularity } from 'src/auction';
import * as auctionModule from 'src/auction';
import { registerBidder } from 'src/adapters/bidderFactory';
import { createBid } from 'src/bidfactory';
@@ -25,6 +25,10 @@ const BIDDER_CODE1 = 'sampleBidder1';
const ADUNIT_CODE = 'adUnit-code';
const ADUNIT_CODE1 = 'adUnit-code-1';
+/**
+ * @param {Object} [opts]
+ * @returns {Bid}
+ */
function mockBid(opts) {
let bidderCode = opts && opts.bidderCode;
@@ -43,6 +47,11 @@ function mockBid(opts) {
};
}
+/**
+ * @param {Bid} bid
+ * @param {Object} [opts]
+ * @returns {BidRequest}
+ */
function mockBidRequest(bid, opts) {
if (!bid) {
throw new Error('bid required');
@@ -976,6 +985,76 @@ describe('auctionmanager.js', function () {
});
});
+ describe('getMediaTypeGranularity', function () {
+ it('video', function () {
+ let bidReq = {
+ 'mediaTypes': { video: {id: '1'} }
+ };
+
+ // mediaType is video and video.context is undefined
+ expect(getMediaTypeGranularity('video', bidReq, {
+ banner: 'low',
+ video: 'medium'
+ })).to.equal('medium');
+
+ expect(getMediaTypeGranularity('video', {}, {
+ banner: 'low',
+ video: 'medium'
+ })).to.equal('medium');
+ ``
+ expect(getMediaTypeGranularity('video', undefined, {
+ banner: 'low',
+ video: 'medium'
+ })).to.equal('medium');
+
+ // also when mediaTypes.video is undefined
+ bidReq = {
+ 'mediaTypes': { banner: {} }
+ };
+ expect(getMediaTypeGranularity('video', bidReq, {
+ banner: 'low',
+ video: 'medium'
+ })).to.equal('medium');
+
+ // also when mediaTypes is undefined
+ expect(getMediaTypeGranularity('video', {}, {
+ banner: 'low',
+ video: 'medium'
+ })).to.equal('medium');
+ });
+
+ it('video-outstream', function () {
+ let bidReq = { 'mediaTypes': { video: { context: 'outstream' } } };
+
+ expect(getMediaTypeGranularity('video', bidReq, {
+ 'banner': 'low', 'video': 'medium', 'video-outstream': 'high'
+ })).to.equal('high');
+ });
+
+ it('video-instream', function () {
+ let bidReq = { 'mediaTypes': { video: { context: 'instream' } } };
+
+ expect(getMediaTypeGranularity('video', bidReq, {
+ banner: 'low', video: 'medium', 'video-instream': 'high'
+ })).to.equal('high');
+
+ // fall back to video if video-instream not found
+ expect(getMediaTypeGranularity('video', bidReq, {
+ banner: 'low', video: 'medium'
+ })).to.equal('medium');
+
+ expect(getMediaTypeGranularity('video', {mediaTypes: {banner: {}}}, {
+ banner: 'low', video: 'medium'
+ })).to.equal('medium');
+ });
+
+ it('native', function () {
+ expect(getMediaTypeGranularity('native', {mediaTypes: {native: {}}}, {
+ banner: 'low', video: 'medium', native: 'high'
+ })).to.equal('high');
+ });
+ });
+
describe('auctionCallbacks', function() {
let bids = TEST_BIDS;
let bidRequests;
diff --git a/test/spec/config_spec.js b/test/spec/config_spec.js
index c0f4f6bab891..8166b0f6d425 100644
--- a/test/spec/config_spec.js
+++ b/test/spec/config_spec.js
@@ -137,7 +137,7 @@ describe('config API', function () {
});
it('set mediaTypePriceGranularity', function () {
- const customPriceGranularity = {
+ const customPriceGranularityVideo = {
'buckets': [{
'min': 0,
'max': 3,
@@ -145,18 +145,25 @@ describe('config API', function () {
'cap': true
}]
};
+ const customPriceGranularityInstream = utils.deepClone(customPriceGranularityVideo);
+ const customPriceGranularityOutstream = utils.deepClone(customPriceGranularityVideo);
+
setConfig({
'mediaTypePriceGranularity': {
'banner': 'medium',
- 'video': customPriceGranularity,
- 'native': 'medium'
+ 'video': customPriceGranularityVideo,
+ 'video-instream': customPriceGranularityInstream,
+ 'video-outstream': customPriceGranularityOutstream,
+ 'native': 'high'
}
});
const configResult = getConfig('mediaTypePriceGranularity');
expect(configResult.banner).to.be.equal('medium');
- expect(configResult.video).to.be.equal(customPriceGranularity);
- expect(configResult.native).to.be.equal('medium');
+ expect(configResult.video).to.be.equal(customPriceGranularityVideo);
+ expect(configResult['video-instream']).to.be.equal(customPriceGranularityInstream);
+ expect(configResult['video-outstream']).to.be.equal(customPriceGranularityOutstream);
+ expect(configResult.native).to.be.equal('high');
});
it('sets priceGranularity and customPriceBucket', function () {
From ca5cdcf0c7bdbb00f8b75a0a4c93ab03cdfaaf5e Mon Sep 17 00:00:00 2001
From: Harshad Mane
Date: Tue, 10 Dec 2019 16:52:10 -0800
Subject: [PATCH 21/41] PubMatic to use source value 'pubcid.org' for
pubcommonId (#4570)
* added support for pubcommon, digitrust, id5id
* added support for IdentityLink
* changed the source for id5
* added unit test cases
* changed source param for identityLink
* changed source for pubcommonId to pubcid.org
---
modules/pubmaticBidAdapter.js | 2 +-
test/spec/modules/pubmaticBidAdapter_spec.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules/pubmaticBidAdapter.js b/modules/pubmaticBidAdapter.js
index 4281c4a449e3..358fd7bcf3a8 100644
--- a/modules/pubmaticBidAdapter.js
+++ b/modules/pubmaticBidAdapter.js
@@ -641,7 +641,7 @@ function _handleEids(payload, validBidRequests) {
_handleTTDId(eids, validBidRequests);
const bidRequest = validBidRequests[0];
if (bidRequest && bidRequest.userId) {
- _addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.pubcid`), 'pubcommon', 1);
+ _addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.pubcid`), 'pubcid.org', 1);
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.digitrustid.data.id`), 'digitru.st', 1);
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.id5id`), 'id5-sync.com', 1);
_addExternalUserId(eids, utils.deepAccess(bidRequest, `userId.criteoId`), 'criteo.com', 1);// replacing criteoRtus
diff --git a/test/spec/modules/pubmaticBidAdapter_spec.js b/test/spec/modules/pubmaticBidAdapter_spec.js
index 764897b596b2..f0c97cd72f3a 100644
--- a/test/spec/modules/pubmaticBidAdapter_spec.js
+++ b/test/spec/modules/pubmaticBidAdapter_spec.js
@@ -1561,7 +1561,7 @@ describe('PubMatic adapter', function () {
let request = spec.buildRequests(bidRequests, {});
let data = JSON.parse(request.data);
expect(data.user.eids).to.deep.equal([{
- 'source': 'pubcommon',
+ 'source': 'pubcid.org',
'uids': [{
'id': 'pub_common_user_id',
'atype': 1
From 21dcd5aff5529ab966ebf337f9c818d8692e5208 Mon Sep 17 00:00:00 2001
From: Paul Yang
Date: Tue, 10 Dec 2019 17:46:23 -0800
Subject: [PATCH 22/41] Conversant adapter CCPA support (#4569)
---
modules/conversantBidAdapter.js | 22 +++++-----
.../spec/modules/conversantBidAdapter_spec.js | 40 +++++++++++++++++--
2 files changed, 48 insertions(+), 14 deletions(-)
diff --git a/modules/conversantBidAdapter.js b/modules/conversantBidAdapter.js
index 3ffc54bbe804..bb11b1f87cb6 100644
--- a/modules/conversantBidAdapter.js
+++ b/modules/conversantBidAdapter.js
@@ -122,16 +122,18 @@ export const spec = {
let userExt = {};
- // Add GDPR flag and consent string
- if (bidderRequest && bidderRequest.gdprConsent) {
- userExt.consent = bidderRequest.gdprConsent.consentString;
-
- if (typeof bidderRequest.gdprConsent.gdprApplies === 'boolean') {
- payload.regs = {
- ext: {
- gdpr: (bidderRequest.gdprConsent.gdprApplies ? 1 : 0)
- }
- };
+ if (bidderRequest) {
+ // Add GDPR flag and consent string
+ if (bidderRequest.gdprConsent) {
+ userExt.consent = bidderRequest.gdprConsent.consentString;
+
+ if (typeof bidderRequest.gdprConsent.gdprApplies === 'boolean') {
+ utils.deepSetValue(payload, 'regs.ext.gdpr', bidderRequest.gdprConsent.gdprApplies ? 1 : 0);
+ }
+ }
+
+ if (bidderRequest.uspConsent) {
+ utils.deepSetValue(payload, 'regs.ext.us_privacy', bidderRequest.uspConsent);
}
}
diff --git a/test/spec/modules/conversantBidAdapter_spec.js b/test/spec/modules/conversantBidAdapter_spec.js
index ca6890ceedb0..67dd721a059c 100644
--- a/test/spec/modules/conversantBidAdapter_spec.js
+++ b/test/spec/modules/conversantBidAdapter_spec.js
@@ -404,31 +404,63 @@ describe('Conversant adapter tests', function() {
it('Verify GDPR bid request', function() {
// add gdpr info
- const bidRequest = {
+ const bidderRequest = {
gdprConsent: {
consentString: 'BOJObISOJObISAABAAENAA4AAAAAoAAA',
gdprApplies: true
}
};
- const payload = spec.buildRequests(bidRequests, bidRequest).data;
+ const payload = spec.buildRequests(bidRequests, bidderRequest).data;
expect(payload).to.have.deep.nested.property('user.ext.consent', 'BOJObISOJObISAABAAENAA4AAAAAoAAA');
expect(payload).to.have.deep.nested.property('regs.ext.gdpr', 1);
});
it('Verify GDPR bid request without gdprApplies', function() {
// add gdpr info
- const bidRequest = {
+ const bidderRequest = {
gdprConsent: {
consentString: ''
}
};
- const payload = spec.buildRequests(bidRequests, bidRequest).data;
+ const payload = spec.buildRequests(bidRequests, bidderRequest).data;
expect(payload).to.have.deep.nested.property('user.ext.consent', '');
expect(payload).to.not.have.deep.nested.property('regs.ext.gdpr');
});
+ describe('CCPA', function() {
+ it('should have us_privacy', function() {
+ const bidderRequest = {
+ uspConsent: '1NYN'
+ };
+
+ const payload = spec.buildRequests(bidRequests, bidderRequest).data;
+ expect(payload).to.have.deep.nested.property('regs.ext.us_privacy', '1NYN');
+ expect(payload).to.not.have.deep.nested.property('regs.ext.gdpr');
+ });
+
+ it('should have no us_privacy', function() {
+ const payload = spec.buildRequests(bidRequests, {}).data;
+ expect(payload).to.not.have.deep.nested.property('regs.ext.us_privacy');
+ });
+
+ it('should have both gdpr and us_privacy', function() {
+ const bidderRequest = {
+ gdprConsent: {
+ consentString: 'BOJObISOJObISAABAAENAA4AAAAAoAAA',
+ gdprApplies: true
+ },
+ uspConsent: '1NYN'
+ };
+
+ const payload = spec.buildRequests(bidRequests, bidderRequest).data;
+ expect(payload).to.have.deep.nested.property('user.ext.consent', 'BOJObISOJObISAABAAENAA4AAAAAoAAA');
+ expect(payload).to.have.deep.nested.property('regs.ext.gdpr', 1);
+ expect(payload).to.have.deep.nested.property('regs.ext.us_privacy', '1NYN');
+ });
+ });
+
describe('Extended ID', function() {
it('Verify unifiedid and liveramp', function() {
// clone bidRequests
From 7c0c732805b0a43e8ef0559386f2d93ac9c00817 Mon Sep 17 00:00:00 2001
From: Anand Venkatraman
Date: Tue, 10 Dec 2019 21:26:39 -0500
Subject: [PATCH 23/41] PulsePoint: CCPA and new UserId partner integration
(#4565)
* ET-1691: Pulsepoint Analytics adapter for Prebid. (#1)
* ET-1691: Adding pulsepoint analytics and tests for pulsepoint adapter
* ET-1691: Adding pulsepoint analytics and tests for pulsepoint adapter
* ET-1691: cleanup
* ET-1691: minor
* ET-1691: revert package.json change
* Adding bidRequest to bidFactory.createBid method as per https://github.com/prebid/Prebid.js/issues/509
* ET-1765: Adding support for additional params in PulsePoint adapter (#2)
* ET-1850: Fixing https://github.com/prebid/Prebid.js/issues/866
* Minor fix
* Adding mandatory parameters to Bid
* PulsePoint: CCPA and new user id partner integration
* Review comment
---
modules/pulsepointBidAdapter.js | 53 +++++++++++++---
.../spec/modules/pulsepointBidAdapter_spec.js | 62 +++++++++++++++++--
2 files changed, 100 insertions(+), 15 deletions(-)
diff --git a/modules/pulsepointBidAdapter.js b/modules/pulsepointBidAdapter.js
index c3fd1fa5eaf1..b898618673e0 100644
--- a/modules/pulsepointBidAdapter.js
+++ b/modules/pulsepointBidAdapter.js
@@ -397,9 +397,31 @@ function user(bidRequest, bidderRequest) {
if (bidRequest.userId) {
ext.eids = [];
addExternalUserId(ext.eids, bidRequest.userId.pubcid, 'pubcommon');
- addExternalUserId(ext.eids, bidRequest.userId.tdid, 'ttdid');
- addExternalUserId(ext.eids, utils.deepAccess(bidRequest.userId.digitrustid, 'data.id'), 'digitrust');
- addExternalUserId(ext.eids, bidRequest.userId.id5id, 'id5id');
+ addExternalUserId(ext.eids, bidRequest.userId.britepoolid, 'britepool.com');
+ addExternalUserId(ext.eids, bidRequest.userId.criteoId, 'criteo');
+ addExternalUserId(ext.eids, bidRequest.userId.idl_env, 'identityLink');
+ addExternalUserId(ext.eids, bidRequest.userId.id5id, 'id5-sync.com');
+ addExternalUserId(ext.eids, bidRequest.userId.parrableid, 'parrable.com');
+ // liveintent
+ if (bidRequest.userId.lipb && bidRequest.userId.lipb.lipbid) {
+ addExternalUserId(ext.eids, bidRequest.userId.lipb.lipbid, 'liveintent.com');
+ }
+ // TTD
+ addExternalUserId(ext.eids, bidRequest.userId.tdid, 'adserver.org', {
+ rtiPartner: 'TDID'
+ });
+ // digitrust
+ const digitrustResponse = bidRequest.userId.digitrustid;
+ if (digitrustResponse && digitrustResponse.data) {
+ var digitrust = {};
+ if (digitrustResponse.data.id) {
+ digitrust.id = digitrustResponse.data.id;
+ }
+ if (digitrustResponse.data.keyv) {
+ digitrust.keyv = digitrustResponse.data.keyv;
+ }
+ ext.digitrust = digitrust;
+ }
}
}
return { ext };
@@ -408,13 +430,15 @@ function user(bidRequest, bidderRequest) {
/**
* Produces external userid object in ortb 3.0 model.
*/
-function addExternalUserId(eids, value, source) {
- if (value) {
+function addExternalUserId(eids, id, source, uidExt) {
+ if (id) {
+ var uid = { id };
+ if (uidExt) {
+ uid.ext = uidExt;
+ }
eids.push({
source,
- uids: [{
- id: value
- }]
+ uids: [ uid ]
});
}
}
@@ -423,8 +447,17 @@ function addExternalUserId(eids, value, source) {
* Produces the regulations ortb object
*/
function regs(bidderRequest) {
- if (bidderRequest && bidderRequest.gdprConsent) {
- return { ext: { gdpr: bidderRequest.gdprConsent.gdprApplies ? 1 : 0 } };
+ if (bidderRequest.gdprConsent || bidderRequest.uspConsent) {
+ var ext = {};
+ // GDPR applies attribute (actual consent value is in user object)
+ if (bidderRequest.gdprConsent) {
+ ext.gdpr = bidderRequest.gdprConsent.gdprApplies ? 1 : 0;
+ }
+ // CCPA
+ if (bidderRequest.uspConsent) {
+ ext.us_privacy = bidderRequest.uspConsent;
+ }
+ return { ext };
}
return null;
}
diff --git a/test/spec/modules/pulsepointBidAdapter_spec.js b/test/spec/modules/pulsepointBidAdapter_spec.js
index b62b799c8a01..6ab05a0a0010 100644
--- a/test/spec/modules/pulsepointBidAdapter_spec.js
+++ b/test/spec/modules/pulsepointBidAdapter_spec.js
@@ -431,6 +431,20 @@ describe('PulsePoint Adapter Tests', function () {
expect(ortbRequest.regs.ext.gdpr).to.equal(1);
});
+ it('Verify CCPA', function () {
+ const bidderRequestUSPrivacy = {
+ uspConsent: '1YYY'
+ };
+ const request = spec.buildRequests(slotConfigs, Object.assign({}, bidderRequest, bidderRequestUSPrivacy));
+ expect(request.url).to.equal('https://bid.contextweb.com/header/ortb?src=prebid');
+ expect(request.method).to.equal('POST');
+ const ortbRequest = request.data;
+ // regs object
+ expect(ortbRequest.regs).to.not.equal(null);
+ expect(ortbRequest.regs.ext).to.not.equal(null);
+ expect(ortbRequest.regs.ext.us_privacy).to.equal('1YYY');
+ });
+
it('Verify Video request', function () {
const request = spec.buildRequests(videoSlotConfig, bidderRequest);
expect(request.url).to.equal('https://bid.contextweb.com/header/ortb?src=prebid');
@@ -592,15 +606,53 @@ describe('PulsePoint Adapter Tests', function () {
expect(ortbRequest.user).to.not.be.undefined;
expect(ortbRequest.user.ext).to.not.be.undefined;
expect(ortbRequest.user.ext.eids).to.not.be.undefined;
- expect(ortbRequest.user.ext.eids).to.have.lengthOf(3);
+ expect(ortbRequest.user.ext.eids).to.have.lengthOf(2);
expect(ortbRequest.user.ext.eids[0].source).to.equal('pubcommon');
expect(ortbRequest.user.ext.eids[0].uids).to.have.lengthOf(1);
expect(ortbRequest.user.ext.eids[0].uids[0].id).to.equal('userid_pubcid');
- expect(ortbRequest.user.ext.eids[1].source).to.equal('ttdid');
+ expect(ortbRequest.user.ext.eids[1].source).to.equal('adserver.org');
expect(ortbRequest.user.ext.eids[1].uids).to.have.lengthOf(1);
expect(ortbRequest.user.ext.eids[1].uids[0].id).to.equal('userid_ttd');
- expect(ortbRequest.user.ext.eids[2].source).to.equal('digitrust');
- expect(ortbRequest.user.ext.eids[2].uids).to.have.lengthOf(1);
- expect(ortbRequest.user.ext.eids[2].uids[0].id).to.equal('userid_digitrust');
+ expect(ortbRequest.user.ext.eids[1].uids[0].ext).to.not.be.null;
+ expect(ortbRequest.user.ext.eids[1].uids[0].ext.rtiPartner).to.equal('TDID');
+ expect(ortbRequest.user.ext.digitrust).to.not.be.null;
+ expect(ortbRequest.user.ext.digitrust.id).to.equal('userid_digitrust');
+ expect(ortbRequest.user.ext.digitrust.keyv).to.equal(4);
+ });
+ it('Verify new external user id partners', function () {
+ const bidRequests = deepClone(slotConfigs);
+ bidRequests[0].userId = {
+ britepoolid: 'britepool_id123',
+ criteoId: 'criteo_id234',
+ idl_env: 'idl_id123',
+ id5id: 'id5id_234',
+ parrableid: 'parrable_id234',
+ lipb: {
+ lipbid: 'liveintent_id123'
+ }
+ };
+ const userVerify = function(obj, source, id) {
+ expect(obj).to.deep.equal({
+ source,
+ uids: [{
+ id
+ }]
+ });
+ };
+ const request = spec.buildRequests(bidRequests, bidderRequest);
+ expect(request).to.be.not.null;
+ const ortbRequest = request.data;
+ expect(request.data).to.be.not.null;
+ // user object
+ expect(ortbRequest.user).to.not.be.undefined;
+ expect(ortbRequest.user.ext).to.not.be.undefined;
+ expect(ortbRequest.user.ext.eids).to.not.be.undefined;
+ expect(ortbRequest.user.ext.eids).to.have.lengthOf(6);
+ userVerify(ortbRequest.user.ext.eids[0], 'britepool.com', 'britepool_id123');
+ userVerify(ortbRequest.user.ext.eids[1], 'criteo', 'criteo_id234');
+ userVerify(ortbRequest.user.ext.eids[2], 'identityLink', 'idl_id123');
+ userVerify(ortbRequest.user.ext.eids[3], 'id5-sync.com', 'id5id_234');
+ userVerify(ortbRequest.user.ext.eids[4], 'parrable.com', 'parrable_id234');
+ userVerify(ortbRequest.user.ext.eids[5], 'liveintent.com', 'liveintent_id123');
});
});
From 745fc123e002e00c52ff2bda91a186949ba4ab87 Mon Sep 17 00:00:00 2001
From: Nick Peceniak
Date: Tue, 10 Dec 2019 20:03:23 -0700
Subject: [PATCH 24/41] Add support for TradeDeskID in spotxBidAdapter. (#4564)
* Add support for TradeDeskID in spotxBidAdapter.
* Update spotxBidAdapter.js
---
modules/spotxBidAdapter.js | 30 ++++++++++++++++++-----
test/spec/modules/spotxBidAdapter_spec.js | 12 ++++++++-
2 files changed, 35 insertions(+), 7 deletions(-)
diff --git a/modules/spotxBidAdapter.js b/modules/spotxBidAdapter.js
index cfa308a8670e..ef07190de5db 100644
--- a/modules/spotxBidAdapter.js
+++ b/modules/spotxBidAdapter.js
@@ -212,12 +212,15 @@ export const spec = {
// ID5 fied
if (bid && bid.userId && bid.userId.id5id) {
- userExt.eids = [{
- source: 'id5-sync.com',
- uids: [{
- id: bid.userId.id5id
- }]
- }];
+ userExt.eids = userExt.eids || [];
+ userExt.eids.push(
+ {
+ source: 'id5-sync.com',
+ uids: [{
+ id: bid.userId.id5id
+ }]
+ }
+ )
}
// Add common id if available
@@ -234,6 +237,21 @@ export const spec = {
};
}
+ if (bid && bid.userId && bid.userId.tdid) {
+ userExt.eids = userExt.eids || [];
+ userExt.eids.push(
+ {
+ source: 'adserver.org',
+ uids: [{
+ id: bid.userId.tdid,
+ ext: {
+ rtiPartner: 'TDID'
+ }
+ }]
+ }
+ )
+ }
+
// Only add the user object if it's not empty
if (!utils.isEmpty(userExt)) {
requestPayload.user = { ext: userExt };
diff --git a/test/spec/modules/spotxBidAdapter_spec.js b/test/spec/modules/spotxBidAdapter_spec.js
index d1662e162aa5..be550e8fc837 100644
--- a/test/spec/modules/spotxBidAdapter_spec.js
+++ b/test/spec/modules/spotxBidAdapter_spec.js
@@ -148,7 +148,8 @@ describe('the spotx adapter', function () {
};
bid.userId = {
- id5id: 'id5id_1'
+ id5id: 'id5id_1',
+ tdid: 'tdid_1'
};
bid.crumbs = {
@@ -192,6 +193,15 @@ describe('the spotx adapter', function () {
uids: [{
id: 'id5id_1'
}]
+ },
+ {
+ source: 'adserver.org',
+ uids: [{
+ id: 'tdid_1',
+ ext: {
+ rtiPartner: 'TDID'
+ }
+ }]
}],
fpc: 'pubcid_1'
})
From 11e8113f35a75293ff36a6b2c98bafddb36d3d94 Mon Sep 17 00:00:00 2001
From: Dan Bogdan <43830380+EMXDigital@users.noreply.github.com>
Date: Tue, 10 Dec 2019 22:05:42 -0500
Subject: [PATCH 25/41] adding ccpa support for emx_digital adapter (#4563)
* adding ccpa support for emx_digital adapter
* emx_digital ccpa compliance: lint fix
---
modules/emx_digitalBidAdapter.js | 5 ++++-
test/spec/modules/emx_digitalBidAdapter_spec.js | 8 ++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/modules/emx_digitalBidAdapter.js b/modules/emx_digitalBidAdapter.js
index 7167f9018aa5..0768c8386fb0 100644
--- a/modules/emx_digitalBidAdapter.js
+++ b/modules/emx_digitalBidAdapter.js
@@ -7,7 +7,7 @@ import includes from 'core-js/library/fn/array/includes';
const BIDDER_CODE = 'emx_digital';
const ENDPOINT = 'hb.emxdgt.com';
const RENDERER_URL = '//js.brealtime.com/outstream/1.30.0/bundle.js';
-const ADAPTER_VERSION = '1.41.1';
+const ADAPTER_VERSION = '1.41.2';
const DEFAULT_CUR = 'USD';
export const emxAdapter = {
@@ -230,6 +230,9 @@ export const spec = {
};
emxData = emxAdapter.getGdpr(bidRequest, Object.assign({}, emxData));
+ if (bidRequest && bidRequest.uspConsent) {
+ emxData.us_privacy = bidRequest.uspConsent
+ }
return {
method: 'POST',
url: url,
diff --git a/test/spec/modules/emx_digitalBidAdapter_spec.js b/test/spec/modules/emx_digitalBidAdapter_spec.js
index 80fd12a237c6..525e5808e400 100644
--- a/test/spec/modules/emx_digitalBidAdapter_spec.js
+++ b/test/spec/modules/emx_digitalBidAdapter_spec.js
@@ -355,6 +355,14 @@ describe('emx_digital Adapter', function () {
expect(request.regs.ext).to.have.property('gdpr', 0);
expect(request).to.not.have.property('user');
});
+ it('should add us privacy info to request', function() {
+ let consentString = '1YNN';
+ bidderRequest.uspConsent = consentString;
+ let request = spec.buildRequests(bidderRequest.bids, bidderRequest);
+ request = JSON.parse(request.data);
+ expect(request.us_privacy).to.exist;
+ expect(request.us_privacy).to.exist.and.to.equal(consentString);
+ });
});
describe('interpretResponse', function () {
From 8593acc064e43d0a756d1779eb922cbc07fd3a0c Mon Sep 17 00:00:00 2001
From: dpapworth-qc <50959025+dpapworth-qc@users.noreply.github.com>
Date: Wed, 11 Dec 2019 03:08:04 +0000
Subject: [PATCH 26/41] QC CCPA support (#4557)
* Pass uspConsent parameter from bidder request to QC endpoint.
* Added uspSignal to indicate if uspConsent has been passed in request.
---
modules/quantcastBidAdapter.js | 6 ++++--
test/spec/modules/quantcastBidAdapter_spec.js | 21 +++++++++++++++----
2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/modules/quantcastBidAdapter.js b/modules/quantcastBidAdapter.js
index 673a7f41c000..93f8e398a9db 100644
--- a/modules/quantcastBidAdapter.js
+++ b/modules/quantcastBidAdapter.js
@@ -101,8 +101,8 @@ export const spec = {
*/
buildRequests(bidRequests, bidderRequest) {
const bids = bidRequests || [];
- const gdprConsent = (bidderRequest && bidderRequest.gdprConsent) ? bidderRequest.gdprConsent : {};
-
+ const gdprConsent = utils.deepAccess(bidderRequest, 'gdprConsent') || {};
+ const uspConsent = utils.deepAccess(bidderRequest, 'uspConsent');
const referrer = utils.deepAccess(bidderRequest, 'refererInfo.referer');
const page = utils.deepAccess(bidderRequest, 'refererInfo.canonicalUrl') || config.getConfig('pageUrl') || utils.deepAccess(window, 'location.href');
const domain = getDomain(page);
@@ -139,6 +139,8 @@ export const spec = {
bidId: bid.bidId,
gdprSignal: gdprConsent.gdprApplies ? 1 : 0,
gdprConsent: gdprConsent.consentString,
+ uspSignal: uspConsent ? 1 : 0,
+ uspConsent,
prebidJsVersion: '$prebid.version$'
};
diff --git a/test/spec/modules/quantcastBidAdapter_spec.js b/test/spec/modules/quantcastBidAdapter_spec.js
index b91536689dbe..7e7d47d36442 100644
--- a/test/spec/modules/quantcastBidAdapter_spec.js
+++ b/test/spec/modules/quantcastBidAdapter_spec.js
@@ -137,6 +137,7 @@ describe('Quantcast adapter', function () {
},
bidId: '2f7b179d443f14',
gdprSignal: 0,
+ uspSignal: 0,
prebidJsVersion: '$prebid.version$'
};
@@ -203,6 +204,7 @@ describe('Quantcast adapter', function () {
},
bidId: '2f7b179d443f14',
gdprSignal: 0,
+ uspSignal: 0,
prebidJsVersion: '$prebid.version$'
};
@@ -237,6 +239,7 @@ describe('Quantcast adapter', function () {
},
bidId: '2f7b179d443f14',
gdprSignal: 0,
+ uspSignal: 0,
prebidJsVersion: '$prebid.version$'
};
@@ -267,6 +270,7 @@ describe('Quantcast adapter', function () {
},
bidId: '2f7b179d443f14',
gdprSignal: 0,
+ uspSignal: 0,
prebidJsVersion: '$prebid.version$'
};
@@ -329,6 +333,7 @@ describe('Quantcast adapter', function () {
},
bidId: '2f7b179d443f14',
gdprSignal: 0,
+ uspSignal: 0,
prebidJsVersion: '$prebid.version$'
};
@@ -337,11 +342,19 @@ describe('Quantcast adapter', function () {
});
it('propagates GDPR consent string and signal', function () {
- const gdprConsent = { gdprApplies: true, consentString: 'consentString' }
- const requests = qcSpec.buildRequests([bidRequest], { gdprConsent });
- const parsed = JSON.parse(requests[0].data)
+ const bidderRequest = { gdprConsent: { gdprApplies: true, consentString: 'consentString' } }
+ const requests = qcSpec.buildRequests([bidRequest], bidderRequest);
+ const parsed = JSON.parse(requests[0].data);
expect(parsed.gdprSignal).to.equal(1);
- expect(parsed.gdprConsent).to.equal(gdprConsent.consentString);
+ expect(parsed.gdprConsent).to.equal('consentString');
+ });
+
+ it('propagates US Privacy/CCPA consent information', function () {
+ const bidderRequest = { uspConsent: 'consentString' }
+ const requests = qcSpec.buildRequests([bidRequest], bidderRequest);
+ const parsed = JSON.parse(requests[0].data);
+ expect(parsed.uspSignal).to.equal(1);
+ expect(parsed.uspConsent).to.equal('consentString');
});
describe('`interpretResponse`', function () {
From 317aaa308bf80137d440ec42bb42c62d7c76f3a2 Mon Sep 17 00:00:00 2001
From: DeepthiNeeladri
Date: Wed, 11 Dec 2019 08:39:53 +0530
Subject: [PATCH 27/41] Onevideo Adaptor ccpa support (#4558)
* outstream changes
* removing global filtet
* reverting page
* message
* adapter change
* remove space
* testcases
* testpage
* spaces for test page
* renderer exist case
* reverting package-lock.json
* adding schain object
* adding tagid
* syntaxx error fix
* video.html
* space trailing
* space
* tagid
* inventoryId and placement
* rewarded video
* added unit test case
* ccpa cahnges
* ccpa change
* test page
* test page change
* test page change 2
* change the variable
---
modules/oneVideoBidAdapter.js | 7 +++++++
test/spec/modules/oneVideoBidAdapter_spec.js | 6 ++++++
2 files changed, 13 insertions(+)
diff --git a/modules/oneVideoBidAdapter.js b/modules/oneVideoBidAdapter.js
index 7e8bd3ad2880..f125d88c80c8 100644
--- a/modules/oneVideoBidAdapter.js
+++ b/modules/oneVideoBidAdapter.js
@@ -243,6 +243,13 @@ function getRequestData(bid, consentData, bidRequest) {
};
}
}
+ if (bidRequest && bidRequest.uspConsent) {
+ bidData.regs = {
+ ext: {
+ us_privacy: bidRequest.uspConsent
+ }
+ };
+ }
return bidData;
}
diff --git a/test/spec/modules/oneVideoBidAdapter_spec.js b/test/spec/modules/oneVideoBidAdapter_spec.js
index d46bba038b28..3d21601387bf 100644
--- a/test/spec/modules/oneVideoBidAdapter_spec.js
+++ b/test/spec/modules/oneVideoBidAdapter_spec.js
@@ -203,6 +203,7 @@ describe('OneVideoBidAdapter', function () {
'consentString': 'test-gdpr-consent-string',
'gdprApplies': true
},
+ 'uspConsent\'s': '1YN-',
'bidderCode': 'oneVideo',
'auctionId': 'e158486f-8c7f-472f-94ce-b0cbfbb50ab4',
'bidderRequestId': '1e498b84fffc39',
@@ -237,6 +238,11 @@ describe('OneVideoBidAdapter', function () {
expect(request[0].data.user.ext.consent).to.equal(bidderRequest.gdprConsent.consentString);
});
+ it('should send the uspConsent string', function () {
+ const request = spec.buildRequests([ bidRequest ], bidderRequest);
+ expect(request[0].data.regs.ext.us_privacy).to.equal(bidderRequest.uspConsent);
+ });
+
it('should send schain object', function () {
const requests = spec.buildRequests([ bidRequest ], bidderRequest);
const data = requests[0].data;
From 01450f55934410228cb231ba2b5ef6a6ee54397f Mon Sep 17 00:00:00 2001
From: Harshad Mane
Date: Tue, 10 Dec 2019 19:24:41 -0800
Subject: [PATCH 28/41] PubMatic to send test:1 in the request if
pubmaticTest=true is present in URL (#4553)
* added support for pubcommon, digitrust, id5id
* added support for IdentityLink
* changed the source for id5
* added unit test cases
* changed source param for identityLink
* PubMatic to send test:1 if pubmaticTest=true is present in URL
* added a note in pubmaticBidAdapter.md file
---
modules/pubmaticBidAdapter.js | 5 +++++
modules/pubmaticBidAdapter.md | 5 ++++-
test/spec/modules/pubmaticBidAdapter_spec.js | 18 ++++++++++++++++--
3 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/modules/pubmaticBidAdapter.js b/modules/pubmaticBidAdapter.js
index 358fd7bcf3a8..cf4ccee17d0c 100644
--- a/modules/pubmaticBidAdapter.js
+++ b/modules/pubmaticBidAdapter.js
@@ -895,6 +895,11 @@ export const spec = {
payload.site.page = conf.kadpageurl.trim() || payload.site.page.trim();
payload.site.domain = _getDomainFromURL(payload.site.page);
+ // test bids
+ if (window.location.href.indexOf('pubmaticTest=true') !== -1) {
+ payload.test = 1;
+ }
+
// adding schain object
if (validBidRequests[0].schain) {
payload.source = {
diff --git a/modules/pubmaticBidAdapter.md b/modules/pubmaticBidAdapter.md
index 1948acba40fa..fc7766430a25 100644
--- a/modules/pubmaticBidAdapter.md
+++ b/modules/pubmaticBidAdapter.md
@@ -199,4 +199,7 @@ pbjs.setConfig({
});
```
-Note: Combine the above the configuration with any other UserSync configuration. Multiple setConfig() calls overwrite each other and only last call for a given attribute will take effect.
+Note: Combine the above the configuration with any other UserSync configuration. Multiple setConfig() calls overwrite each other and only last call for a given attribute will take effect.
+
+Note: PubMatic will return a test-bid if "pubmaticTest=true" is present in page URL
+
diff --git a/test/spec/modules/pubmaticBidAdapter_spec.js b/test/spec/modules/pubmaticBidAdapter_spec.js
index f0c97cd72f3a..85d135d9f790 100644
--- a/test/spec/modules/pubmaticBidAdapter_spec.js
+++ b/test/spec/modules/pubmaticBidAdapter_spec.js
@@ -719,9 +719,23 @@ describe('PubMatic adapter', function () {
expect(request.method).to.equal('POST');
});
+ it('test flag not sent when pubmaticTest=true is absent in page url', function() {
+ let request = spec.buildRequests(bidRequests);
+ let data = JSON.parse(request.data);
+ expect(data.test).to.equal(undefined);
+ });
+
+ it('test flag set to 1 when pubmaticTest=true is present in page url', function() {
+ window.location.href += '#pubmaticTest=true';
+ // now all the test cases below will have window.location.href with #pubmaticTest=true
+ let request = spec.buildRequests(bidRequests);
+ let data = JSON.parse(request.data);
+ expect(data.test).to.equal(1);
+ });
+
it('Request params check', function () {
- let request = spec.buildRequests(bidRequests);
- let data = JSON.parse(request.data);
+ let request = spec.buildRequests(bidRequests);
+ let data = JSON.parse(request.data);
expect(data.at).to.equal(1); // auction type
expect(data.cur[0]).to.equal('USD'); // currency
expect(data.site.domain).to.be.a('string'); // domain should be set
From 04c775f13078acc10f204be3ac4e49b0768d899e Mon Sep 17 00:00:00 2001
From: Samuel Adu
Date: Wed, 11 Dec 2019 03:27:30 +0000
Subject: [PATCH 29/41] Pass CCPA consent string to all endpoints (#4536)
---
modules/aolBidAdapter.js | 47 +++----
test/spec/modules/aolBidAdapter_spec.js | 168 +++++++++++++++++++++---
2 files changed, 175 insertions(+), 40 deletions(-)
diff --git a/modules/aolBidAdapter.js b/modules/aolBidAdapter.js
index c065828c10d1..434593fbf58a 100644
--- a/modules/aolBidAdapter.js
+++ b/modules/aolBidAdapter.js
@@ -106,7 +106,11 @@ export const spec = {
return isMarketplaceBid(bid) || isMobileBid(bid);
},
buildRequests(bids, bidderRequest) {
- let consentData = bidderRequest ? bidderRequest.gdprConsent : null;
+ const consentData = {};
+ if (bidderRequest) {
+ consentData.gdpr = bidderRequest.gdprConsent;
+ consentData.uspConsent = bidderRequest.uspConsent;
+ }
return bids.map(bid => {
const endpointCode = resolveEndpointCode(bid);
@@ -230,7 +234,7 @@ export const spec = {
}
return (url.indexOf('//') === 0) ? `${DEFAULT_PROTO}:${url}` : `${DEFAULT_PROTO}://${url}`;
},
- formatMarketplaceDynamicParams(params = {}, consentData) {
+ formatMarketplaceDynamicParams(params = {}, consentData = {}) {
let queryParams = {};
if (params.bidFloor) {
@@ -247,7 +251,7 @@ export const spec = {
return paramsFormatted;
},
- formatOneMobileDynamicParams(params = {}, consentData) {
+ formatOneMobileDynamicParams(params = {}, consentData = {}) {
if (this.isSecureProtocol()) {
params.secure = NUMERIC_VALUES.TRUE;
}
@@ -261,32 +265,27 @@ export const spec = {
return paramsFormatted;
},
- buildOpenRtbRequestData(bid, consentData) {
+ buildOpenRtbRequestData(bid, consentData = {}) {
let openRtbObject = {
id: bid.params.id,
imp: bid.params.imp
};
- if (this.isConsentRequired(consentData)) {
- openRtbObject.regs = {
- ext: {
- gdpr: NUMERIC_VALUES.TRUE
- }
- };
-
- if (consentData.consentString) {
- openRtbObject.user = {
- ext: {
- consent: consentData.consentString
- }
- };
+ if (this.isEUConsentRequired(consentData)) {
+ utils.deepSetValue(openRtbObject, 'regs.ext.gdpr', NUMERIC_VALUES.TRUE);
+ if (consentData.gdpr.consentString) {
+ utils.deepSetValue(openRtbObject, 'user.ext.consent', consentData.gdpr.consentString);
}
}
+ if (consentData.uspConsent) {
+ utils.deepSetValue(openRtbObject, 'regs.ext.us_privacy', consentData.uspConsent);
+ }
+
return openRtbObject;
},
- isConsentRequired(consentData) {
- return !!(consentData && consentData.gdprApplies);
+ isEUConsentRequired(consentData) {
+ return !!(consentData && consentData.gdpr && consentData.gdpr.gdprApplies);
},
formatKeyValues(keyValues) {
let keyValuesHash = {};
@@ -300,14 +299,18 @@ export const spec = {
formatConsentData(consentData) {
let params = {};
- if (this.isConsentRequired(consentData)) {
+ if (this.isEUConsentRequired(consentData)) {
params.gdpr = NUMERIC_VALUES.TRUE;
- if (consentData.consentString) {
- params.euconsent = consentData.consentString;
+ if (consentData.gdpr.consentString) {
+ params.euconsent = consentData.gdpr.consentString;
}
}
+ if (consentData.uspConsent) {
+ params.us_privacy = consentData.uspConsent;
+ }
+
return params;
},
parsePixelItems(pixels) {
diff --git a/test/spec/modules/aolBidAdapter_spec.js b/test/spec/modules/aolBidAdapter_spec.js
index 8386c2c2462d..0f99901bce41 100644
--- a/test/spec/modules/aolBidAdapter_spec.js
+++ b/test/spec/modules/aolBidAdapter_spec.js
@@ -495,6 +495,94 @@ describe('AolAdapter', function () {
});
});
+ describe('buildOpenRtbRequestData', () => {
+ const bid = {
+ params: {
+ id: 'bid-id',
+ imp: []
+ }
+ };
+ let euConsentRequiredStub;
+
+ beforeEach(function () {
+ euConsentRequiredStub = sinon.stub(spec, 'isEUConsentRequired');
+ });
+
+ afterEach(function () {
+ euConsentRequiredStub.restore();
+ });
+
+ it('returns the basic bid info when regulation data is omitted', () => {
+ expect(spec.buildOpenRtbRequestData(bid)).to.deep.equal({
+ id: 'bid-id',
+ imp: []
+ });
+ });
+
+ it('returns the basic bid info with gdpr data when gdpr consent data is included', () => {
+ let consentData = {
+ gdpr: {
+ consentString: 'someEUConsent'
+ }
+ };
+ euConsentRequiredStub.returns(true);
+ expect(spec.buildOpenRtbRequestData(bid, consentData)).to.deep.equal({
+ id: 'bid-id',
+ imp: [],
+ regs: {
+ ext: {
+ gdpr: 1
+ }
+ },
+ user: {
+ ext: {
+ consent: 'someEUConsent'
+ }
+ }
+ });
+ });
+
+ it('returns the basic bid info with CCPA data when CCPA consent data is included', () => {
+ let consentData = {
+ uspConsent: 'someUSPConsent'
+ };
+ expect(spec.buildOpenRtbRequestData(bid, consentData)).to.deep.equal({
+ id: 'bid-id',
+ imp: [],
+ regs: {
+ ext: {
+ us_privacy: 'someUSPConsent'
+ }
+ }
+ });
+ });
+
+ it('returns the basic bid info with GDPR and CCPA data when GDPR and CCPA consent data is included', () => {
+ let consentData = {
+ gdpr: {
+ consentString: 'someEUConsent'
+ },
+ uspConsent: 'someUSPConsent'
+ };
+ euConsentRequiredStub.returns(true);
+ expect(spec.buildOpenRtbRequestData(bid, consentData)).to.deep.equal({
+ id: 'bid-id',
+ imp: [],
+ regs: {
+ ext: {
+ gdpr: 1,
+ us_privacy: 'someUSPConsent'
+ }
+ },
+ user: {
+ ext: {
+ consent: 'someEUConsent'
+ }
+ }
+ });
+ });
+ });
+
describe('getUserSyncs()', function () {
let serverResponses;
let bidResponse;
@@ -545,36 +633,42 @@ describe('AolAdapter', function () {
});
});
- describe('isConsentRequired()', function () {
+ describe('isEUConsentRequired()', function () {
it('should return false when consentData object is not present', function () {
- expect(spec.isConsentRequired(null)).to.be.false;
+ expect(spec.isEUConsentRequired(null)).to.be.false;
});
it('should return true when gdprApplies equals true and consentString is not present', function () {
let consentData = {
- consentString: null,
- gdprApplies: true
+ gdpr: {
+ consentString: null,
+ gdprApplies: true
+ }
};
- expect(spec.isConsentRequired(consentData)).to.be.true;
+ expect(spec.isEUConsentRequired(consentData)).to.be.true;
});
it('should return false when consentString is present and gdprApplies equals false', function () {
let consentData = {
- consentString: 'consent-string',
- gdprApplies: false
+ gdpr: {
+ consentString: 'consent-string',
+ gdprApplies: false
+ }
};
- expect(spec.isConsentRequired(consentData)).to.be.false;
+ expect(spec.isEUConsentRequired(consentData)).to.be.false;
});
it('should return true when consentString is present and gdprApplies equals true', function () {
let consentData = {
- consentString: 'consent-string',
- gdprApplies: true
+ gdpr: {
+ consentString: 'consent-string',
+ gdprApplies: true
+ }
};
- expect(spec.isConsentRequired(consentData)).to.be.true;
+ expect(spec.isEUConsentRequired(consentData)).to.be.true;
});
});
@@ -596,7 +690,7 @@ describe('AolAdapter', function () {
expect(spec.formatMarketplaceDynamicParams()).to.be.equal('');
});
- it('should return formatted params when formatConsentData returns data', function () {
+ it('should return formatted EU consent params when formatConsentData returns GDPR data', function () {
formatConsentDataStub.returns({
euconsent: 'test-consent',
gdpr: 1
@@ -604,6 +698,23 @@ describe('AolAdapter', function () {
expect(spec.formatMarketplaceDynamicParams()).to.be.equal('euconsent=test-consent;gdpr=1;');
});
+ it('should return formatted US privacy params when formatConsentData returns USP data', function () {
+ formatConsentDataStub.returns({
+ us_privacy: 'test-usp-consent'
+ });
+ expect(spec.formatMarketplaceDynamicParams()).to.be.equal('us_privacy=test-usp-consent;');
+ });
+
+ it('should return formatted EU and USP consent params when formatConsentData returns all data', function () {
+ formatConsentDataStub.returns({
+ euconsent: 'test-consent',
+ gdpr: 1,
+ us_privacy: 'test-usp-consent'
+ });
+ expect(spec.formatMarketplaceDynamicParams()).to.be.equal(
+ 'euconsent=test-consent;gdpr=1;us_privacy=test-usp-consent;');
+ });
+
it('should return formatted params when formatKeyValues returns data', function () {
formatKeyValuesStub.returns({
param1: 'val1',
@@ -622,16 +733,16 @@ describe('AolAdapter', function () {
});
describe('formatOneMobileDynamicParams()', function () {
- let consentRequiredStub;
+ let euConsentRequiredStub;
let secureProtocolStub;
beforeEach(function () {
- consentRequiredStub = sinon.stub(spec, 'isConsentRequired');
+ euConsentRequiredStub = sinon.stub(spec, 'isEUConsentRequired');
secureProtocolStub = sinon.stub(spec, 'isSecureProtocol');
});
afterEach(function () {
- consentRequiredStub.restore();
+ euConsentRequiredStub.restore();
secureProtocolStub.restore();
});
@@ -648,14 +759,35 @@ describe('AolAdapter', function () {
expect(spec.formatOneMobileDynamicParams(params)).to.contain('¶m1=val1¶m2=val2¶m3=val3');
});
- it('should return formatted gdpr params when isConsentRequired returns true', function () {
+ it('should return formatted gdpr params when isEUConsentRequired returns true', function () {
let consentData = {
- consentString: 'test-consent'
+ gdpr: {
+ consentString: 'test-consent'
+ }
};
- consentRequiredStub.returns(true);
+ euConsentRequiredStub.returns(true);
expect(spec.formatOneMobileDynamicParams({}, consentData)).to.be.equal('&gdpr=1&euconsent=test-consent');
});
+ it('should return formatted US privacy params when consentData contains USP data', function () {
+ let consentData = {
+ uspConsent: 'test-usp-consent'
+ };
+ expect(spec.formatMarketplaceDynamicParams({}, consentData)).to.be.equal('us_privacy=test-usp-consent;');
+ });
+
+ it('should return formatted EU and USP consent params when consentData contains gdpr and usp values', function () {
+ euConsentRequiredStub.returns(true);
+ let consentData = {
+ gdpr: {
+ consentString: 'test-consent'
+ },
+ uspConsent: 'test-usp-consent'
+ };
+ expect(spec.formatMarketplaceDynamicParams({}, consentData)).to.be.equal(
+ 'gdpr=1;euconsent=test-consent;us_privacy=test-usp-consent;');
+ });
+
it('should return formatted secure param when isSecureProtocol returns true', function () {
secureProtocolStub.returns(true);
expect(spec.formatOneMobileDynamicParams()).to.be.equal('&secure=1');
From ac501846f89e44016cd158771db9902085d9b781 Mon Sep 17 00:00:00 2001
From: Salomon Rada
Date: Wed, 11 Dec 2019 05:31:46 +0200
Subject: [PATCH 30/41] Gamoshi: Add missing user object (#4519)
* Add placement support to beachfront adapter (#4117)
* fix typo on size parameter (#4122)
* Long form video price bucket bugfix (#4125)
* long form price bucket bugfix
* updated logic to use medium as default granularity
* remove unused import
* use contants
* move functions to auction module
* Prebid 2.30.0 release
* Increment pre version
* Optimera added optional device param (#4105). (#4106)
* Optimera added optional device param (#4105).
* Updating to use deepAccess util method (#4105).
* Condensing dealId check (#4105).
* SupplyChain object support in Prebid (#4084)
* moving dctr related code in a function
* moving parsedRequest variable out of the loop
and moving GDPR related block at bottom
* added a todo comment
* exporting hasOwn function
* added functionality to pass schain object
- adapter manager will validate schain object
- if it is valid then only it can be passed on to all bidders
- bidders do not need to validate again
* changed logMessage to logError
- also fixed isInteger check
* Moved schain related code from adapaterManager.js to schain.js
* indentation chnages
* logical bug fix
* added test cases for schain
* PubMatic: pass schain object in request
* indentation
* unit test for PubMatic schain support
* using isInteger from utils
* moved schain as a module
* indentation
* removed commented code
* added try-catch as the statement code was breaking CI for IE-11
* Revert "added try-catch as the statement code was breaking CI for IE-11"
This reverts commit 88f495f156a5f9db894de1728ebd7c5020882f31.
* added a try-catch for a staement as it was breaking CI sometimes
* added schain.md for schain module
* added a few links
* fixed typos
* simplified the approach in adpater code
* trying to restart CI
* Revert "trying to restart CI"
This reverts commit 25f877c1e760abb950d37d58f5d007e54ac2e179.
* adding support in prebidServerBidAdpater as well
* bug fix
* minor changes
- moved consts out of function
- added a error log on finding an invalid schain object
* modified a comment
* added name to a test case
* Revert "added a try-catch for a staement as it was breaking CI sometimes"
This reverts commit e9606bfd348dc16c108ec3af807b95586ece5bbe.
* moving schain validation logic inside PM adapter
* Revert "moving schain validation logic inside PM adapter"
This reverts commit 31d00d5f957ded9c8ed184af59dd24e1177c4b35.
* added validation mode: strict, relaxed, off
* updated documentation
* moved a comment
* changed value in example
* Auto detect if we can bust out of iframe (#15) (#4099)
* Add HTML5 video support param to bid requests
* Use const instead of var for consistency
* Update supported sizes
- Default size returned changed from 0x0 to 1x1 to support PrebidServer
- Now will always respect the bid sizes supported when configured
Co-authored-by: Josh Becker
* Update maintainer contact email
* Support Prebid.js User ID module
- Add support for Unified ID solution of User ID module by
checking for `bidRequest.userId.tdid` param in `buildRequests`
method of Sharethrough's adapter
- Update specs, maintain 80%+ code coverage
* Update logic for changing userAgent string in tests
* Add 3 pbjs callbacks to the adapter
* Add comments on empty implementations
* Update Sharethrough endpoint
* Add logic to detect safeframe
* Remove console.log statements
Fix issue with clientjs detection
Small refactors (linting)
Co-authored-by: Josh Becker
* Continue work on safeframe detection spec
Co-authored-by: Josh Becker
* [WIP]
* update version of sharethrough adapter from 3.0.1 to 3.1.0
* create sharethroughInternal const in adapter so that we can properly stub methods for testing, and utilize utility functions
* rename safeframe detection and iframe JS tag insertion code
* Finish iframe handler specs
Refactor spec file
* Change method of detecting whether locked in a frame or not
* Add logic to detect safeframe
* Remove console.log statements
Fix issue with clientjs detection
Small refactors (linting)
Co-authored-by: Josh Becker
* Continue work on safeframe detection spec
Co-authored-by: Josh Becker
* [WIP]
* update version of sharethrough adapter from 3.0.1 to 3.1.0
* create sharethroughInternal const in adapter so that we can properly stub methods for testing, and utilize utility functions
* rename safeframe detection and iframe JS tag insertion code
* Finish iframe handler specs
Refactor spec file
* Change method of detecting whether locked in a frame or not
* Rubicon adapter: added sizes (#4147)
* added missing comma
* fixing syntax error
* add logic to prefer prebid modules over external modules in build process (#4124)
* add check in getModules helper function
* update logic based on feedback
* update node version of project
* Improve Digital adapter: adding bid floor, referrer, more native fields (#4103)
* Bid floor, https, native ad update
* Update the ad server protocol module
* Adding referrer
* YIELDONE adapter - change urls to adapt https (#4139)
* update: change urls to adapt https
* fix test code
* Added SupplyChain Object support and an onTimeout Callback (#4137)
* - Implemented the 'onTimeout' callback to fire a pixel when there's a timeout.
- Added the ability to serialize an schain object according to the description provided here: https://github.com/InteractiveAdvertisingBureau/openrtb/blob/master/supplychainobject.md
* some mods to the schain tag generation
* - added tests for schain param checking.
* - fixed a malformed url for timeouts
* - Removed a trailing ',' while generating a schain param.
* Revert "Added SupplyChain Object support and an onTimeout Callback (#4137)"
This reverts commit e61b246b45bd2c2390350eaeca693f208b1a3a24.
This commit doesn't use the schain module added in #4084
* Nobid Prebid Adapter commit (#4050)
* Nobid Prebid Adapter commit
* Fixed global replace and unit tests
* Fixed find function
* Added nobidBidAdapter.md
* Removed description and added "Bid Params" section.
* Added test siteId 2 for testing.
* Refactored the Adapter to remove most references to the nobid object. We still need the nobid object because we have a passback tag in DFP that makes reference to it.
* Fix concurrent responses on the page
* Cosmetic change to log an error in case of missing ad markup
* Keep nobid.bidResponses cross adapters.
* Added GDPR support in user sync and added test coverage.
gulp test-coverage
gulp view-coverage
* Padding issues
* Fix padding issues
* Fix padding
* update outstream prod url (#4104)
* support pubcid and uids (#4143)
* Fix misspelling and minor cleanup of schain docs (#4150)
* Prebid 2.31.0 Release
* Increment pre version
* Rubicon: tuning logged messages (#4157)
* Rubicon: tuning logged messages
* Update rubiconBidAdapter.js
* fixed indentation
* Rubicon Video COPPA fix (#4155)
* Rubicon Video COPPA fix
* Unit test for Rubicon Video COPPA fix
* Playground XYZ adapter - iframe usersync bug fix (#4141)
* corrected user sync type
* removed support for iframe usersync
* added unit tests for getUserSyncs
* update nvmrc file (#4162)
* update gulp-footer package (#4160)
* Datablocks bid/analytics adapter (#4128)
* add datablocks Analytics and Bidder Adapters
* remove preload param
* remove preloadid
* better coverage of tests
* better coverage
* IE doesn't support array.find
* lint test
* update example host
* native asset id should be integer
* update logic of ad_types field in appnexusBidAdapter (#4065)
* Shorten SomoAudience to just Somo (#4163)
* Shorten SomoAudience to just Somo
* Make package-lock return
* Quantcast: Fix for empty video parameters (#4145)
* Copy params from bid.params.video.
* Added test for missing video parameters.
* Include mimes from adunit.
* One Video adding Rewarded Video Feature (#4142)
* outstream changes
* removing global filtet
* reverting page
* message
* adapter change
* remove space
* testcases
* testpage
* spaces for test page
* renderer exist case
* reverting package-lock.json
* adding schain object
* adding tagid
* syntaxx error fix
* video.html
* space trailing
* space
* tagid
* inventoryId and placement
* rewarded video
* added unit test case
* Module to pass User Ids to DFP (#4140)
* first commit
* renamed
* minor doc change
* documentation
* small change
* EB
* removed unused imports
* minor changes
* reanmaed a const
* adding more methods to test shareUserIds module
* unit tets cases for shareUserIds
* indentation
* renamed DFP to GAM
* renamed shareUserIds to userIdTargeting
* Update userIdTargeting.md
* trying to restart CI
* digitrust userId case handled
* minor comment change
* using auctionEnd event instead of requestBids.before
* using events.on
* Buzzoola bid adapter (#4127)
* initial commit for buzzoola adapter
* leave only banners for now
* fix bid validation
* change endpoint url
* add video type
* restore renderer
* fix renderer
* add fixed player sizes
* switch bids
* convert dimentions to strings
* write tests
* 100% tests
* remove new DOM element creation in tests
* handle empty response from server
* change description
* E2e tests for Native and Outstream video Ad formats. (#4116)
* reorganize e2e/ tests into separate directories
* new test page for e2e-banner testing
* add test to check if Banner Ad is getting loaded
* change location of the spec files to reflect change in test/e2e directory structure
* add test case to check for generation of valid targeting keys
* create Native Ad test page
* add test case to check validity of the targeting keys and correct rendering of the Ad
* update old browser versions to new
* update browser version
* update title
* remove console.log statements
* add basic functional test for e2e outstream video ad format
* Update LockerDome adUnitId bid param (#4176)
This is not a breaking change
* fix several issues in appnexus video bids (#4154)
* S2s testing disable client side (#4123)
* Add microadBidAdapter
* Remove unnecessary encodeURIComponent from microadBidAdapter
* Submit Advangelists Prebid Adapter
* Submit Advangelists Prebid Adapter 1.1
* Correct procudtion endpoint for prebid
* analytics update with wrapper name
* reverted error merge
* New testServerOnly flag
* Tests and a bug fix
* Removed dead code
* Fixes requested in review
* Check each adUnit
* isTestingServerOnly changes per Eric
* Fixed IE 11 bug
* More tests
* improved test case names
* New option to Include deal KVPs when enableSendAllBids === false (#4136)
* new option to include KVPs which have deals when
enableSendAllBids === false
* updating tests to be more realistic
* Prebid 2.32.0 Release
* increment pre version
* Rubicon doc: changing video test zone (#4187)
* added schain support to sonobi adapter (#4173)
* if schain config is not defined then error should not be thrown (#4165)
* if schain config is not defiend then error should not be thrown
* relaxed mode nodes param not defined error handled
* added test cases for config validation
* a curly bracket was missing in the example
* Rubicon: updating test params (#4190)
* myTargetBidAdapter: support currency config (#4188)
* Update README.md (#4193)
* Update README.md
* Update README.md
* cedato bid adapter instream video support (#4153)
* Added adxpremium prebid analytics adapter (#4181)
* feat(OAFLO-186): added support for schain (#4194)
* Sonobi - send entire userid payload (#4196)
* added userid param to pass the entire userId payload to sonobis bid request endpoint
* removed console log
git p
* fixed lint
* OpenX Adapter fix: updating outdated video examples (#4198)
* userId - Add support for refreshing the cached user id (#4082)
* [userId] Added support for refreshing the cached user id: refreshInSeconds storage parameter, related tests and implementation in id5 module
* [userId] Added support for refreshing the cached user id: refreshInSeconds storage parameter, related tests and implementation in id5 module
* UserId - ID5 - Updated doc with new contact point for partners
* UserId - Merged getStoredValue and getStoredDate
* [UserId] - ID5 - Moved back ID5 in ./modules
* UserId - ID5 - Fixed incorrect GDPR condition
* [UserId] - Doc update and test cleanup
* Prebid 2.33.0 Release
* Increment pre version
* SupplyChainObject support and fires a pixel onTimeout (#4152)
* - Implemented the 'onTimeout' callback to fire a pixel when there's a timeout.
- Added the ability to serialize an schain object according to the description provided here: https://github.com/InteractiveAdvertisingBureau/openrtb/blob/master/supplychainobject.md
* some mods to the schain tag generation
* - added tests for schain param checking.
* - fixed a malformed url for timeouts
* - Removed a trailing ',' while generating a schain param.
* - Using the schain object from validBidRequest if present. Reverting to checking if params has it if not.
* - reverting changes to merge with master
* - Resolving merge issues
* Feature/add profile parameter (#4185)
* Add optional profile parameter
* EMXDigital Bid Adapter: Add video dimensions in request (#4174)
* addressed feedback from #3731 ticket
* removed commented code from emx test spec
* logging removed from spec
* flip h & w values from playerSize for video requests
* adding Outstream mediaType to EMX Digital
* adding device info. update to grab video param. styling changes.
* add video dimensions from playerSize
* fix test for video dimensions
* Added keywords parameter support in TrustX Bid Adapter (#4183)
* Add trustx adapter and tests for it
* update integration example
* Update trustx adapter
* Post-review fixes of Trustx adapter
* Code improvement for trustx adapter: changed default price type from gross to net
* Update TrustX adapter to support the 1.0 version
* Make requested changes for TrustX adapter
* Updated markdown file for TrustX adapter
* Fix TrustX adapter and spec file
* Update TrustX adapter: r parameter was added to ad request as cache buster
* Add support of gdpr to Trustx Bid Adapter
* Add wtimeout to ad request params for TrustX Bid Adapter
* TrustX Bid Adapter: remove last ampersand in the ad request
* Update TrustX Bid Adapter to support identical uids in parameters
* Update TrustX Bid Adapter to ignore bids that sizes do not match the size of the request
* Update TrustX Bid Adapter to support instream and outstream video
* Added wrapperType and wrapperVersion parameters in ad request for TrustX Bid Adapter
* Update TrustX Bid Adapter to use refererInfo instead depricated function utils.getTopWindowUrl
* HOTFIX for referrer encodind in TrustX Bid Adapter
* Fix test for TrustX Bid Adapter
* TrustX Bid Adapter: added keywords passing support
* rubicon: avoid passing unknown position (#4207)
* rubicon: not passing pos if not specified
* added comment
* not sending pos for video when undefined
* cleaning up test
* fixed unit test
* correctly reference bidrequest and determine mediatype of bidresponse (#4204)
* GumGum: only send gdprConsent when found (#4205)
* adds digitrust module, mods gdpr from bool to int
* update unit test
* only send gdprconsent if present
* LKQD: Use refererInfo.referer as fallback pageurl (#4210)
* Refactored URL query parameter passthrough for additional values, changed SSP endpoint to v.lkqd.net, and updated associated unit tests
* Use refererInfo.referer as fallback pageurl
* Removed logs and testing values
* [UserId] - ID5 - Fixed case when consentData is undefined (No CMP) (#4215)
* create stubs for localStorage in widespaceBidAdapter test file (#4208)
* added adId property to adRenderFailed event (#4097)
When no bid (therefore no adUnitCode) is available in the adRenderFailed event it can be difficult to identify the erroring slot.But in almost all cases the given slot still has the adId targeting.
* OpenX Adapter: Forcing https requests and adding UserID module support for LiveRamp and TTD (#4182)
* OpenX Adapter: Updated requests to force https
* OpenX Adapter: Added support for TTD's UnifiedID and LiveRamp's IDL
* PubMatic to support userId sub-modules (#4191)
* added support for pubcommon, digitrust, id5id
* added support for IdentityLink
* changed the source for id5
* added unit test cases
* changed source param for identityLink
* TripleLift support for UnifiedId and IdentityLink (#4197)
* Add IdentityLink support and fix UnifiedId.
It appears we've been looking for UnifiedId userIds
on the bidderRequest object, when they are found on bidRequests.
This commit fixes that error, and adds support for IdentityLink.
* change maintainer email to group
* Added lemma adapter (#4126)
* lemmaBidAdapter.js
Added lemma bid adapter file
* lemmaBidAdapter.md
Added lemma bid adapter md file
* lemmaBidAdapter_spec.js
Added lemma bid adapter test spec file
* Update lemmaBidAdapter.js
Fixed automated code review alert comparison between inconvertible types
* Update lemmaBidAdapter.js
Fixed review changes
* Update lemmaBidAdapter.md
Correct parameter value.
* Adkernel adapter new alias (#4221)
* Force https scheme for Criteo Bidder (#4227)
* assign adapter version number
* Ensure that Criteo's bidder is always called through https
* Add Video Support for Datablocks Bid Adapter (#4195)
* add datablocks Analytics and Bidder Adapters
* remove preload param
* remove preloadid
* better coverage of tests
* better coverage
* IE doesn't support array.find
* lint test
* update example host
* native asset id should be integer
* add datablocks Video
* remove isInteger
* skip if empty
* update adUnit, bidRequest and bidResponse object (#4180)
* update adUnit, bidRequest and bidResponse object
* add test for mediaTypes object
* 3 display banner and video vast support for rads (#4209)
* add stv adapter
* remove comments from adapter file
* start rads adapter
* fix adapter and tests
* fixes
* fix adapter and doc
* fix adapter
* fix tests
* little fix
* add ip param
* fix dev url
* #3 radsBidAdapter.md
* #3 radsBidAdapter.md: cleanup
* fix code and doc
* UserId - Add SameSite and server-side pubcid support (#3869)
* Add SameSite and server-side pubcid support
* Fix emoteevBidAdapter unit test
* added schain to appnexus bid adapter (#4229)
* added schain to appnexus bid adapter
* semicolon
* update doubleclick url (#4179)
* Prebid 2.34.0 release
* increment pre version
* Rubi Analytics handles > 1 bidResponse per bidRequest (#4224)
* videoNow bid adapter (#4088)
* -- first commit
* -- cors and bidder's name fixed
* -- almost ready
* -- added docs
* -- added nurl tracking
* -- bid params
* -- tests added
* -- test fixed
* -- replace placeholder in the onBidWon pixel's url
* -- commit for restart tests
* -- change response data format for display ad
* -- tests updated
* -- 100% tests coverage
* -- a few clean the test's code
* -- custom urls from localStorage
* -- tests updated
* -- a few clean the test's code
* -- new init model
* -- spec for new init model
* -- fix for new init model
* -- code cleaned
* -- 100% tests coverage
* -- 100% tests coverage
* -- fixed test
* -- commit for restart tests
* djax new bidder adapter (#4192)
* djax bidder adapter
* djax bidder adapter
* Update hello_world.html
* Added Turk Telekom Bid Adapter (#4203)
* Added Turk Telekom Bid Adapter
* Fix md file for Turk Telekom Bid Adapter
* MicroAd: Use HTTPS in all requests (#4220)
* Always use HTTPS endpoint in MicroAd
* Update code
* Fixed a broken test in MicroAd
* Schain: avoiding Object.values as it is breaking on IE11 (#4238)
* added support for pubcommon, digitrust, id5id
* added support for IdentityLink
* changed the source for id5
* added unit test cases
* changed source param for identityLink
* avoiding use of Object.values
* 3952 delay auction for ids (#4115)
* 3952 delay auction for user ids
* 3952 add integration example
* 3952 add tests
* 3952 fix html example
* add todos
* 3952 continue auction if ids received
* 3952 add tests for auction delay
* increase test coverage
* set config for test
* remove todo
* add a few more checks to tests
* add comment, force tests to rerun
* Feature: adUnitBidLimit (#3906)
* added new feature to config to limit bids when sendallbids is enabled
* cleaned up code. removed extra spaces etc
* removed trailing spaces in config
* remove .flat() and replaced with spread operator
* removed flat function and instead pushing using spread operator
* updated to use sendBidsControl instead
* updated targeting_spec to test bidLimit
* removed trailing spaces from targeting_spec
* Update Rubicon Adapter netRevenue default (#4242)
* Add microadBidAdapter
* Remove unnecessary encodeURIComponent from microadBidAdapter
* Submit Advangelists Prebid Adapter
* Submit Advangelists Prebid Adapter 1.1
* Correct procudtion endpoint for prebid
* analytics update with wrapper name
* reverted error merge
* update changed default value of netRevenue to true
* Removed AdastaMadia from alias (#4255)
* Update appnexusBidAdapter.js (#4251)
* IdentityLink - change expiration time to 30 days (#4239)
* Add coppa support for AppNexus adapter (#4253)
* Add coppa support for AppNexus adapter
* test name
* add new longform e2e tests (#4206)
* Konduit module (#4184)
* Adding Konduit module
* Removed superfluous arguments passed to obtainVastUrl function
* Removed superfluous arguments passed to obtainVastUrl function.
* Build trigger (empty commit)
* Module documentation updated according to the comments
* Logic in obtainVastUrl function updated according to the review comment.
* Removed hook, enabled eslint
* Circle CI runs e2e tests on every push (#4200)
* run functional tests on circle ci on push to any remote branch
* remove extraneous key from config file
* add test.localhost as alias to 127.0.0.1
* check 0: execute circle-ci
* move /etc/config to a separate command
* change bid partner to rubicon
* test appnexus bid adapter in ci
* comment browserstack command
* remove console.log statement
* test1: circle-ci
* change reference dev -> prod while loading prebid
* add console.log statement
* check-2: circle-ci
* comment browserstack testing
* change bid adapter
* change bid adapter
* remove test case for checking targeting keys
* remove the ci flag
* uncomment test for checking correct generation of targeting keys
* swap AN -> Rubicon for testing targeting keys
* Outcon bid adapter. (#4161)
* Outcon bid adapter.
* Fix identation
* Fixes
* Fixes
* Fixes
* Spec fixes
* Fixes
* Fix urls
* Fix
* Fix parameters
* Fix space operators
* Fix bidder timeout
* Update
* Fix whitespace
* no message
* Outcon unit test
* no message
* no message
* no message
* no message
* Fixes
* Fixes
* Change url
* no message
* no message
* no message
* Added bidId
* no message
* no message
* no message
* no message
* Wrapping url with html
* no message
* no message
* no message
* Adding workflow to run end to end tests (#4230)
* Adding workflow to run end to end tests
* trying self branch
* Update to run at 12 every day
* cleanup config using aliases
* update branch and cron time
* add command
* update prebid path for e2e test pages (#4274)
* Prebid 2.35.0 release
* Increment pre version
* Add usersync to adpone adapter (#4245)
* add user sync to adpone adapter
* move adpone usersync to global variable
* added withcredentials to http request
* fix http request options
* fix http request options
* add withCredentials: true
* add withCredentials: true
* added test coverage to usersync
* update sync function
* add test coverage
* adpone adapter
* package lock
* add more testing
* add more testing
* testing for onBidWon fucntion
* test onbidwon function
* trigger build
* Revert GumGum Adapter 2.28 resizing changes (#4277)
* changed resizing unit tests to return the first size dimensions in the sizes array
* added some changes
* reverted adapter changes
* SpotX Bid Adapter: Support schain, ID5 object, Google consent object, and hide_skin (#4281)
* Add SpotXBidAdapter
* Minor updates
* Undo testing changes to shared files
* Fix relative imports
* Remove superfluous imports and write a few more tests
* Formatting, ID5 object, Google consent objects
- Added ID5 object support
- Added Google Consent object
- Reformatted indentaiton on spec file
* Revert content_width and content_height changes in docs
- not sure how these got moved, lets put them back
* Remove click_to_replay flag in example
- no reason to use this one in the example
* Spotx adapter - Add schain support and update unit tests
* Update schain path in ORTB 2.3 request body
- schain object is now added to ortb request body
at request.ext.source.ext.schain
* Add hide_skin to documentation
- whoops, this got removed, let's add it back
* Update Rubicon Analytics Adapter `bidId` to match PBS (#4156)
* Add microadBidAdapter
* Remove unnecessary encodeURIComponent from microadBidAdapter
* Submit Advangelists Prebid Adapter
* Submit Advangelists Prebid Adapter 1.1
* Correct procudtion endpoint for prebid
* analytics update with wrapper name
* reverted error merge
* update for rubicon analytics to send seat[].bid.id for PBS video and banner
* fixed conditional for server and video or banner
* updated with optimized value test for bidid
* update changed default value of netRevenue to true
* remove var declaration for rightSlot to correct lgtm error for unused variable
* update defineSlot div id to match div id defined in html body
* update test ad unit test props
* revert lock to match remote master
* add seatBidId to bidObj in rpBidAdapter interpretResponse
* update setTargeting to execute in the bids back handler
* remove dev integration test page
* meaningless commit to get lgtm to re-run
* SmartRTB adapter update (#4246)
* modules: Implement SmartRTB adapter and spec.
* Fix for-loop syntax to support IE; refactor getDomain out of exported set.
* Remove debugs, update doc
* Update test for video support
* Handle missing syncs. Add video to media types in sample ad unit
* Add null response check, update primary endpoint
* Note smrtb video requires renderer
* Support Vast Track (#4276)
* Add microadBidAdapter
* Remove unnecessary encodeURIComponent from microadBidAdapter
* Submit Advangelists Prebid Adapter
* Submit Advangelists Prebid Adapter 1.1
* Correct procudtion endpoint for prebid
* analytics update with wrapper name
* reverted error merge
* update changed default value of netRevenue to true
* Add parameters if config.cache.vasttrack is true
* Use requestId instead of adId
* Test new vasttrack payload params
* Removed commented out code
* Relaxed conditional check per review
* Removed commented out line
* Added 1000x250 size (#4295)
* prepare vidazoo adapter for v3.0 (#4291)
* Improve Digital adapter: support schain (#4286)
* LiveIntent Identity Module. (#4178)
* LiveIntentIdSystem. Initial implementation.
* LiveIntentIdSystem. Removed whitespace.
* Fixed typo
* Renamed variables, cookiesm added md.
* Changed the default identity url.
* Composite id, with having more than just the lipbid passed around.
* Composite id.
* Merge conflict resolution.
* Changed docs and param description.
* Added typedoc & mentioned liveIntentIdSystem in submodule.json.
* Extracted the LiveIntentIdSystem under modules, removed it from default userId modules.
* Fixing the 204 + no body scenario.
* Added liveIntent to submodule.json
* Fixing docs indentation.
* Updated prebidServer & specs.
* Minor specs update.
* updating liveintent eids source (#4300)
* updating liveintent eids source
these are supposed to be domains
* updating unit test
* fix appnexusBidAdapter view-script regex (#4289)
* fix an view script regex
* minor syntax update
* 33Across adding bidder specific extension field (#4298)
* - add 33across specific ext field for statedAt
* - fix unit test for 33Across adapter
* PubMatic to support LiveIntent User Id sub-module (#4306)
* added support for pubcommon, digitrust, id5id
* added support for IdentityLink
* changed the source for id5
* added unit test cases
* changed source param for identityLink
* supporting LiveIntent Id in PubMatic adapter
* updated source for liveintent
* Finteza Analytics Adapter: fix cookies (#4292)
* fix reading and sending cookies
* fix lint errors
* clear comments
* add unit tests
* fix calling of setCookies for IE
* clear cookies after test
* use own setCookie method inside tests
* Update LockerDome adapter to support Prebid 3.0 (#4301)
* Returning the `IdResponse` type with an obj + callback. Fix for 4304 (#4305)
* Returning the `IdResponse` type with an obj + callback.
* Renamed resp -> result.
* Removed whitespace.
* ShowHeroes adapter - expanded outstream support (#4222)
* add ShowHeroes Adapter
* ShowHeroes adapter - expanded outstream support
* Revert "ShowHeroes adapter - expanded outstream support"
This reverts commit bfcdb913b52012b5afbf95a84956b906518a4b51.
* ShowHeroes adapter - expanded outstream support
* ShowHeroes adapter - fixes (#4222)
* ShowHeroes adapter - banner and outstream fixes (#4222)
* ShowHeroes adapter - description and outstream changes (#4222)
* ShowHeroes adapter - increase test coverage and small fix
* [Orbidder-Adapter] Add bidRequestCount and remove bid.params.keyValues (#4264)
* initial orbidder version in personal github repo
* use adUnits from orbidder_example.html
* replace obsolete functions
* forgot to commit the test
* check if bidderRequest object is available
* try to fix weird safari/ie issue
* ebayK: add more params
* update orbidderBidAdapter.md
* use spec. instead of this. for consistency reasons
* add bidfloor parameter to params object
* fix gdpr object handling
* default to consentRequired: false when not explicitly given
* wip - use onSetTargeting callback
* add tests for onSetTargeting callback
* fix params and respective tests
* remove not used bid.params.keyValues
* add bidRequestCount to orbidder.otto.de/bid Post request
* add bidRequestCount to test object defaultBidRequest
* PulsePoint: remove usage of deprecated utils method / prep for 3.0 (#4257)
* ET-1691: Pulsepoint Analytics adapter for Prebid. (#1)
* ET-1691: Adding pulsepoint analytics and tests for pulsepoint adapter
* ET-1691: Adding pulsepoint analytics and tests for pulsepoint adapter
* ET-1691: cleanup
* ET-1691: minor
* ET-1691: revert package.json change
* Adding bidRequest to bidFactory.createBid method as per https://github.com/prebid/Prebid.js/issues/509
* ET-1765: Adding support for additional params in PulsePoint adapter (#2)
* ET-1850: Fixing https://github.com/prebid/Prebid.js/issues/866
* Minor fix
* Adding mandatory parameters to Bid
* Removing usage of deprecated utils method
* minor refactor
* Use isArray method (#4288)
* Add Parrable ID submodule (#4266)
* add parrable id submodule
* fix integration test config
* fix var name
* always refresh sotredId for parrable
* add submodulesThatAlwaysRefresh concept
* remove comment
* add parrable url as one string
* add parrable prod endpoint
* use .indexOf instead of .includes
* add params to test config
* comment failing test
* uncomment failing assertion
* add parrable ID to prebid server adapter
* add parrableIdSystem to .submodules.json
* extract parrableId unit tests from userId spec
* remove breakline between imports
* remove unused param
* remove userId generic feature from parrableId module
* remove trailing space
* fix failing test due to none merged conflict
* Prebid 2.36.0 Release
* Increment pre version
* Support schain module and send bidfloor param in Sharethrough adapter (#4271)
* Add support for supply chain object module
Story: [#168742394](https://www.pivotaltracker.com/story/show/168742394)
Co-authored-by: Josh Becker
* Add bidfloor parameter to bid request sent to STX
Story: [#168742573](https://www.pivotaltracker.com/story/show/168742573)
* Platform One Analytics Adapter (#4233)
* Added Y1 Analytics Adapter
* rename y1AnalyticsAdapter in yieldoneAnalyticsAdapter
* Yieldone Bid Adapter: fixes from lint check
* Yieldone Analytics Adapter: fix endpoint protocol
* Added spec file for yieldone Analytics Adapter
* Fix parrable id integration example (#4317)
* fix parrableId integration example
* add parentheses
* Improve Digital adapter: support for video (#4318)
* Bid floor, https, native ad update
* Update the ad server protocol module
* Adding referrer
* Improve Digital support for video
* Improve Digital adapter: video
* adapter version -> 6.0.0
* Gamoshi: Update aliases list. Add support for userSync. (#4319)
* Add support for multi-format ad units. Add favoredMediaType property to params.
* Add tests for gdpr consent.
* Add adId to outbids
* Modify media type resolving
* Refactor multi-format ad units handler.
* Modify the way of sending GDPR data.
Update aliases.
* Add new consent fields. Add unit test.
* Add new consent fields. Add unit test.
* Add support for id5 and unified id cookie sync.
* Add support for id5 and unified id cookie sync.
* Add restricted check for gdpr consent.
* fix for userSync endpoint getting called with bidder alias names, instead of actual bidder names (#4265)
* modify ixBidAdapater to always use the secure endpoint (#4323)
* PubMatic to support Parrable User Id sub-module (#4324)
* added support for pubcommon, digitrust, id5id
* added support for IdentityLink
* changed the source for id5
* added unit test cases
* changed source param for identityLink
* PubMatic to support parrable id
* VISX: currency validation & fix double escape of referer (#4299)
* PubMatic to support coppa (#4336)
* added support for pubcommon, digitrust, id5id
* added support for IdentityLink
* changed the source for id5
* added unit test cases
* changed source param for identityLink
* added coppa compliance
* vuble: outstream has fullscreen option (#4320)
* Mod: vuble oustream has fullscreen option
* Add: vuble test for outstream scenario
* EMXDigital: hotfix to resolve URIError from decodeURIComponent (#4333)
* hotfix to resolve URIError from decodeURIComponent
* added unit for decoding adm
* Specify second parameter for parseInt for pubmaticBidAdapter (#4347)
* Remove usage of getTopWindowUrl in Prebid Adapter (#4341)
* Conversant Bid Adapter update for 3.0 (#4284)
* Add cpmDistribution function for Google Analytics adapter (#4240)
* Add cpmDistribution function for Google Analytics adapter
* Add test for the cpmDistribution function
* Remove half written comment
* fixing SRA p_pos (#4337)
* In Sonobi Adapter, only read sizes from bid.mediaTypes (#4311)
* Fix mediaTypes (#4332)
* Outcon bid adapter.
* Fix identation
* Fixes
* Fixes
* Fixes
* Spec fixes
* Fixes
* Fix urls
* Fix
* Fix parameters
* Fix space operators
* Fix bidder timeout
* Update
* Fix whitespace
* no message
* Outcon unit test
* no message
* no message
* no message
* no message
* Fixes
* Fixes
* Change url
* no message
* no message
* no message
* Added bidId
* no message
* no message
* no message
* no message
* Wrapping url with html
* no message
* no message
* no message
* Fix mediaTypes
* no message
* Update outconBidAdapter_spec.js
* Adding VAS response
* no message
* no message
* no message
* Fix
* Changed ttl
* no message
* supportedMediaTypes
* no message
* no message
* Prebid 2.37.0 release
* increment pre version
* Add vast xml support and other minor changes to Beachfront adapter (#4350)
* Add support for vast xml in the bid response
* add secure protocol to outstream player url
* add device connection type
* add player setting for poster color
* add new value for creative Id
* Update smartrtbBidAdapter (#4362)
* modules: Implement SmartRTB adapter and spec.
* Fix for-loop syntax to support IE; refactor getDomain out of exported set.
* Remove debugs, update doc
* Update test for video support
* Handle missing syncs. Add video to media types in sample ad unit
* Add null response check, update primary endpoint
* Note smrtb video requires renderer
* Remove old params checks, fix documentation playerSize field name
* Revert "Update smartrtbBidAdapter (#4362)" (#4368)
This reverts commit be6704bcec65a28d80b6d09a8d1c51ef9a8ba824.
* Add userSync in onetagBidAdapter (#4358)
* Minor bug fixing in onetagBidAdapter.js
Fixed a minor bug. Updated TTL in response to align the correct specifications.
* Update onetagBidAdapter
Added additional page info and user sync function.
* Update onetagBidAdapter_spec.js
Added the test for getUserSyncs function.
* Fix about userSync
* getUserSyncs: test update with gdpr params
* Sovrn adapter updates: schain, digitrust, pixel syncing, and 3.0 upgrades (#4335)
* schain and digitrust
* pixel beacons
* unit tests and fixes from testing
* Prebid 3.0 updates
* review fix
* Add bid adapter for ablida (#4256)
* Add ablida adapter
* rename category parameter, add documentation
* AdKernel: added waardex_ak alias (#4290)
* added alias
Added a new alias
* fixing unit test
* Revert "Sovrn adapter updates: schain, digitrust, pixel syncing, and 3.0 upgrades (#4335)" (#4376)
This reverts commit 6114a3dba93815dcfb535707d7b4d84f1adb2bc7.
* Vrtcal Markets Inc. Bid Adapter Addition (#4259)
* Added 3 key Vrtcal Adapter files: adapter,markdown,unit tests
* Removed unused getUserSyncs;Added mediaTypes.banner.sizes support;Raised test coverage to 85%
* lint formatting errors corrected
* Update schain path in ORTB path for spotxBidAdapter (#4377)
- Move schain object from request.ext.source.ext.schain to
request.source.ext.schain
* Update Grid Bid Adapter (#4379)
* Added Grid Bid Adapter
* remove priceType from TheMediaGrid Bid Adapter
* Add video support in Grid Bid Adapter
* Added test parameter for video slot
* update Grid Bid Adapter to set size in response bid
* Update Grid Bid Adapter to support identical uids in parameters
* Fix typo in test file for Grid Bid Adapter
* Update The Grid Media Bidder Adapter to send refererInfo.referer as 'u' parameter in ad request
* Hotfix for referrer in Grid Bid Adapter
* Grid Bid Adapter: added wrapperType and wrappweVersion to the ad request
* TripleLift: Sending schain (#4375)
* Add IdentityLink support and fix UnifiedId.
It appears we've been looking for UnifiedId userIds
on the bidderRequest object, when they are found on bidRequests.
This commit fixes that error, and adds support for IdentityLink.
* change maintainer email to group
* TripleLift: Sending schain (#1)
* Sending schain
* null -> undefined
* DistrictmDMX: adding support for schain and remove content type to default to prebid selection (#4366)
* adding DMX
test @97%, two files added one updated
* Update districtm_spec.js
* Update districtmDMX.js
* adding all districtm needed file
* remove legacy file
* remove typo || 0 in the test method
* force default to return a valid width and height
* update unit test code for failing test
* changed class for an object
* remove package-lock.json
* change file name for dmx adapter
* renamed files
* restaure package-lock.json
* update to last package-lock state
* update gdpr user consent
* fix sizes issue
* Documentation updates
Adding the readme.md info
* update file name and update unit testing import file location
* current machine state
* lint correction
* remove variable assigment duplicate
* Support for ID5 + receive meta data (#4352)
* Livewrapped bid and analytics adapter
* Fixed some tests for browser compatibility
* Fixed some tests for browser compatibility
* Changed analytics adapter code name
* Fix double quote in debug message
* modified how gdpr is being passed
* Added support for Publisher Common ID Module
* Corrections for ttr in analytics
* ANalytics updates
* Auction start time stamp changed
* Detect recovered ad blocked requests
Make it possible to pass dynamic parameters to adapter
* Collect info on ad units receiving any valid bid
* Support for ID5
Pass metadata from adapter
* Typo in test + eids on wrong level
* Rubicon Adapter: Always make requests using HTTPS (#4380)
* Add microadBidAdapter
* Remove unnecessary encodeURIComponent from microadBidAdapter
* Submit Advangelists Prebid Adapter
* Submit Advangelists Prebid Adapter 1.1
* Correct procudtion endpoint for prebid
* analytics update with wrapper name
* reverted error merge
* update changed default value of netRevenue to true
* Always make bids requests using https
* rp_secure and imp.secure should always be 1
* 7xbid adapter (#4328)
* 7xbid adapter
* fix error when cli build
* - update 33across adapter cookie sync end point (#4345)
- update unit test for 33across adapter
* Adform adapter: add renderer for outstream bids (#4363)
* Prebid 2.38.0 Release
* Increment pre version
* Adagio: update with external js (#4217)
* Add external loader in AdagioBidAdapter
* Change adagioAnalyticsAdapter to "endpoint" type
* Change _setPredictions for a generic method
* Improve AdagioBidAdapter test coverage
* Add features detection in Adagio adapter
* Fix adagioBidAdapter tests
* Add featuresVersion field to bidRequest
* Refacto adagio.queue
* Expose versions in ADAGIO namespace
* Generate a ADAGIO.pageviewId if missing
* Move ad-server events tracking to adagioBidAdapter
* Store adUnitCodes in ADAGIO namespace
* Update documentation
Better description of test parameters.
* Add internal array to prevent empty pbjs.adUnits
* Be sure to access to window.top - does not work in safe-frame env
* Add PrintNumber feature
* Be sure to compute features on window.top
* Bump versions
* Add Post-Bid support
- ad-server events are listen in current window (instead of window.top)
- a new "outerAdUnitElementId" property is set to ADAGIO.pbjsAdUnits array in case of Post-Bid scenario. This property is the 1st parent element id attribute of the iframe in window.top.
* Set pagetype param as optional
* Add AdThink ad-server support
* Improve internal `pbjsAdUnits.sizes` detection
Use the adUnit `mediaTypes.banner.sizes` property if exists to build the `ADAGIO.pbjsAdUnits.sizes`.
The use of the `sizes` root property is deprecated.
* adagioAnalyticsAdapter: add and improve tests
* adagioBidAdapter: add and improve tests
# Conflicts:
# modules/adagioBidAdapter.js
# test/spec/modules/adagioBidAdapter_spec.js
* adagioBidAdapter: Bump version 1.5
* Adagio: fix import path
* PostBid: insure window.top is accessible for specifics functions
* Consistency: use Prebid.js utils and fix deprecated
* PostBid: do not build a request if in safeframe
* Bump version 2.0.0
* Try to fix tests without UA stubing
* Try to fix adagioAnalytics failling tests on CI
* Consistency: use Prebid loadExternalScript()
* Add "adagio" to Prebid.js adloader vendor whitelist
* Remove proprietary ad-server listeners
* Add RSA validation to adagio external script
* add viewdeosDX whitelabel (#4231)
* add viewdeosDX hitelabel
* Fixed tests and support for sizes
* Fix strings
* Fix strings
* remove only
* Fix tests
* fix codereview
* Fix test + Code review
* code review + tests
* One video display ad (#4344)
* outstream changes
* removing global filtet
* reverting page
* message
* adapter change
* remove space
* testcases
* testpage
* spaces for test page
* renderer exist case
* reverting package-lock.json
* adding schain object
* adding tagid
* syntaxx error fix
* video.html
* space trailing
* space
* tagid
* inventoryId and placement
* rewarded video
* added unit test case
* testing display ad
* adding banner
* validating banner object
* display=1 changes
* checking whether diplsy == 1
* html page change
* reverting video.html
* adding more test cases
* spaces
* md file change
* updated working oneVideoBidAdapter.md file
* Update oneVideoBidAdapter.md
* Update oneVideoBidAdapter.md
* updated the file with both video params and banner
* Update video.html
* fix double-urlecoded referrer (#4386)
* fix double-urlecoded referer (#4388)
* PulsePoint Adapter - update for ttl logic (#4400)
* ET-1691: Pulsepoint Analytics adapter for Prebid. (#1)
* ET-1691: Adding pulsepoint analytics and tests for pulsepoint adapter
* ET-1691: Adding pulsepoint analytics and tests for pulsepoint adapter
* ET-1691: cleanup
* ET-1691: minor
* ET-1691: revert package.json change
* Adding bidRequest to bidFactory.createBid method as per https://github.com/prebid/Prebid.js/issues/509
* ET-1765: Adding support for additional params in PulsePoint adapter (#2)
* ET-1850: Fixing https://github.com/prebid/Prebid.js/issues/866
* Minor fix
* Adding mandatory parameters to Bid
* Using the TTL from the bid.ext
* Minor refactor
* IdentityLink - add logic for sending consent string (#4346)
* Fix adagio analytics adapter circleci (#4409)
* Add microadBidAdapter
* Remove unnecessary encodeURIComponent from microadBidAdapter
* Submit Advangelists Prebid Adapter
* Submit Advangelists Prebid Adapter 1.1
* Correct procudtion endpoint for prebid
* analytics update with wrapper name
* reverted error merge
* update changed default value of netRevenue to true
* update to skip broken circleci tests
* skip all
* Feature/7xbid remove unneeded params (#4402)
* 7xbid adapter
* fix error when cli build
* remove unneeded params
* Empty commit
* Empty commit
* Remove none ssl (#4406)
* adding DMX
test @97%, two files added one updated
* Update districtm_spec.js
* Update districtmDMX.js
* adding all districtm needed file
* remove legacy file
* remove typo || 0 in the test method
* force default to return a valid width and height
* update unit test code for failing test
* changed class for an object
* remove package-lock.json
* change file name for dmx adapter
* renamed files
* restaure package-lock.json
* update to last package-lock state
* update gdpr user consent
* fix sizes issue
* Documentation updates
Adding the readme.md info
* update file name and update unit testing import file location
* current machine state
* lint correction
* remove variable assigment duplicate
* remove none ssl element from all request]
* fixed reference to global object (#4412)
* ucfunnel adapter support supply chain (#4383)
* Add a new ucfunnel Adapter and test page
* Add a new ucfunnel Adapter and test page
* 1. Use prebid lib in the repo to keep updated
2. Replace var with let
3. Put JSON.parse(JSON.stringify()) into try catch block
* utils.getTopWindowLocation is a function
* Change to modules from adapters
* Migrate to module design
* [Dev Fix] Remove width and height which can be got from ad unit id
* Update ucfunnelBidAdapter to fit into new spec
* Correct the endpoint. Fix the error of query string
* Add test case for ucfunnelBidAdapter
* Fix lint error
* Update version number
* Combine all checks on bid request
* Add GDPR support for ucfunnel adapter
* Add in-stream video and native support for ucfunnel adapter
* Remove demo page. Add more test cases.
* Change request method from POST to GET
* Remove unnecessary comment
* Support vastXml and vastUrl for video request
* update TTL to 30 mins
* Avoid using arrow function which is not discuraged in mocha
* ucfunnel tdid support
* ucfunnel adapter support supply chain
* LiveIntent support in RP Adapter and PBS Adapter update to pass segments (#4303)
* Add microadBidAdapter
* Remove unnecessary encodeURIComponent from microadBidAdapter
* Submit Advangelists Prebid Adapter
* Submit Advangelists Prebid Adapter 1.1
* Correct procudtion endpoint for prebid
* analytics update with wrapper name
* reverted error merge
* update changed default value of netRevenue to true
* added semi-colon
* update eid source to use domain
* update video oRTB with liveintent segments
* update pbs adapter with liveintent segments support
* update rp adapter liveintent support for fastlane
* reverted package lock, fix for unintentional update
* added unit tests for fastlane.json and ortb, fix to join segments with commas
* fix obj property path data.tpid
* update remove unnecessary function call
* re-ordering query string params
* Rubicon Adapter: Add multiple sizes to sizeMap (#4407)
* Add Utils to remove item in LocalStorage (#4355)
* Making originalCpm and originalCurrency fields in bid object always available (#4396)
* added support for pubcommon, digitrust, id5id
* added support for IdentityLink
* changed the source for id5
* added unit test cases
* changed source param for identityLink
* moving originalCurrency declaration from currency to bidderFactory
* added a comment
* trying to re-run the CI job
* added unit test case
* trying to re-run the CI job
* Placement and inventory (#4353)
* outstream changes
* removing global filtet
* reverting page
* message
* adapter change
* remove space
* testcases
* testpage
* spaces for test page
* renderer exist case
* reverting package-lock.json
* adding schain object
* adding tagid
* syntaxx error fix
* video.html
* space trailing
* space
* tagid
* inventoryId and placement
* rewarded video
* added unit test case
* inventory_id and placement
* removed unnecessary file
* lint error
* Update oneVideoBidAdapter.js
* lint error fix
* Fixes for Platform One Analytics Adapter (#4359)
* Added Y1 Analytics Adapter
* rename y1AnalyticsAdapter in yieldoneAnalyticsAdapter
* Yieldone Bid Adapter: fixes from lint check
* Yieldone Analytics Adapter: fix endpoint protocol
* Added spec file for yieldone Analytics Adapter
* Add adUnitName to analytics data for Yieldone Analytics Adapter
* Fix yieldone Analytics Adapter to log only id from adUnitPath
* Fix bug with timeout event in Yieldone Analytics Adapter
* Added protocol to url (#4395)
* initial commit
* updated contact and tag details
* changes ti support the renderers
* changes to pass dimId
* fixed names of internal mapping
* added comment
* added gdpr param to request and other fixes
* modified api url
* fix
* fixed the secure api call
* rolled back video event callback till we support it
* updated doc with video details
* added bid won and timeout pixel
* added testcase for bid events
* modified testcase
* fixed the url logged
* tag param values passed ot renderer
* added a conditioal check
* changes to support new param to adserver for purpose of tracking
* passed param to renderer
* missing variable defined
* added protocol to url
* fixed test for protocol
* changed urls to secure only
* Update emoteev endpoints (#4329)
* JustPremium: Update to Prebid 3.0 (#4410)
* Update underdogmedia adapter for pbjs 3.0 (#4390)
* Update underdogmedia adapter for pbjs 3.0
* Ensure request to endpoint is secure
* Update prebid version
* Lint fix
* Update Consumable adapter for Prebid.js 3.0 (#4401)
* Consumable: Clean up tests.
* Consumable: Update use of deprecated function.
* Consumable: Read sizes from mediaTypes.banner.sizes.
* Consumable: Fix lint violation.
* CriteoId User Module (#4287)
* Add CriteoId module
* Update the return type of getId in Criteo Id module
Changes:
- Use of url parsing function from url lib
- Update the return type of getId()
- Update the jsdoc to reflect the real return types
* Fix failing tests for Criteo user module
* Add CriteoIdSystem submodule to .submodule.json.
* 2019/10/18 Create Mobsmart bidder adapter (#4339)
* Adpod deal support (#4389)
* Adpod deal support
* Replacing filterBids with minTier
* fix potential issue
* remove querystringify package (#4422)
* Browsi real time data module (#4114)
* real time data module,
browsi sub module for real time data,
new hook bidsBackCallback,
fix for config unsubscribe
* change timeout&primary ad server only to auctionDelay
update docs
* support multiple providers
* change promise to callbacks
configure submodule on submodules.json
* bug fixes
* use Prebid ajax
* tests fix
* Prebid 2.39.0 Release
* increment pre version
* OpenX Adapter: Prebid 3.0 Compatibility Update (#4413)
* Removed usage of deprecated functions
* Removed beacons
* Banner sizes now reads from bidRequest.mediaTypes.banner.sizes instead of bidRequest.sizes
* Updated tests to reflect changes.
* GumGum: use mediaTypes.banner.sizes (#4416)
* adds digitrust module, mods gdpr from bool to int
* update unit test
* only send gdprconsent if present
* uses mediaTypes before trying bidRequest sizes
* removes use of deprecated method
* RTBhouse Bid Adapter update for 3.0 (#4428)
* add viewable rendering format (#4201)
* Feature/adapter (#4219)
* feat(bidrequest): code for making bidrequest
* feat(bidresponse): format and return the response
* feat(tests): added tests for adapter
* feat(docs): added docs for the adapter
* refactor(url): changed adserver url
* test(user sync): added unit tests for the user syncs
* refactor(endpoint): changed endpoint for prebid
* refactor(endpoint): changed endpoint for prebid
* doc(tagid): mandatory param definition added
* fix(imp id): fix for correct impression id
* fix(width/height): fix for correct width and height sequence
* PulsePoint Bid Adapter: Support for schain (#4433)
* ET-1691: Pulsepoint Analytics adapter for Prebid. (#1)
* ET-1691: Adding pulsepoint analytics and tests for pulsepoint adapter
* ET-1691: Adding pulsepoint analytics and tests for pulsepoint adapter
* ET-1691: cleanup
* ET-1691: minor
* ET-1691: revert package.json change
* Adding bidRequest to bidFactory.createBid method as per https://github.com/prebid/Prebid.js/issues/509
* ET-1765: Adding support for additional params in PulsePoint adapter (#2)
* ET-1850: Fixing https://github.com/prebid/Prebid.js/issues/866
* Minor fix
* Adding mandatory parameters to Bid
* ET-5938 SupplyChain Object Support
* Formatting
* Code review
* Code review
* Fix to currency parsing on response
* Add supply chain support for Teads adapter (#4420)
* Rubicon: support SupplyChain (schain) (#4315)
* Add microadBidAdapter
* Remove unnecessary encodeURIComponent from microadBidAdapter
* Submit Advangelists Prebid Adapter
* Submit Advangelists Prebid Adapter 1.1
* Correct procudtion endpoint for prebid
* analytics update with wrapper name
* reverted error merge
* update changed default value of netRevenue to true
* Starting schain
* More tests for banner schain support
* Video tests
* Encoding tweaks, required fields and comments
* Removed .only() from tests
* Change requests per Bret
* Add 1ad4good bidder (#4081)
* adding bidder code and
A bidder for non-profit free ads.
more info about this bidder project can be found on project site
http://1ad4good.org
* removed unused code
test coverage is improved to >80%
tested for instream video support
* removed some legacy code, unused params
* hardcoding https to endpoint
* Improve Digital adapter fix: don't send sizes for instream video (#4427)
* Bid floor, https, native ad update
* Update the ad server protocol module
* Adding referrer
* Improve Digital support for video
* Improve Digital adapter: video
* adapter version -> 6.0.0
* Improve Digital adapter: don't send sizes for video
* Fix a typo in code comment (#4450)
* Inventory id and schain support for display (#4426)
* supporting schain
* Update coinzillaBidAdapter.js (#4438)
Update sizes const.
* Support schain in ZEDO adapter (#4441)
* changes to pass schain
* PubMatic supporting updated Criteo User Id module (#4431)
* added support for pubcommon, digitrust, id5id
* added support for IdentityLink
* changed the source for id5
* added unit test cases
* changed source param for identityLink
* PubMatic supporting updated Criteo User Id module
* added a comment to re-start CI
* Remove duplicate param to fix unit tests (#4459)
* Brightcom Bid Adapter update for 3.0 (#4343)
* add support for min_height field in pbs native requests (#4434)
* Supporting Alias via Video Requests (#4460)
* New adapter Proxistore (#4365)
* add test adapter and documentation
* integration test with hello_world
* reset package-lock.json
* delete useless conditionnal
* make integrate test work
* revert hello-world
* revert hello_world
* fix descriptor
* change adUnits for integration test
* remove proxistore widget
* uncomment file
* change sizes
* remove useless script tag
* Implementation of setBidderConfig and bidder-specific data (#4334)
* initial implementation of setBidderConfig
* fix ie11 test errors
* Support new setBidderConfig format. Include props from both config and bidderConfig in _getConfig
* Use core-js Set to avoid issues with IE
* Fix tests in IE
* put registerSyncs back on bidderFactory
* run bidder event methods with bidder config enabled
* Prebid 2.40.0 Release
* Increment pre version
* Conversant Bid Adapter checks pubcid directly (#4430)
* Cookie Sync functionality (#4457)
* changing PID param value for testing
* cookie sync integration
* merge from upstream
* Staq Adapter: update with meta envelope (#4372)
* initial dev
* fix staq adapter name
* fix hello world staq call
* get hello world working again
* add user agent collection
* fix some unite tests
* Add STAQ Analytics Adapter doc
* clean up hello world
* fix tests to play nice with browserstack
* fix around issues with browserstack and deep equals of objects
* dump variable env testing since we can't mod user agent stuff in browserstack
* Update STAQ adapter to stop using deprecated utils for referrer
* remove package-lock.json changes via master rebase
* improve call frequency for ref util
* change ajax content type
* adjust ajax request to not expect whitelisting
* remove superflous commented-out code
* update event package to use meta information in envelope rather than per event basis
* fix formatting
* more formatting fixes
* more formatting!
* Rhythmone Adapter - schain support (#4414)
Circle CI failing tests are not related to this PR.
* Media.net Adapter: Support Prebid 3.0 (#4378)
* Media.net Adapter: Support Prebid 3.0
* Media.net Adapter: add tests to increase code coverage
* Vi Adapter: Passes additional param in the bid request (#4134)
* Add focus check
(cherry picked from commit 9d6d6dfb83580d6a5ffed8faa5762db48f8fd44d)
* Pass focus as numeric value
(cherry picked from commit 9fae56a637f87b0d39cc1d24eeb1f9ff9df88f64)
* Add unit test
(cherry picked from commit 946710f2e9960b3839613d4bdf730e57ba38a964)
* Sovrn adapter updates: schain, digitrust, pixel syncing, and 3.0 upgrades (#4385)
* schain and digitrust
* pixel beacons
* unit tests and fixes from testing
* Prebid 3.0 updates
* review fix
* use backwards compatible flatMap impl
* update pixel tests
* unit test fix
* update one more url to ssl
* fixed test
* review updates
* TheMediaGrid Bid Adapter update (#4447)
* Added Grid Bid Adapter
* remove priceType from TheMediaGrid Bid Adapter
* Add video support in Grid Bid Adapter
* Added test parameter for video slot
* update Grid Bid Adapter to set size in response bid
* Update Grid Bid Adapter to support identical uids in parameters
* Fix typo in test file for Grid Bid Adapter
* Update The Grid Media Bidder Adapter to send refererInfo.referer as 'u' parameter in ad request
* Hotfix for referrer in Grid Bid Adapter
* Grid Bid Adapter: added wrapperType and wrappweVersion to the ad request
* TheMediaGrid Bid Adapter: added sync url
* TheMediaGrid Bid Adapter: added GDPR params to sync url
* TheMediaGrid Bid Adapter: added tests for getUserSyncs function
* Conversant Bid Adapter adds support for extended ids (#4462)
* Adkernel 3.0 compatibility (#4477)
* Rubicon Adapter pchain support (#4480)
* rubicon pchain support
* removed describe.only
* Implemented changes required to provide support for video in the IX bidding adapter for Instream and Outstream contexts. (#4424)
* Default size filter & KVP support (#4452)
* adding DMX
test @97%, two files added one updated
* Update districtm_spec.js
* Update districtmDMX.js
* adding all districtm needed file
* remove legacy file
* remove typo || 0 in the test method
* force default to return a valid width and height
* update unit test code for failing test
* changed class for an object
* remove package-lock.json
* change file name for dmx adapter
* renamed files
* restaure package-lock.json
* update to last package-lock state
* update gdpr user consent
* fix sizes issue
* Documentation updates
Adding the readme.md info
* update file name and update unit testing import file location
* current machine state
* lint correction
* remove variable assigment duplicate
* adding logic upto5
* adding support for removing and shuffle sizes
* adding array split test
* re-assign none standard size to the request
* resolve duplicate format inside format array
* update .md and adaptor file for KVP support
* remove array helper includes
* inforce two digit after decimal
* RUn error check nothing on my side but error form another adapter
* add id5id to prebid server bid adapter (#4468)
* Added _pbjsGlobals for tracking renames. Resolves #4254 (#4419)
* Feature/smart video (#4367)
* Adding outstream video support.
* Fixing unit test.
* Adding video instream support.
* Handling video startDelay parameter.
* Improving unit tests.
* Fixing indent.
* Handling the request when videoMediaType context is not supported.
* Changing maintainer mail address.
* Remove video outstream specific code.
* Unit test updated.
* do not select element that gets removed after dfp render (#4423)
* add smms adapter (#4439)
* add smms adapter
* re-run ci, why adigo adapter failed??
* review comments fix, remove deprecated functions, fix unit test
* Prebid 2.41.0 release
* Increment pre version
* adds schain param (#4442)
* Create newborntownWeb adapter (#4455)
* Create newborntownWeb adapter
* only https protocol
* Provide criteoId to server by user.ext.eids (#4478)
* ucfunnel adapter fix error message in debug mode (#4338)
* Add a new ucfunnel Adapter and test page
* Add a new ucfunnel Adapter and test page
* 1. Use prebid lib in the repo to keep updated
2. Replace var with let
3. Put JSON.parse(JSON.stringify()) into try catch block
* utils.getTopWindowLocation is a function
* Change to modules from adapters
* Migrate to module design
* [Dev Fix] Remove width and height which can be got from ad unit id
* Update ucfunnelBidAdapter to fit into new spec
* Correct the endpoint. Fix the error of query string
* Add test case for ucfunnelBidAdapter
* Fix lint error
* Update version number
* Combine all checks on bid request
* Add GDPR support for ucfunnel adapter
* Add in-stream video and native support for ucfunnel adapter
* Remove demo page. Add more test cases.
* Change request method from POST to GET
* Remove unnecessary comment
* Support vastXml and vastUrl for video request
* update TTL to 30 mins
* Avoid using arrow function which is not discuraged in mocha
* ucfunnel tdid support
* ucfunnel fix error message in debug mode
* explicitly check undefined to allow falsey values in getConfig (#4486)
* Conversant Bid Adapter handles vast xml (#4492)
* [feature] Add a config list of submodules that require refreshing the stored ID after each bid request (#4325)
* add a feature to always refresh stored id on each bid request for submodules that require that
* update test comments
* Prebid 2.42.0 Release
* Increment pre version
* Make adhese adapter prebid 3.0 compatible (#4507)
* Added 'adhese' attribute to bid that contains meta data - Jira AD-2642
* added DALE to adhese determination
* extra config option: no format, but use size array as format string
* Read sizes from mediaTypes.banner.sizes + Apply Eslint suggestions
* Use map and join, add originData to response
* properly use originData obj
* Remove duplicated ids
* Update tests
* BugFix: Site id missing (#4467)
* outstream changes
* removing global filtet
* reverting page
* message
* adapter change
* remove space
* testcases
* testpage
* spaces for test page
* renderer exist case
* reverting package-lock.json
* adding schain object
* adding tagid
* syntaxx error fix
* video.html
* space trailing
* space
* tagid
* inventoryId and placement
* rewarded video
* added unit test case
* adding site id
* adding placement and siteis
* site id param test case
* removing deprecated functions
* correcting test cases
* indentation
* test cases fix
* Add missing user object in rtb request object
---
modules/gamoshiBidAdapter.js | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/modules/gamoshiBidAdapter.js b/modules/gamoshiBidAdapter.js
index b18188cf33a8..89ffde51889f 100644
--- a/modules/gamoshiBidAdapter.js
+++ b/modules/gamoshiBidAdapter.js
@@ -72,7 +72,10 @@ export const spec = {
'ua': navigator.userAgent
},
'imp': [],
- 'ext': {}
+ 'ext': {},
+ 'user': {
+ 'ext': {}
+ }
};
const gdprConsent = bidderRequest.gdprConsent;
From 8c4039baf531586b267574e2552b9622804c9362 Mon Sep 17 00:00:00 2001
From: ucfunnel <39581136+ucfunnel@users.noreply.github.com>
Date: Wed, 11 Dec 2019 11:54:54 +0800
Subject: [PATCH 31/41] ucfunnel adapter change cookie sync setting (#4535)
* Add a new ucfunnel Adapter and test page
* Add a new ucfunnel Adapter and test page
* 1. Use prebid lib in the repo to keep updated
2. Replace var with let
3. Put JSON.parse(JSON.stringify()) into try catch block
* utils.getTopWindowLocation is a function
* Change to modules from adapters
* Migrate to module design
* [Dev Fix] Remove width and height which can be got from ad unit id
* Update ucfunnelBidAdapter to fit into new spec
* Correct the endpoint. Fix the error of query string
* Add test case for ucfunnelBidAdapter
* Fix lint error
* Update version number
* Combine all checks on bid request
* Add GDPR support for ucfunnel adapter
* Add in-stream video and native support for ucfunnel adapter
* Remove demo page. Add more test cases.
* Change request method from POST to GET
* Remove unnecessary comment
* Support vastXml and vastUrl for video request
* update TTL to 30 mins
* Avoid using arrow function which is not discuraged in mocha
* ucfunnel tdid support
* ucfunnel fix error message in debug mode
* ucfunnel adapter change cookie sync setting
---
modules/ucfunnelBidAdapter.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules/ucfunnelBidAdapter.js b/modules/ucfunnelBidAdapter.js
index f967f30bd449..993c33534a31 100644
--- a/modules/ucfunnelBidAdapter.js
+++ b/modules/ucfunnelBidAdapter.js
@@ -126,12 +126,12 @@ export const spec = {
if (syncOptions.iframeEnabled) {
return [{
type: 'iframe',
- url: '//cdn.aralego.com/ucfad/cookie/sync.html'
+ url: '//cdn.aralego.net/ucfad/cookie/sync.html'
}];
} else if (syncOptions.pixelEnabled) {
return [{
type: 'image',
- url: '//sync.aralego.com/idSync'
+ url: 'https://sync.aralego.com/idSync'
}];
}
}
From 4de8eb77db455377600c94c659ca0605fc7f29ff Mon Sep 17 00:00:00 2001
From: sumit116
Date: Wed, 11 Dec 2019 20:04:18 +0530
Subject: [PATCH 32/41] E2e mock server (#4456)
* e2e test mock server and midlleware
* mock server request response
* remove unwanted logs and packages
* fix jshint errors
* update folder to /dist
* temporary changes to run only banner test
* remove trailing space
* refactor
* make mock server a child process of test task
---
gulpfile.js | 25 +-
package-lock.json | 469 ++++++++++++------
package.json | 2 +
.../request-response-pairs/banner/index.js | 96 ++++
test/mock-server/index.js | 36 ++
.../request-middlewares/prebid-request.js | 75 +++
test/pages/banner.html | 34 +-
test/spec/e2e/banner/basic_banner_ad.spec.js | 23 +-
wdio.conf.js | 3 +-
9 files changed, 577 insertions(+), 186 deletions(-)
create mode 100644 test/mock-server/expectations/request-response-pairs/banner/index.js
create mode 100644 test/mock-server/index.js
create mode 100644 test/mock-server/request-middlewares/prebid-request.js
diff --git a/gulpfile.js b/gulpfile.js
index 2566b52de596..7c4ca3068866 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -32,6 +32,9 @@ 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 port = 9999;
+const mockServerPort = 4444;
+const host = argv.host ? argv.host : 'localhost';
+const { spawn } = require('child_process');
// these modules must be explicitly listed in --modules to be included in the build, won't be part of "all" modules
var explicitModules = [
@@ -234,12 +237,26 @@ function test(done) {
wdioConf
];
}
+
+ //run mock-server
+ const mockServer = spawn('node', ['./test/mock-server/index.js', '--port='+mockServerPort]);
+ mockServer.stdout.on('data', (data) => {
+ console.log(`stdout: ${data}`);
+ });
+ mockServer.stderr.on('data', (data) => {
+ console.log(`stderr: ${data}`);
+ });
+
execa(wdioCmd, wdioOpts, { stdio: 'inherit' })
.then(stdout => {
+ //kill mock server
+ mockServer.kill('SIGINT');
done();
process.exit(0);
})
.catch(err => {
+ //kill mock server
+ mockServer.kill('SIGINT');
done(new Error(`Tests failed with error: ${err}`));
process.exit(1);
});
@@ -309,6 +326,12 @@ function setupE2e(done) {
done();
}
+gulp.task('updatepath', function(){
+ return gulp.src(['build/dist/*.js'])
+ .pipe(replace('ib.adnxs.com/ut/v3/prebid', host + ':' + mockServerPort + '/'))
+ .pipe(gulp.dest('build/dist'));
+});
+
// support tasks
gulp.task(lint);
gulp.task(watch);
@@ -334,7 +357,7 @@ gulp.task('build-postbid', gulp.series(escapePostbidConfig, buildPostbid));
gulp.task('serve', gulp.series(clean, lint, gulp.parallel('build-bundle-dev', watch, test)));
gulp.task('default', gulp.series(clean, makeWebpackPkg));
-gulp.task('e2e-test', gulp.series(clean, setupE2e, gulp.parallel('build-bundle-prod', watch), test))
+gulp.task('e2e-test', gulp.series(clean, setupE2e, gulp.parallel('build-bundle-prod', watch), 'updatepath', test));
// other tasks
gulp.task(bundleToStdout);
gulp.task('bundle', gulpBundle.bind(null, false)); // used for just concatenating pre-built files with no build step
diff --git a/package-lock.json b/package-lock.json
index c244909d3bd0..2917f038101c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1246,7 +1246,6 @@
"version": "1.3.7",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
"integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
- "dev": true,
"requires": {
"mime-types": "~2.1.24",
"negotiator": "0.6.2"
@@ -1597,8 +1596,7 @@
"array-flatten": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
- "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=",
- "dev": true
+ "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
},
"array-from": {
"version": "2.1.1",
@@ -4174,19 +4172,14 @@
"dev": true
},
"content-disposition": {
- "version": "0.5.3",
- "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz",
- "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==",
- "dev": true,
- "requires": {
- "safe-buffer": "5.1.2"
- }
+ "version": "0.5.2",
+ "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz",
+ "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ="
},
"content-type": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
- "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==",
- "dev": true
+ "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
},
"continuable-cache": {
"version": "0.3.1",
@@ -4206,14 +4199,12 @@
"cookie": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
- "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=",
- "dev": true
+ "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s="
},
"cookie-signature": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
- "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=",
- "dev": true
+ "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
},
"copy-descriptor": {
"version": "0.1.1",
@@ -4551,6 +4542,11 @@
"type-detect": "^4.0.0"
}
},
+ "deep-equal": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz",
+ "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU="
+ },
"deep-is": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",
@@ -4671,8 +4667,7 @@
"depd": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
- "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=",
- "dev": true
+ "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
},
"des.js": {
"version": "1.0.1",
@@ -4687,8 +4682,7 @@
"destroy": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
- "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=",
- "dev": true
+ "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
},
"detab": {
"version": "2.0.2",
@@ -5222,8 +5216,7 @@
"ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
- "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=",
- "dev": true
+ "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
},
"ejs": {
"version": "2.5.9",
@@ -5267,8 +5260,7 @@
"encodeurl": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
- "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=",
- "dev": true
+ "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
},
"end-of-stream": {
"version": "1.4.4",
@@ -5568,8 +5560,7 @@
"escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
- "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=",
- "dev": true
+ "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
},
"escape-string-regexp": {
"version": "1.0.5",
@@ -6058,8 +6049,7 @@
"etag": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
- "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=",
- "dev": true
+ "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
},
"event-emitter": {
"version": "0.3.5",
@@ -6286,123 +6276,142 @@
}
},
"express": {
- "version": "4.17.1",
- "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz",
- "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==",
- "dev": true,
+ "version": "4.15.4",
+ "resolved": "https://registry.npmjs.org/express/-/express-4.15.4.tgz",
+ "integrity": "sha1-Ay4iU0ic+PzgJma+yj0R7XotrtE=",
"requires": {
- "accepts": "~1.3.7",
+ "accepts": "~1.3.3",
"array-flatten": "1.1.1",
- "body-parser": "1.19.0",
- "content-disposition": "0.5.3",
- "content-type": "~1.0.4",
- "cookie": "0.4.0",
+ "content-disposition": "0.5.2",
+ "content-type": "~1.0.2",
+ "cookie": "0.3.1",
"cookie-signature": "1.0.6",
- "debug": "2.6.9",
- "depd": "~1.1.2",
- "encodeurl": "~1.0.2",
+ "debug": "2.6.8",
+ "depd": "~1.1.1",
+ "encodeurl": "~1.0.1",
"escape-html": "~1.0.3",
- "etag": "~1.8.1",
- "finalhandler": "~1.1.2",
- "fresh": "0.5.2",
+ "etag": "~1.8.0",
+ "finalhandler": "~1.0.4",
+ "fresh": "0.5.0",
"merge-descriptors": "1.0.1",
"methods": "~1.1.2",
"on-finished": "~2.3.0",
- "parseurl": "~1.3.3",
+ "parseurl": "~1.3.1",
"path-to-regexp": "0.1.7",
- "proxy-addr": "~2.0.5",
- "qs": "6.7.0",
- "range-parser": "~1.2.1",
- "safe-buffer": "5.1.2",
- "send": "0.17.1",
- "serve-static": "1.14.1",
- "setprototypeof": "1.1.1",
- "statuses": "~1.5.0",
- "type-is": "~1.6.18",
- "utils-merge": "1.0.1",
- "vary": "~1.1.2"
+ "proxy-addr": "~1.1.5",
+ "qs": "6.5.0",
+ "range-parser": "~1.2.0",
+ "send": "0.15.4",
+ "serve-static": "1.12.4",
+ "setprototypeof": "1.0.3",
+ "statuses": "~1.3.1",
+ "type-is": "~1.6.15",
+ "utils-merge": "1.0.0",
+ "vary": "~1.1.1"
},
"dependencies": {
- "cookie": {
- "version": "0.4.0",
- "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz",
- "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==",
- "dev": true
- },
"debug": {
- "version": "2.6.9",
- "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
- "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
- "dev": true,
+ "version": "2.6.8",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz",
+ "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=",
"requires": {
"ms": "2.0.0"
}
},
- "http-errors": {
- "version": "1.7.3",
- "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.3.tgz",
- "integrity": "sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw==",
- "dev": true,
+ "finalhandler": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.0.6.tgz",
+ "integrity": "sha1-AHrqM9Gk0+QgF/YkhIrVjSEvgU8=",
"requires": {
- "depd": "~1.1.2",
- "inherits": "2.0.4",
- "setprototypeof": "1.1.1",
- "statuses": ">= 1.5.0 < 2",
- "toidentifier": "1.0.0"
+ "debug": "2.6.9",
+ "encodeurl": "~1.0.1",
+ "escape-html": "~1.0.3",
+ "on-finished": "~2.3.0",
+ "parseurl": "~1.3.2",
+ "statuses": "~1.3.1",
+ "unpipe": "~1.0.0"
+ },
+ "dependencies": {
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "requires": {
+ "ms": "2.0.0"
+ }
+ }
}
},
+ "fresh": {
+ "version": "0.5.0",
+ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.0.tgz",
+ "integrity": "sha1-9HTKXmqSRtb9jglTz6m5yAWvp44="
+ },
+ "mime": {
+ "version": "1.3.4",
+ "resolved": "https://registry.npmjs.org/mime/-/mime-1.3.4.tgz",
+ "integrity": "sha1-EV+eO2s9rylZmDyzjxSaLUDrXVM="
+ },
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
- "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
- "dev": true
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"path-to-regexp": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
- "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=",
- "dev": true
+ "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
},
"qs": {
- "version": "6.7.0",
- "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
- "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==",
- "dev": true
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.0.tgz",
+ "integrity": "sha512-fjVFjW9yhqMhVGwRExCXLhJKrLlkYSaxNWdyc9rmHlrVZbk35YHH312dFd7191uQeXkI3mKLZTIbSvIeFwFemg=="
},
"send": {
- "version": "0.17.1",
- "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz",
- "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==",
- "dev": true,
+ "version": "0.15.4",
+ "resolved": "https://registry.npmjs.org/send/-/send-0.15.4.tgz",
+ "integrity": "sha1-mF+qPihLAnPHkzZKNcZze9k5Bbk=",
"requires": {
- "debug": "2.6.9",
- "depd": "~1.1.2",
+ "debug": "2.6.8",
+ "depd": "~1.1.1",
"destroy": "~1.0.4",
- "encodeurl": "~1.0.2",
+ "encodeurl": "~1.0.1",
"escape-html": "~1.0.3",
- "etag": "~1.8.1",
- "fresh": "0.5.2",
- "http-errors": "~1.7.2",
- "mime": "1.6.0",
- "ms": "2.1.1",
+ "etag": "~1.8.0",
+ "fresh": "0.5.0",
+ "http-errors": "~1.6.2",
+ "mime": "1.3.4",
+ "ms": "2.0.0",
"on-finished": "~2.3.0",
- "range-parser": "~1.2.1",
- "statuses": "~1.5.0"
- },
- "dependencies": {
- "ms": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
- "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==",
- "dev": true
- }
+ "range-parser": "~1.2.0",
+ "statuses": "~1.3.1"
+ }
+ },
+ "serve-static": {
+ "version": "1.12.4",
+ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.12.4.tgz",
+ "integrity": "sha1-m2qpjutyU8Tu3Ewfb9vKYJkBqWE=",
+ "requires": {
+ "encodeurl": "~1.0.1",
+ "escape-html": "~1.0.3",
+ "parseurl": "~1.3.1",
+ "send": "0.15.4"
}
},
"setprototypeof": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
- "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==",
- "dev": true
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz",
+ "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ="
+ },
+ "statuses": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz",
+ "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4="
+ },
+ "utils-merge": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.0.tgz",
+ "integrity": "sha1-ApT7kiu5N1FTVBxPcJYjHyh8ivg="
}
}
},
@@ -6848,8 +6857,7 @@
"forwarded": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
- "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=",
- "dev": true
+ "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ="
},
"fragment-cache": {
"version": "0.2.1",
@@ -6978,7 +6986,8 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"aproba": {
"version": "1.2.0",
@@ -6999,12 +7008,14 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -7019,17 +7030,20 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"core-util-is": {
"version": "1.0.2",
@@ -7146,7 +7160,8 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"ini": {
"version": "1.3.5",
@@ -7158,6 +7173,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@@ -7172,6 +7188,7 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@@ -7179,12 +7196,14 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@@ -7203,6 +7222,7 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -7283,7 +7303,8 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"object-assign": {
"version": "4.1.1",
@@ -7295,6 +7316,7 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"wrappy": "1"
}
@@ -7380,7 +7402,8 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"safer-buffer": {
"version": "2.1.2",
@@ -7416,6 +7439,7 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@@ -7435,6 +7459,7 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@@ -7478,12 +7503,14 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"yallist": {
"version": "3.0.3",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
}
}
},
@@ -8990,7 +9017,6 @@
"version": "1.6.3",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
"integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=",
- "dev": true,
"requires": {
"depd": "~1.1.2",
"inherits": "2.0.3",
@@ -9001,8 +9027,7 @@
"inherits": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
- "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
- "dev": true
+ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
}
}
},
@@ -9222,10 +9247,9 @@
"dev": true
},
"ipaddr.js": {
- "version": "1.9.0",
- "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.0.tgz",
- "integrity": "sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA==",
- "dev": true
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.4.0.tgz",
+ "integrity": "sha1-KWrKh4qCGBbluF0KKFqZvP9FgvA="
},
"is-absolute": {
"version": "1.0.0",
@@ -11662,8 +11686,7 @@
"media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
- "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=",
- "dev": true
+ "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
},
"mem": {
"version": "1.1.0",
@@ -11817,8 +11840,7 @@
"merge-descriptors": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
- "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=",
- "dev": true
+ "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E="
},
"merge-stream": {
"version": "2.0.0",
@@ -11829,8 +11851,7 @@
"methods": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
- "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=",
- "dev": true
+ "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
},
"micromatch": {
"version": "3.1.10",
@@ -12198,8 +12219,7 @@
"negotiator": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
- "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==",
- "dev": true
+ "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
},
"neo-async": {
"version": "2.6.1",
@@ -12610,7 +12630,6 @@
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
"integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
- "dev": true,
"requires": {
"ee-first": "1.1.1"
}
@@ -12987,8 +13006,7 @@
"parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
- "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
- "dev": true
+ "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
},
"pascalcase": {
"version": "0.1.1",
@@ -13299,13 +13317,12 @@
"dev": true
},
"proxy-addr": {
- "version": "2.0.5",
- "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.5.tgz",
- "integrity": "sha512-t/7RxHXPH6cJtP0pRG6smSr9QJidhB+3kXu0KgXnbGYMgzEnUxRQ4/LDdfOwZEMyIh3/xHb8PX3t+lfL9z+YVQ==",
- "dev": true,
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-1.1.5.tgz",
+ "integrity": "sha1-ccDuOxAt4/IC87ZPYI0XP8uhqRg=",
"requires": {
- "forwarded": "~0.1.2",
- "ipaddr.js": "1.9.0"
+ "forwarded": "~0.1.0",
+ "ipaddr.js": "1.4.0"
}
},
"prr": {
@@ -13475,8 +13492,7 @@
"range-parser": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
- "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
- "dev": true
+ "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="
},
"raw-body": {
"version": "1.1.7",
@@ -14421,8 +14437,7 @@
"setprototypeof": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz",
- "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==",
- "dev": true
+ "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ=="
},
"sha.js": {
"version": "2.4.11",
@@ -14942,8 +14957,7 @@
"statuses": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
- "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=",
- "dev": true
+ "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
},
"stealthy-require": {
"version": "1.1.1",
@@ -15711,7 +15725,6 @@
"version": "1.6.18",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
- "dev": true,
"requires": {
"media-typer": "0.3.0",
"mime-types": "~2.1.24"
@@ -15999,8 +16012,7 @@
"unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
- "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=",
- "dev": true
+ "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
},
"unset-value": {
"version": "1.0.0",
@@ -16209,8 +16221,7 @@
"vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
- "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=",
- "dev": true
+ "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
},
"verror": {
"version": "1.10.0",
@@ -16907,12 +16918,156 @@
"integrity": "sha512-gac8OEcQ2Li1dxIEWGZzsp2BitJxwkwcOm0zHAJLcPJaVvm58FRnk6RkuLRpU1EujipU2ZFODv2P9DLMfnV8mw==",
"dev": true
},
+ "content-disposition": {
+ "version": "0.5.3",
+ "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz",
+ "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "5.1.2"
+ }
+ },
+ "cookie": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz",
+ "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==",
+ "dev": true
+ },
+ "debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
"ejs": {
"version": "2.7.4",
"resolved": "https://registry.npmjs.org/ejs/-/ejs-2.7.4.tgz",
"integrity": "sha512-7vmuyh5+kuUyJKePhQfRQBhXV5Ce+RnaeeQArKu1EAMpL3WbgMt5WG6uQZpEVvYSSsxMXRKOewtDk9RaTKXRlA==",
"dev": true
},
+ "express": {
+ "version": "4.17.1",
+ "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz",
+ "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==",
+ "dev": true,
+ "requires": {
+ "accepts": "~1.3.7",
+ "array-flatten": "1.1.1",
+ "body-parser": "1.19.0",
+ "content-disposition": "0.5.3",
+ "content-type": "~1.0.4",
+ "cookie": "0.4.0",
+ "cookie-signature": "1.0.6",
+ "debug": "2.6.9",
+ "depd": "~1.1.2",
+ "encodeurl": "~1.0.2",
+ "escape-html": "~1.0.3",
+ "etag": "~1.8.1",
+ "finalhandler": "~1.1.2",
+ "fresh": "0.5.2",
+ "merge-descriptors": "1.0.1",
+ "methods": "~1.1.2",
+ "on-finished": "~2.3.0",
+ "parseurl": "~1.3.3",
+ "path-to-regexp": "0.1.7",
+ "proxy-addr": "~2.0.5",
+ "qs": "6.7.0",
+ "range-parser": "~1.2.1",
+ "safe-buffer": "5.1.2",
+ "send": "0.17.1",
+ "serve-static": "1.14.1",
+ "setprototypeof": "1.1.1",
+ "statuses": "~1.5.0",
+ "type-is": "~1.6.18",
+ "utils-merge": "1.0.1",
+ "vary": "~1.1.2"
+ }
+ },
+ "http-errors": {
+ "version": "1.7.3",
+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.3.tgz",
+ "integrity": "sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw==",
+ "dev": true,
+ "requires": {
+ "depd": "~1.1.2",
+ "inherits": "2.0.4",
+ "setprototypeof": "1.1.1",
+ "statuses": ">= 1.5.0 < 2",
+ "toidentifier": "1.0.0"
+ }
+ },
+ "ipaddr.js": {
+ "version": "1.9.0",
+ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.0.tgz",
+ "integrity": "sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA==",
+ "dev": true
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
+ "dev": true
+ },
+ "path-to-regexp": {
+ "version": "0.1.7",
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
+ "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=",
+ "dev": true
+ },
+ "proxy-addr": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.5.tgz",
+ "integrity": "sha512-t/7RxHXPH6cJtP0pRG6smSr9QJidhB+3kXu0KgXnbGYMgzEnUxRQ4/LDdfOwZEMyIh3/xHb8PX3t+lfL9z+YVQ==",
+ "dev": true,
+ "requires": {
+ "forwarded": "~0.1.2",
+ "ipaddr.js": "1.9.0"
+ }
+ },
+ "qs": {
+ "version": "6.7.0",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
+ "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==",
+ "dev": true
+ },
+ "send": {
+ "version": "0.17.1",
+ "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz",
+ "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==",
+ "dev": true,
+ "requires": {
+ "debug": "2.6.9",
+ "depd": "~1.1.2",
+ "destroy": "~1.0.4",
+ "encodeurl": "~1.0.2",
+ "escape-html": "~1.0.3",
+ "etag": "~1.8.1",
+ "fresh": "0.5.2",
+ "http-errors": "~1.7.2",
+ "mime": "1.6.0",
+ "ms": "2.1.1",
+ "on-finished": "~2.3.0",
+ "range-parser": "~1.2.1",
+ "statuses": "~1.5.0"
+ },
+ "dependencies": {
+ "ms": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
+ "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==",
+ "dev": true
+ }
+ }
+ },
+ "setprototypeof": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
+ "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==",
+ "dev": true
+ },
"ws": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz",
diff --git a/package.json b/package.json
index b25a94f7b6b2..c24cfcd6dc8e 100755
--- a/package.json
+++ b/package.json
@@ -97,8 +97,10 @@
"babel-plugin-transform-object-assign": "^6.22.0",
"core-js": "^2.4.1",
"crypto-js": "^3.1.9-1",
+ "deep-equal": "^1.0.1",
"dlv": "1.1.3",
"dset": "2.0.1",
+ "express": "^4.15.4",
"fun-hooks": "^0.9.5",
"jsencrypt": "^3.0.0-rc.1",
"just-clone": "^1.0.2"
diff --git a/test/mock-server/expectations/request-response-pairs/banner/index.js b/test/mock-server/expectations/request-response-pairs/banner/index.js
new file mode 100644
index 000000000000..17538c8b33d3
--- /dev/null
+++ b/test/mock-server/expectations/request-response-pairs/banner/index.js
@@ -0,0 +1,96 @@
+var app = require('../../../index');
+
+/**
+ * This file will have the fixtures for request and response. Each one has to export two functions getRequest and getResponse.
+ * expectation directory will hold all the request reponse pairs of different types. middlewares added to the server will parse
+ * these files and return the response when expecation is met
+ *
+ * The expecation created here is replicating trafficSourceCode example in Prebid.
+ */
+
+/**
+ * This function will return the request object with all the entities method, path, body, header etc.
+ *
+ * @return {object} Request object
+ */
+exports.getRequest = function() {
+ return {
+ 'httpRequest': {
+ 'method': 'POST',
+ 'path': '/',
+ 'body': {
+ 'tags': [{
+ 'sizes': [{
+ 'width': 300,
+ 'height': 250
+ }, {
+ 'width': 300,
+ 'height': 600
+ }],
+ 'primary_size': {
+ 'width': 300,
+ 'height': 250
+ },
+ 'ad_types': ['banner'],
+ 'id': 13144370,
+ 'allow_smaller_sizes': false,
+ 'use_pmt_rule': false,
+ 'prebid': true,
+ 'disable_psa': true
+ }],
+ 'user': {}
+ }
+ }
+ }
+}
+
+/**
+ * This function will return the response object with all the entities method, path, body, header etc.
+ *
+ * @return {object} Response object
+ */
+exports.getResponse = function() {
+ return {
+ 'httpResponse': {
+ 'body': {
+ 'version': '3.0.0',
+ 'tags': [{
+ 'uuid': '2c8c83a1deaf1a',
+ 'tag_id': 13144370,
+ 'auction_id': '8147841645883553832',
+ 'nobid': false,
+ 'no_ad_url': 'http://sin3-ib.adnxs.com/it?an_audit=0&referrer=http%3A%2F%2Ftest.localhost%3A9999%2FintegrationExamples%2Fgpt%2Fhello_world.html%3Fpbjs_debug%3Dtrue&e=wqT_3QKzCKAzBAAAAwDWAAUBCJKPpe4FEKjwl-js2byJcRiq5MnUovf28WEqNgkAAAkCABEJBywAABkAAACA61HgPyEREgApEQkAMREb8GkwsqKiBjjtSEDtSEgAUABYnPFbYABotc95eACAAQGKAQCSAQNVU0SYAawCoAH6AagBAbABALgBAcABAMgBAtABANgBAOABAPABAIoCO3VmKCdhJywgMjUyOTg4NSwgMTU3MzQ3MjE0Nik7AR0scicsIDk2ODQ2MDM1Nh4A8PWSAqUCIXp6ZmhVQWl1c0s0S0VOT0JseTRZQUNDYzhWc3dBRGdBUUFSSTdVaFFzcUtpQmxnQVlJSUNhQUJ3Q0hncWdBRWtpQUVxa0FFQW1BRUFvQUVCcUFFRHNBRUF1UUVwaTRpREFBRGdQOEVCS1l1SWd3QUE0RF9KQVozRkl5WjA1Tm9fMlFFQUFBQUFBQUR3UC1BQkFQVUJBQUFBQUpnQ0FLQUNBTFVDQUFBQUFMMENBQUFBQU9BQ0FPZ0NBUGdDQUlBREFaZ0RBYWdEcnJDdUNyb0RDVk5KVGpNNk5EY3pOZUFEcUJXSUJBQ1FCQUNZQkFIQkIFRQkBCHlRUQkJAQEUTmdFQVBFEY0BkEg0QkFDSUJmOGuaAokBIUl3OTBCOikBJG5QRmJJQVFvQUQROFhEZ1B6b0pVMGxPTXpvME56TTFRS2dWUxFoDFBBX1URDAxBQUFXHQwAWR0MAGEdDABjHQzwQGVBQS7CAi9odHRwOi8vcHJlYmlkLm9yZy9kZXYtZG9jcy9nZXR0aW5nLXN0YXJ0ZWQuaHRtbNgCAOACrZhI6gJTDTrYdGVzdC5sb2NhbGhvc3Q6OTk5OS9pbnRlZ3JhdGlvbkV4YW1wbGVzL2dwdC9oZWxsb193b3JsZAVO8EA_cGJqc19kZWJ1Zz10cnVlgAMAiAMBkAMAmAMXoAMBqgMAwAOsAsgDANgDAOADAOgDAPgDAYAEAJIEDS91dC92Mw248F6YBACiBAsxMC43NS43NC42OagEkECyBBIIBBAEGKwCIPoBKAEoAjAAOAK4BADABADIBADSBA45MzI1I1NJTjM6NDczNdoEAggA4AQB8ATTgZcuiAUBmAUAoAX______wEDFAHABQDJBWmAFPA_0gUJCQkMcAAA2AUB4AUB8AUB-gUECAAQAJAGAJgGALgGAMEGCSM08L_IBgDQBvUv2gYWChAJFBkBUBAAGADgBgHyBgIIAIAHAYgHAKAHAQ..&s=68cfb6ed042ea47f5d3fc2c32cc068500e542066',
+ 'timeout_ms': 0,
+ 'ad_profile_id': 1182765,
+ 'rtb_video_fallback': false,
+ 'ads': [{
+ 'content_source': 'rtb',
+ 'ad_type': 'banner',
+ 'buyer_member_id': 9325,
+ 'advertiser_id': 2529885,
+ 'creative_id': 96846035,
+ 'media_type_id': 1,
+ 'media_subtype_id': 1,
+ 'cpm': 0.500000,
+ 'cpm_publisher_currency': 0.500000,
+ 'is_bin_price_applied': false,
+ 'publisher_currency_code': '$',
+ 'brand_category_id': 0,
+ 'client_initiated_ad_counting': true,
+ 'rtb': {
+ 'banner': {
+ 'content': "",
+ 'width': 300,
+ 'height': 250
+ },
+ 'trackers': [{
+ 'impression_urls': ['http://sin3-ib.adnxs.com/it?an_audit=0&referrer=http%3A%2F%2Ftest.localhost%3A9999%2FintegrationExamples%2Fgpt%2Fhello_world.html%3Fpbjs_debug%3Dtrue&e=wqT_3QK7CKA7BAAAAwDWAAUBCJKPpe4FEKjwl-js2byJcRiq5MnUovf28WEqNgkAAAECCOA_EQEHNAAA4D8ZAAAAgOtR4D8hERIAKREJADERG6gwsqKiBjjtSEDtSEgCUNOBly5YnPFbYABotc95eJK4BYABAYoBA1VTRJIBAQbwUpgBrAKgAfoBqAEBsAEAuAEBwAEEyAEC0AEA2AEA4AEA8AEAigI7dWYoJ2EnLCAyNTI5ODg1LCAxNTczNDcyMTQ2KTt1ZigncicsIDk2ODQ2MDM1Nh4A8PWSAqUCIXp6ZmhVQWl1c0s0S0VOT0JseTRZQUNDYzhWc3dBRGdBUUFSSTdVaFFzcUtpQmxnQVlJSUNhQUJ3Q0hncWdBRWtpQUVxa0FFQW1BRUFvQUVCcUFFRHNBRUF1UUVwaTRpREFBRGdQOEVCS1l1SWd3QUE0RF9KQVozRkl5WjA1Tm9fMlFFQUFBQUFBQUR3UC1BQkFQVUJBQUFBQUpnQ0FLQUNBTFVDQUFBQUFMMENBQUFBQU9BQ0FPZ0NBUGdDQUlBREFaZ0RBYWdEcnJDdUNyb0RDVk5KVGpNNk5EY3pOZUFEcUJXSUJBQ1FCQUNZQkFIQkIFRQkBCHlRUQkJAQEUTmdFQVBFEY0BkEg0QkFDSUJmOGuaAokBIUl3OTBCOikBJG5QRmJJQVFvQUQROFhEZ1B6b0pVMGxPTXpvME56TTFRS2dWUxFoDFBBX1URDAxBQUFXHQwAWR0MAGEdDABjHQzwQGVBQS7CAi9odHRwOi8vcHJlYmlkLm9yZy9kZXYtZG9jcy9nZXR0aW5nLXN0YXJ0ZWQuaHRtbNgCAOACrZhI6gJTDTrYdGVzdC5sb2NhbGhvc3Q6OTk5OS9pbnRlZ3JhdGlvbkV4YW1wbGVzL2dwdC9oZWxsb193b3JsZAVO8EA_cGJqc19kZWJ1Zz10cnVlgAMAiAMBkAMAmAMXoAMBqgMAwAOsAsgDANgDAOADAOgDAPgDAYAEAJIEDS91dC92Mw248F6YBACiBAsxMC43NS43NC42OagEkECyBBIIBBAEGKwCIPoBKAEoAjAAOAK4BADABADIBADSBA45MzI1I1NJTjM6NDczNdoEAggB4AQB8ATTgZcuiAUBmAUAoAX______wEDFAHABQDJBWmIFPA_0gUJCQkMcAAA2AUB4AUB8AUB-gUECAAQAJAGAJgGALgGAMEGCSM08D_IBgDQBvUv2gYWChAJFBkBUBAAGADgBgHyBgIIAIAHAYgHAKAHAQ..&s=951a029669a69e3f0c527c937c2d852be92802e1'],
+ 'video_events': {}
+ }]
+ }
+ }]
+ }]
+ },
+ }
+ }
+}
diff --git a/test/mock-server/index.js b/test/mock-server/index.js
new file mode 100644
index 000000000000..30ead952fcc6
--- /dev/null
+++ b/test/mock-server/index.js
@@ -0,0 +1,36 @@
+const express = require('express');
+const argv = require('yargs').argv;
+const app = module.exports = express();
+const port = (argv.port) ? argv.port : 3000;
+const bodyParser = require('body-parser');
+const renderCreative = require('./request-middlewares/prebid-request.js');
+
+app.use(express.static(__dirname + '/content'));
+app.use(bodyParser.text({type: 'text/plain'}));
+
+app.locals = {
+ 'port': port,
+ 'host': 'localhost'
+};
+
+// get type will be used to test prebid jsonp requests
+app.get('/', renderCreative, (request, response) => {
+ response.send();
+});
+
+// prebid make POST type request to ut endpoint so here we will match ut endpoint request.
+app.post('/', renderCreative, (request, response) => {
+ response.send();
+});
+
+app.listen(port, (err) => {
+ if (err) {
+ return console.log('something bad happened', err);
+ }
+
+ console.log(`server is listening on ${port}`);
+});
+
+process.on('SIGTERM', function() { console.log('halt mock-server'); process.exit(0) });
+
+process.on('SIGINT', function() { console.log('shutdown mock-server'); process.exit(0) });
diff --git a/test/mock-server/request-middlewares/prebid-request.js b/test/mock-server/request-middlewares/prebid-request.js
new file mode 100644
index 000000000000..6e2d03487cf2
--- /dev/null
+++ b/test/mock-server/request-middlewares/prebid-request.js
@@ -0,0 +1,75 @@
+/**
+ * This middleware will be used to find matching request hitting the ut endpoint by prebid.
+ * As of now it only uses the request payload to compare with httpRequest.body defined in expectations dir.
+ * Matching headers or cookies can also be the use case.
+ */
+
+const glob = require('glob');
+const path = require('path');
+const deepEqual = require('deep-equal');
+
+module.exports = function (req, res, next) {
+ let reqBody;
+ try {
+ if (req.method === 'GET') {
+ reqBody = JSON.parse(req.query.q);
+ } else {
+ reqBody = JSON.parse(req.body);
+ }
+ } catch (e) {
+ // error
+ }
+
+ // prebid uses uuid to match request response pairs.
+ // On each request new uuid is generated, so here i am grabbing the uuid from incoming request and adding it to matched response.
+ let uuidObj = {};
+ if (reqBody && reqBody.uuid) {
+ uuidObj.response = reqBody.uuid;
+ delete reqBody.uuid;
+ }
+
+ if (reqBody && reqBody.tags) {
+ uuidObj.tags = reqBody.tags.map((tag) => {
+ let uuid = tag.uuid;
+ delete tag.uuid;
+ return uuid;
+ });
+ }
+
+ // values within these request props are dynamically generated and aren't
+ // vital to check in these tests, so they are deleted rather than updating
+ // the request-response pairs continuously
+ ['sdk', 'referrer_detection'].forEach(prop => {
+ if (reqBody && reqBody[prop]) {
+ delete reqBody[prop];
+ }
+ });
+
+ // Parse all the expectation to find response for this request
+ glob.sync('./test/mock-server/expectations/**/*.js').some((file) => {
+ file = require(path.resolve(file));
+ let expectedReqBody = JSON.parse(JSON.stringify(file.getRequest().httpRequest.body));
+ // respond to all requests
+ // TODO send a 404 if resource not found
+ res.set({
+ 'Access-Control-Allow-Credentials': 'true',
+ 'Access-Control-Allow-Origin': req.headers.origin
+ });
+
+ // As of now only body is compared. We can also add other request properties like headers, cookies if required
+ if (deepEqual(reqBody, expectedReqBody)) {
+ let response = file.getResponse().httpResponse.body;
+ if (Object.keys(uuidObj).length > 0) {
+ response.tags.forEach((tag, index) => {
+ tag.uuid = uuidObj.tags[index];
+ });
+ }
+ res.type('json');
+ response = JSON.stringify(response);
+ res.write(response);
+ return true;
+ }
+ });
+
+ next();
+};
diff --git a/test/pages/banner.html b/test/pages/banner.html
index 05085089f72a..e1859abdd85c 100644
--- a/test/pages/banner.html
+++ b/test/pages/banner.html
@@ -30,22 +30,24 @@
placementId: 13144370
}
}]
- }, {
- code: 'div-gpt-ad-1460505748561-1',
- mediaTypes: {
- banner: {
- sizes: [[300, 250], [300, 600]],
- }
- },
- bids: [{
- bidder: "rubicon",
- params: {
- accountId: 14062,
- siteId: 70608,
- zoneId: 498816
- }
- }]
- }];
+ }
+ //, {
+ // code: 'div-gpt-ad-1460505748561-1',
+ // mediaTypes: {
+ // banner: {
+ // sizes: [[300, 250], [300, 600]],
+ // }
+ // },
+ // bids: [{
+ // bidder: "appnexus",
+ // params: {
+ // accountId: 14062,
+ // siteId: 70608,
+ // zoneId: 498816
+ // }
+ // }]
+ // }
+ ];
' : '';
- const nativeContainer = format === 'native' ? '' : '';
- return `
- ${nativeStyle}
-
-
-
-
- ${nativeContainer}
-
-
-`;
-};
-
-/**
- * Get the current window location URL correctly encoded for use in a URL query string.
- * @returns {String} URI-encoded URL
- */
-const getTopWindowUrlEncoded = () => encodeURIComponent(getTopWindowUrl());
-
-/**
- * Convert each bid request to a single URL to fetch those bids.
- * @param {Array} bids - list of bids
- * @param {String} bids[].placementCode - Prebid placement identifier
- * @param {Object} bids[].params
- * @param {String} bids[].params.placementId - Audience Network placement identifier
- * @param {String} bids[].params.platform - Audience Network platform identifier (optional)
- * @param {String} bids[].params.format - Optional format, one of 'video' or 'native' if set
- * @param {Array} bids[].sizes - list of desired advert sizes
- * @param {Array} bids[].sizes[] - Size arrays [h,w]: should include one of [300, 250], [320, 50]
- * @returns {Array