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

Onetag Bid Adapter: read auctionId/transactionId from related ortb2 fields #10726

Merged
merged 1 commit into from
Nov 14, 2023
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
5 changes: 2 additions & 3 deletions modules/onetagBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,8 @@ function setGeneralInfo(bidRequest) {
this['adUnitCode'] = bidRequest.adUnitCode;
this['bidId'] = bidRequest.bidId;
this['bidderRequestId'] = bidRequest.bidderRequestId;
// TODO: fix auctionId leak: https://github.com/prebid/Prebid.js/issues/9781
this['auctionId'] = bidRequest.auctionId;
this['transactionId'] = bidRequest.ortb2Imp?.ext?.tid;
this['auctionId'] = deepAccess(bidRequest, 'ortb2.source.tid');
this['transactionId'] = deepAccess(bidRequest, 'ortb2Imp.ext.tid');
this['gpid'] = deepAccess(bidRequest, 'ortb2Imp.ext.gpid') || deepAccess(bidRequest, 'ortb2Imp.ext.data.pbadslot');
this['pubId'] = params.pubId;
this['ext'] = params.ext;
Expand Down
20 changes: 17 additions & 3 deletions test/spec/modules/onetagBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ describe('onetag', function () {
'bidId': '30b31c1838de1e',
'bidderRequestId': '22edbae2733bf6',
'auctionId': '1d1a030790a475',
ortb2Imp: {
ext: {
tid: 'qwerty123'
'ortb2Imp': {
'ext': {
'tid': '0000'
}
},
'ortb2': {
'source': {
'tid': '1111'
}
},
'schain': {
Expand Down Expand Up @@ -256,6 +261,15 @@ describe('onetag', function () {
expect(dataObj.bids).to.be.an('array').that.is.empty;
} catch (e) { }
});
it('Should pick each bid\'s auctionId and transactionId from ortb2 related fields', function () {
const serverRequest = spec.buildRequests([bannerBid]);
const payload = JSON.parse(serverRequest.data);

expect(payload).to.exist;
expect(payload.bids).to.exist.and.to.have.length(1);
expect(payload.bids[0].auctionId).to.equal(bannerBid.ortb2.source.tid);
expect(payload.bids[0].transactionId).to.equal(bannerBid.ortb2Imp.ext.tid);
});
it('should send GDPR consent data', function () {
let consentString = 'consentString';
let bidderRequest = {
Expand Down