Skip to content

Commit

Permalink
Sovrn Bid Adapter: add transaction id support (prebid#10156)
Browse files Browse the repository at this point in the history
* EX-4755 Add: forwarding of auction id and transaction id as transaction ids for source and impression objects in the request

* EX-4755 Change: source of impression level tid for forwarding

* EX-4755 Change: source of auction level tid for forwarding

* EX-4755 Refactor: unit test description
  • Loading branch information
dmitrybor authored Jun 28, 2023
1 parent dd34342 commit ac1e62e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/sovrnBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ export const spec = {
};
}

const tid = deepAccess(bidderRequest, 'ortb2.source.tid')
if (tid) {
deepSetValue(sovrnBidReq, 'source.tid', tid)
}

if (bidderRequest.gdprConsent) {
deepSetValue(sovrnBidReq, 'regs.ext.gdpr', +bidderRequest.gdprConsent.gdprApplies);
deepSetValue(sovrnBidReq, 'user.ext.consent', bidderRequest.gdprConsent.consentString)
Expand Down
34 changes: 34 additions & 0 deletions test/spec/modules/sovrnBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,40 @@ describe('sovrnBidAdapter', function() {
expect(payload.tmax).to.equal(3000)
})

it('forwards auction level tid', function() {
const bidderRequest = {
...baseBidderRequest,
ortb2: {
source: {
tid: '1d1a030790a475'
}
},
bids: [baseBidRequest]
}

const payload = JSON.parse(spec.buildRequests([baseBidRequest], bidderRequest).data)
expect(payload.source?.tid).to.equal('1d1a030790a475')
})

it('forwards impression level tid', function() {
const bidRequest = {
...baseBidRequest,
ortb2Imp: {
ext: {
tid: '1a2c032473f4983'
}
},
}

const bidderRequest = {
...baseBidderRequest,
bids: [bidRequest]
}

const payload = JSON.parse(spec.buildRequests([bidRequest], bidderRequest).data)
expect(payload.imp[0]?.ext?.tid).to.equal('1a2c032473f4983')
})

it('includes the ad unit code in the request', function() {
const impression = payload.imp[0]
expect(impression.adunitcode).to.equal('adunit-code')
Expand Down

0 comments on commit ac1e62e

Please sign in to comment.