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 / Rubicon Project Bid Adapter: update to pass PBJS version in request #6767

Merged
merged 1 commit into from
May 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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