Skip to content

Commit

Permalink
Merge pull request #62 from sovrn/EX-4755-pass-transaction-ids-for-pr…
Browse files Browse the repository at this point in the history
…ebid

EX-4755 Pass transaction ids for prebid
  • Loading branch information
bharris-sovrn authored Jun 27, 2023
2 parents 40f7375 + b071081 commit f282cf2
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 f282cf2

Please sign in to comment.