Skip to content

Commit

Permalink
Access x_source.tid from ortb2 object (#9960)
Browse files Browse the repository at this point in the history
* Access x_source.tid from ortb2 object

* Fix lint errors
  • Loading branch information
spotxslagle authored May 16, 2023
1 parent e1e66ef commit 99c9869
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion modules/rubiconBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ export const spec = {
'rp_floor': (params.floor = parseFloat(params.floor)) >= 0.01 ? params.floor : undefined,
'rp_secure': '1',
'tk_flint': `${rubiConf.int_type || DEFAULT_INTEGRATION}_v$prebid.version$`,
'x_source.tid': bidRequest.transactionId,
'x_source.tid': deepAccess(bidderRequest, 'ortb2.source.tid'),
'x_imp.ext.tid': bidRequest.transactionId,
'l_pb_bid_id': bidRequest.bidId,
'p_screen_res': _getScreenResolution(),
Expand Down
18 changes: 15 additions & 3 deletions test/spec/modules/rubiconBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ describe('the rubicon adapter', function () {
bidderCode: 'rubicon',
auctionId: 'c45dd708-a418-42ec-b8a7-b70a6c6fab0a',
bidderRequestId: '178e34bad3658f',
ortb2: {
source: {
tid: 'd45dd707-a418-42ec-b8a7-b70a6c6fab0b'
}
},
bids: [
{
bidder: 'rubicon',
Expand Down Expand Up @@ -354,6 +359,11 @@ describe('the rubicon adapter', function () {
transactionId: 'd45dd707-a418-42ec-b8a7-b70a6c6fab0b'
}
],
ortb2: {
source: {
tid: 'd45dd707-a418-42ec-b8a7-b70a6c6fab0b'
}
},
start: 1472239426002,
auctionStart: 1472239426000,
timeout: 5000
Expand Down Expand Up @@ -627,7 +637,6 @@ describe('the rubicon adapter', function () {
'rand': '0.1',
'tk_flint': INTEGRATION,
'x_source.tid': 'd45dd707-a418-42ec-b8a7-b70a6c6fab0b',
'x_imp.ext.tid': 'd45dd707-a418-42ec-b8a7-b70a6c6fab0b',
'p_screen_res': /\d+x\d+/,
'tk_user_key': '12346',
'kw': 'a,b,c',
Expand Down Expand Up @@ -2284,6 +2293,8 @@ describe('the rubicon adapter', function () {
});

describe('createSlotParams', function () {
const localBidderRequest = Object.assign({}, bidderRequest);
localBidderRequest.ortb2 = {source: {tid: 'faked707-a418-42ec-b8a7-b70a6c6fab0b'}};
it('should return a valid slot params object', function () {
let expectedQuery = {
'account_id': '14062',
Expand All @@ -2294,7 +2305,8 @@ describe('the rubicon adapter', function () {
'p_pos': 'atf',
'rp_secure': /[01]/,
'tk_flint': INTEGRATION,
'x_source.tid': 'd45dd707-a418-42ec-b8a7-b70a6c6fab0b',
'x_source.tid': 'faked707-a418-42ec-b8a7-b70a6c6fab0b',
'x_imp.ext.tid': 'd45dd707-a418-42ec-b8a7-b70a6c6fab0b',
'p_screen_res': /\d+x\d+/,
'tk_user_key': '12346',
'kw': 'a,b,c',
Expand All @@ -2307,7 +2319,7 @@ describe('the rubicon adapter', function () {
'rf': 'localhost'
};

const slotParams = spec.createSlotParams(bidderRequest.bids[0], bidderRequest);
const slotParams = spec.createSlotParams(bidderRequest.bids[0], localBidderRequest);

// test that all values above are both present and correct
Object.keys(expectedQuery).forEach(key => {
Expand Down

0 comments on commit 99c9869

Please sign in to comment.