Skip to content

Commit 5a51011

Browse files
harperesa1omon
authored and
sa1omon
committed
Rubicon Adapter pchain support (prebid#4480)
* rubicon pchain support * removed describe.only
1 parent 35a332e commit 5a51011

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

modules/rubiconBidAdapter.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ export const spec = {
360360
.concat([
361361
'tk_flint',
362362
'x_source.tid',
363+
'x_source.pchain',
363364
'p_screen_res',
364365
'rp_floor',
365366
'rp_secure',
@@ -434,6 +435,7 @@ export const spec = {
434435
'rp_secure': '1',
435436
'tk_flint': `${configIntType || DEFAULT_INTEGRATION}_v$prebid.version$`,
436437
'x_source.tid': bidRequest.transactionId,
438+
'x_source.pchain': params.pchain,
437439
'p_screen_res': _getScreenResolution(),
438440
'kw': Array.isArray(params.keywords) ? params.keywords.join(',') : '',
439441
'tk_user_key': params.userId,

test/spec/modules/rubiconBidAdapter_spec.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ describe('the rubicon adapter', function () {
279279
accountId: '14062',
280280
siteId: '70608',
281281
zoneId: '335918',
282+
pchain: 'GAM:11111-reseller1:22222',
282283
userId: '12346',
283284
keywords: ['a', 'b', 'c'],
284285
inventory: {
@@ -360,7 +361,7 @@ describe('the rubicon adapter', function () {
360361
describe('buildRequests implementation', function () {
361362
describe('for requests', function () {
362363
describe('to fastlane', function () {
363-
it('should make a well-formed request objects', function () {
364+
it('should make a well-formed request object', function () {
364365
sandbox.stub(Math, 'random').callsFake(() => 0.1);
365366
let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
366367
let data = parseQuery(request.data);
@@ -379,6 +380,7 @@ describe('the rubicon adapter', function () {
379380
'rand': '0.1',
380381
'tk_flint': INTEGRATION,
381382
'x_source.tid': 'd45dd707-a418-42ec-b8a7-b70a6c6fab0b',
383+
'x_source.pchain': 'GAM:11111-reseller1:22222',
382384
'p_screen_res': /\d+x\d+/,
383385
'tk_user_key': '12346',
384386
'kw': 'a,b,c',
@@ -460,11 +462,20 @@ describe('the rubicon adapter', function () {
460462
expect(data['p_pos']).to.equal('atf;;btf;;');
461463
});
462464

465+
it('should not send x_source.pchain to AE if params.pchain is not specified', function() {
466+
var noPchainRequest = utils.deepClone(bidderRequest);
467+
delete noPchainRequest.bids[0].params.pchain;
468+
469+
let [request] = spec.buildRequests(noPchainRequest.bids, noPchainRequest);
470+
expect(request.data).to.contain('&site_id=70608&');
471+
expect(request.data).to.not.contain('x_source.pchain');
472+
});
473+
463474
it('ad engine query params should be ordered correctly', function () {
464475
sandbox.stub(Math, 'random').callsFake(() => 0.1);
465476
let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
466477

467-
const referenceOrdering = ['account_id', 'site_id', 'zone_id', 'size_id', 'alt_size_ids', 'p_pos', 'rf', 'p_geo.latitude', 'p_geo.longitude', 'kw', 'tg_v.ucat', 'tg_v.lastsearch', 'tg_v.likes', 'tg_i.rating', 'tg_i.prodtype', 'tk_flint', 'x_source.tid', 'p_screen_res', 'rp_floor', 'rp_secure', 'tk_user_key', 'tg_fl.eid', 'slots', 'rand'];
478+
const referenceOrdering = ['account_id', 'site_id', 'zone_id', 'size_id', 'alt_size_ids', 'p_pos', 'rf', 'p_geo.latitude', 'p_geo.longitude', 'kw', 'tg_v.ucat', 'tg_v.lastsearch', 'tg_v.likes', 'tg_i.rating', 'tg_i.prodtype', 'tk_flint', 'x_source.tid', 'x_source.pchain', 'p_screen_res', 'rp_floor', 'rp_secure', 'tk_user_key', 'tg_fl.eid', 'slots', 'rand'];
468479

469480
request.data.split('&').forEach((item, i) => {
470481
expect(item.split('=')[0]).to.equal(referenceOrdering[i]);

0 commit comments

Comments
 (0)