Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PBS Bid Adapter: allow setting site params #4973

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
8d635ff
Add microadBidAdapter
Feb 15, 2019
3055b90
Remove unnecessary encodeURIComponent from microadBidAdapter
Feb 26, 2019
67fb91b
Submit Advangelists Prebid Adapter
Feb 26, 2019
3ebb916
Submit Advangelists Prebid Adapter 1.1
Feb 27, 2019
4f5c451
Correct procudtion endpoint for prebid
Feb 28, 2019
2dc6d1d
Merge branch 'microad-bid-adapter' of git://github.com/strong-zero/Pr…
Feb 28, 2019
fa3e081
Merge remote-tracking branch 'origin/master' into master-rubicon-clean
Mar 18, 2019
600a46e
Merge branch 'master' of https://github.com/prebid/Prebid.js into mas…
Mar 18, 2019
7f578b3
Merge branch 'master' of https://github.com/prebid/Prebid.js
Mar 23, 2019
176a312
Merge branch 'master' of https://github.com/prebid/Prebid.js
Mar 26, 2019
9abf89c
Merge branch 'master' of https://github.com/prebid/Prebid.js
May 13, 2019
6ce04ab
Merge remote-tracking branch 'upstream/master'
Jun 10, 2019
415e2f6
Merge branch 'master' of https://github.com/prebid/Prebid.js into mas…
Jun 27, 2019
61fb82c
Merge branch 'master' of https://github.com/prebid/Prebid.js into mas…
Jul 11, 2019
3cc4c67
analytics update with wrapper name
Jul 11, 2019
cd81e02
Merge branch 'master' of https://github.com/prebid/Prebid.js into mas…
Jul 15, 2019
e2b4e04
Merge branch 'master' of https://github.com/prebid/Prebid.js into mas…
Jul 15, 2019
53b5970
Merge branch 'master' of https://github.com/prebid/Prebid.js into mas…
Jul 15, 2019
5c00ed5
Merge branch 'master' of https://github.com/prebid/Prebid.js into mas…
Jul 16, 2019
28848ad
reverted error merge
Jul 16, 2019
ab635ee
Merge branch 'master' of https://github.com/prebid/Prebid.js into mas…
Jul 19, 2019
93308f5
Merge branch 'master' of https://github.com/prebid/Prebid.js into mas…
Jul 24, 2019
1cfd52d
Merge branch 'master' of https://github.com/prebid/Prebid.js
Jul 25, 2019
d619807
Merge branch 'master' of https://github.com/prebid/Prebid.js
Jul 27, 2019
9893f0f
Merge branch 'master' of https://github.com/prebid/Prebid.js
Aug 7, 2019
986a251
Merge remote-tracking branch 'upstream/master'
Aug 23, 2019
2cae7c0
Merge branch 'master' of https://github.com/prebid/Prebid.js into ori…
Aug 27, 2019
d7fd252
Merge branch 'master' of https://github.com/prebid/Prebid.js
Sep 4, 2019
c7c01ba
Merge branch 'master' of https://github.com/prebid/Prebid.js
Sep 10, 2019
24a28aa
Merge branch 'master' of https://github.com/prebid/Prebid.js
Sep 10, 2019
7a1a4ec
Merge branch 'master' of https://github.com/rubicon-project/Prebid.js
Sep 25, 2019
4173d16
Merge branch 'master' of https://github.com/prebid/Prebid.js
Sep 25, 2019
ca13952
update changed default value of netRevenue to true
Sep 27, 2019
0b6cd48
Merge branch 'master' of https://github.com/prebid/Prebid.js
Oct 3, 2019
5f0110d
Merge branch 'master' of https://github.com/prebid/Prebid.js
Oct 3, 2019
f930a34
Merge remote-tracking branch 'upstream/master'
Oct 8, 2019
9bff282
Merge branch 'master' of https://github.com/prebid/Prebid.js
Oct 14, 2019
712ec9e
Merge branch 'master' of https://github.com/prebid/Prebid.js
Oct 29, 2019
f192f65
Merge branch 'master' of https://github.com/prebid/Prebid.js
Oct 29, 2019
006f53c
Merge branch 'master' of https://github.com/prebid/Prebid.js
Oct 29, 2019
0341150
Merge branch 'master' of https://github.com/prebid/Prebid.js
Oct 31, 2019
fa59897
Merge branch 'master' of https://github.com/prebid/Prebid.js
Nov 15, 2019
dcff2cf
Merge branch 'master' of https://github.com/prebid/Prebid.js
Nov 20, 2019
0222ce2
Merge branch 'master' of https://github.com/prebid/Prebid.js
Nov 24, 2019
227beca
Merge branch 'master' of https://github.com/prebid/Prebid.js
Nov 25, 2019
dc3ee49
Merge branch 'master' of https://github.com/rubicon-project/Prebid.js
Dec 4, 2019
9a5a08d
Merge branch 'master' of https://github.com/prebid/Prebid.js
Dec 4, 2019
35ea5d4
Merge branch 'master' of https://github.com/prebid/Prebid.js
Dec 6, 2019
f89b71c
Merge branch 'master' of https://github.com/prebid/Prebid.js
Dec 17, 2019
4e1679b
Re-add rubicon analytics without deprecated getTopWindowUrl util
Dec 17, 2019
fd80acd
Cache referrer on auction_init instead of bid_requested
Dec 17, 2019
2ab26a3
Merge pull request #51 from rubicon-project/rubicon-analytics-3.0
msm0504 Dec 17, 2019
7de7ca6
Merge branch 'master' of https://github.com/rubicon-project/Prebid.js
Jan 9, 2020
5f1fe06
Merge branch 'master' of https://github.com/prebid/Prebid.js
Jan 9, 2020
60b5ad8
Merge branch 'master' of https://github.com/prebid/Prebid.js
Jan 17, 2020
5f44edd
Merge branch 'master' of https://github.com/rubicon-project/Prebid.js
Feb 10, 2020
4809354
Merge branch 'master' of https://github.com/prebid/Prebid.js
Feb 10, 2020
8d8bdff
Merge branch 'master' of https://github.com/prebid/Prebid.js
Feb 13, 2020
a1a2318
Merge branch 'master' of https://github.com/prebid/Prebid.js
Feb 19, 2020
ac2ac12
Merge branch 'master' of https://github.com/prebid/Prebid.js
Feb 24, 2020
5ce8787
Merge branch 'master' of https://github.com/rubicon-project/Prebid.js
Mar 12, 2020
6c2bdec
Merge branch 'master' of https://github.com/prebid/Prebid.js
Mar 12, 2020
b432c60
add site config value to oRTB request
Mar 13, 2020
bc46220
Merge branch 'master' of https://github.com/prebid/Prebid.js into pbs…
Jun 3, 2020
44640e3
update to copy site.page and site.publisher.id if not defined in conf…
Jun 4, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions modules/prebidServerBidAdapter/index.js
Expand Up @@ -269,11 +269,17 @@ function _appendSiteAppDevice(request, pageUrl) {
request.app.publisher = {id: _s2sConfig.accountId}
} else {
request.site = {};
if (typeof config.getConfig('site') === 'object') {
if (utils.isPlainObject(config.getConfig('site'))) {
request.site = config.getConfig('site');
}
utils.deepSetValue(request.site, 'publisher.id', _s2sConfig.accountId);
request.site.page = pageUrl;
// set publisher.id if not already defined
if (!utils.deepAccess(request.site, 'publisher.id')) {
utils.deepSetValue(request.site, 'publisher.id', _s2sConfig.accountId);
}
// set site.page if not already defined
if (!request.site.page) {
request.site.page = pageUrl;
}
}
if (typeof config.getConfig('device') === 'object') {
request.device = config.getConfig('device');
Expand Down
55 changes: 54 additions & 1 deletion test/spec/modules/prebidServerBidAdapter_spec.js
Expand Up @@ -922,7 +922,7 @@ describe('S2S Adapter', function () {
expect(requestBid.site.content.language).to.exist.and.to.be.a('string');
expect(requestBid.site).to.deep.equal({
publisher: {
id: '1',
id: '1234',
domain: 'test.com'
},
content: {
Expand Down Expand Up @@ -1090,6 +1090,59 @@ describe('S2S Adapter', function () {
expect(requestBid.imp[0].ext.appnexus.key).to.be.equal('value')
});

describe('config site value is added to the oRTB request', function () {
const s2sConfig = Object.assign({}, CONFIG, {
endpoint: 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction',
adapterOptions: {
appnexus: {
key: 'value'
}
}
});
const device = {
ua: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36',
ip: '75.97.0.47'
};

it('and overrides publisher and page', function () {
config.setConfig({
s2sConfig: s2sConfig,
site: {
domain: 'nytimes.com',
page: 'http://www.nytimes.com',
publisher: { id: '2' }
},
device: device
});
adapter.callBids(REQUEST, BID_REQUESTS, addBidResponse, done, ajax);
const requestBid = JSON.parse(server.requests[0].requestBody);

expect(requestBid.site).to.exist.and.to.be.a('object');
expect(requestBid.site.domain).to.equal('nytimes.com');
expect(requestBid.site.page).to.equal('http://www.nytimes.com');
expect(requestBid.site.publisher).to.exist.and.to.be.a('object');
expect(requestBid.site.publisher.id).to.equal('2');
});

it('and merges domain and page with the config site value', function () {
config.setConfig({
s2sConfig: s2sConfig,
site: {
foo: 'bar'
},
device: device
});
adapter.callBids(REQUEST, BID_REQUESTS, addBidResponse, done, ajax);

const requestBid = JSON.parse(server.requests[0].requestBody);
expect(requestBid.site).to.exist.and.to.be.a('object');
expect(requestBid.site.foo).to.equal('bar');
expect(requestBid.site.page).to.equal('http://mytestpage.com');
expect(requestBid.site.publisher).to.exist.and.to.be.a('object');
expect(requestBid.site.publisher.id).to.equal('1');
});
});

it('when userId is defined on bids, it\'s properties should be copied to user.ext.tpid properties', function () {
let ortb2Config = utils.deepClone(CONFIG);
ortb2Config.endpoint = 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction';
Expand Down