Skip to content

Commit 95fd392

Browse files
committed
Core & multiple modules: populate ortb2.source.tid
1 parent 3f51102 commit 95fd392

File tree

8 files changed

+14
-19
lines changed

8 files changed

+14
-19
lines changed

libraries/ortbConverter/processors/default.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {deepSetValue, mergeDeep} from '../../../src/utils.js';
1+
import {generateUUID, mergeDeep} from '../../../src/utils.js';
22
import {bannerResponseProcessor, fillBannerImp} from './banner.js';
33
import {fillVideoImp, fillVideoResponse} from './video.js';
44
import {setResponseMediaType} from './mediaType.js';
@@ -21,17 +21,16 @@ export const DEFAULT_PROCESSORS = {
2121
fn: clientSectionChecker('ORTB request')
2222
},
2323
props: {
24-
// sets request properties id, tmax, test, source.tid
24+
// sets request properties id, tmax, test
2525
fn(ortbRequest, bidderRequest) {
2626
Object.assign(ortbRequest, {
27-
id: ortbRequest.id || bidderRequest.auctionId,
27+
id: ortbRequest.id || generateUUID(),
2828
test: ortbRequest.test || 0
2929
});
3030
const timeout = parseInt(bidderRequest.timeout, 10);
3131
if (!isNaN(timeout)) {
3232
ortbRequest.tmax = timeout;
3333
}
34-
deepSetValue(ortbRequest, 'source.tid', ortbRequest.source?.tid || bidderRequest.auctionId);
3534
}
3635
}
3736
},

modules/prebidServerBidAdapter/ortbConverter.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ const PBS_CONVERTER = ortbConverter({
5151
const request = buildRequest(imps, proxyBidderRequest, context);
5252

5353
request.tmax = s2sBidRequest.s2sConfig.timeout;
54-
deepSetValue(request, 'source.tid', proxyBidderRequest.auctionId);
5554

5655
[request.app, request.dooh, request.site].forEach(section => {
5756
if (section && !section.publisher?.id) {

src/adapterManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ adapterManager.makeBidRequests = hook('sync', function (adUnits, auctionStart, a
252252
const bidderOrtb2 = ortb2Fragments.bidder || {};
253253

254254
function addOrtb2(bidderRequest) {
255-
const fpd = Object.freeze(mergeDeep({}, ortb2, bidderOrtb2[bidderRequest.bidderCode]));
255+
const fpd = Object.freeze(mergeDeep({source: {tid: auctionId}}, ortb2, bidderOrtb2[bidderRequest.bidderCode]));
256256
bidderRequest.ortb2 = fpd;
257257
bidderRequest.bids.forEach((bid) => bid.ortb2 = fpd);
258258
return bidderRequest;

test/spec/modules/ivsBidAdapter_spec.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,7 @@ describe('ivsBidAdapter', function () {
112112
it('should contain the required parameters', function () {
113113
const bidRequest = spec.buildRequests(validBidRequests, validBidderRequest);
114114
const bidderRequest = bidRequest.data;
115-
assert.equal(bidderRequest.id, validBidderRequest.auctionId);
116115
assert.ok(bidderRequest.site);
117-
assert.ok(bidderRequest.source);
118116
assert.lengthOf(bidderRequest.imp, 1);
119117
});
120118
});

test/spec/modules/nexx360BidAdapter_spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,6 @@ describe('Nexx360 bid adapter tests', function () {
354354
const request = spec.buildRequests(displayBids, bidderRequest);
355355
const requestContent = request.data;
356356
expect(request).to.have.property('method').and.to.equal('POST');
357-
expect(requestContent.id).to.be.eql('2e684815-b44e-4e04-b812-56da54adbe74');
358357
expect(requestContent.cur[0]).to.be.eql('USD');
359358
expect(requestContent.imp.length).to.be.eql(2);
360359
expect(requestContent.imp[0].id).to.be.eql('44a2706ac3574');

test/spec/modules/prebidServerBidAdapter_spec.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -636,15 +636,12 @@ describe('S2S Adapter', function () {
636636
resetSyncedStatus();
637637
});
638638

639-
it('should set id and source.tid to auction ID', function () {
639+
it('should pick source.tid from FPD', () => {
640640
config.setConfig({ s2sConfig: CONFIG });
641-
642-
adapter.callBids(OUTSTREAM_VIDEO_REQUEST, BID_REQUESTS, addBidResponse, done, ajax);
643-
644-
const requestBid = JSON.parse(server.requests[0].requestBody);
645-
expect(requestBid.id).to.equal(BID_REQUESTS[0].auctionId);
646-
expect(requestBid.source.tid).to.equal(BID_REQUESTS[0].auctionId);
647-
});
641+
adapter.callBids({...REQUEST, ortb2Fragments: {global: {source: {tid: 'mock-tid'}}}}, BID_REQUESTS, addBidResponse, done, ajax);
642+
const req = JSON.parse(server.requests[0].requestBody)
643+
expect(req.source.tid).to.eql('mock-tid');
644+
})
648645

649646
it('should set tmax to s2sConfig.timeout', () => {
650647
const cfg = {...CONFIG, timeout: 123};

test/spec/modules/scatteredBidAdapter_spec.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@ describe('Scattered adapter', function () {
9797
it('has the right fields filled', function () {
9898
let request = spec.buildRequests(arrayOfValidBidRequests, validBidderRequest);
9999
const bidderRequest = request.data;
100-
assert.equal(bidderRequest.id, validBidderRequest.auctionId);
101100
assert.ok(bidderRequest.site);
102-
assert.ok(bidderRequest.source);
103101
assert.lengthOf(bidderRequest.imp, 1);
104102
});
105103

test/spec/unit/core/adapterManager_spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,6 +1762,11 @@ describe('adapterManager tests', function () {
17621762
requests.appnexus.bids.forEach((bid) => expect(bid.ortb2).to.eql(requests.appnexus.ortb2));
17631763
});
17641764

1765+
it('should populate ortb2.source.tid with auctionId', () => {
1766+
const reqs = adapterManager.makeBidRequests(adUnits, 0, 'mockAuctionId', 1000, [], {global: {}});
1767+
expect(reqs[0].ortb2.source.tid).to.equal('mockAuctionId');
1768+
})
1769+
17651770
it('should merge in bid-level ortb2Imp with adUnit-level ortb2Imp', () => {
17661771
const adUnit = {
17671772
...adUnits[1],

0 commit comments

Comments
 (0)