Skip to content

Commit

Permalink
Update to PBS Bid Adapter and RP Bid Adapter to pass PBJS version in …
Browse files Browse the repository at this point in the history
…auction requests (#6767)
  • Loading branch information
mmoschovas authored May 18, 2021
1 parent c198fa7 commit 0c8a308
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/prebidServerBidAdapter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,9 @@ const OPEN_RTB_PROTOCOL = {
}
};

// Sets pbjs version, can be overwritten below if channel exists in s2sConfig.extPrebid
request.ext.prebid = Object.assign(request.ext.prebid, {channel: {name: 'pbjs', version: $$PREBID_GLOBAL$$.version}})

// s2sConfig video.ext.prebid is passed through openrtb to PBS
if (s2sConfig.extPrebid && typeof s2sConfig.extPrebid === 'object') {
request.ext.prebid = Object.assign(request.ext.prebid, s2sConfig.extPrebid);
Expand Down
4 changes: 4 additions & 0 deletions modules/rubiconBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ export const spec = {
}],
ext: {
prebid: {
channel: {
name: 'pbjs',
version: $$PREBID_GLOBAL$$.version
},
cache: {
vastxml: {
returnCreative: rubiConf.returnVast === true
Expand Down
30 changes: 30 additions & 0 deletions test/spec/modules/prebidServerBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,10 @@ describe('S2S Adapter', function () {
targeting: {
includebidderkeys: false,
includewinners: true
},
channel: {
name: 'pbjs',
version: 'v$prebid.version$'
}
}
});
Expand Down Expand Up @@ -1177,6 +1181,10 @@ describe('S2S Adapter', function () {
targeting: {
includebidderkeys: false,
includewinners: true
},
channel: {
name: 'pbjs',
version: 'v$prebid.version$'
}
}
});
Expand Down Expand Up @@ -1630,6 +1638,28 @@ describe('S2S Adapter', function () {
expect(parsedRequestBody.ext.prebid.multibid).to.deep.equal(expected);
});

it('sets and passes pbjs version in request if channel does not exist in s2sConfig', () => {
const s2sBidRequest = utils.deepClone(REQUEST);
const bidRequests = utils.deepClone(BID_REQUESTS);

adapter.callBids(s2sBidRequest, bidRequests, addBidResponse, done, ajax);

const parsedRequestBody = JSON.parse(server.requests[0].requestBody);
expect(parsedRequestBody.ext.prebid.channel).to.deep.equal({name: 'pbjs', version: 'v$prebid.version$'});
});

it('does not set pbjs version in request if channel does exist in s2sConfig', () => {
const s2sBidRequest = utils.deepClone(REQUEST);
const bidRequests = utils.deepClone(BID_REQUESTS);

utils.deepSetValue(s2sBidRequest, 's2sConfig.extPrebid.channel', {test: 1});

adapter.callBids(s2sBidRequest, bidRequests, addBidResponse, done, ajax);

const parsedRequestBody = JSON.parse(server.requests[0].requestBody);
expect(parsedRequestBody.ext.prebid.channel).to.deep.equal({test: 1});
});

it('passes first party data in request', () => {
const s2sBidRequest = utils.deepClone(REQUEST);
const bidRequests = utils.deepClone(BID_REQUESTS);
Expand Down
2 changes: 2 additions & 0 deletions test/spec/modules/rubiconBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1520,6 +1520,8 @@ describe('the rubicon adapter', function () {
expect(imp.ext.rubicon.video.skip).to.equal(1);
expect(imp.ext.rubicon.video.skipafter).to.equal(15);
expect(imp.ext.prebid.auctiontimestamp).to.equal(1472239426000);
// should contain version
expect(post.ext.prebid.channel).to.deep.equal({name: 'pbjs', version: 'v$prebid.version$'});
expect(post.user.ext.consent).to.equal('BOJ/P2HOJ/P2HABABMAAAAAZ+A==');
// EIDs should exist
expect(post.user.ext).to.have.property('eids').that.is.an('array');
Expand Down

0 comments on commit 0c8a308

Please sign in to comment.