Skip to content

Commit ac1e62e

Browse files
authored
Sovrn Bid Adapter: add transaction id support (prebid#10156)
* 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
1 parent dd34342 commit ac1e62e

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

modules/sovrnBidAdapter.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ export const spec = {
169169
};
170170
}
171171

172+
const tid = deepAccess(bidderRequest, 'ortb2.source.tid')
173+
if (tid) {
174+
deepSetValue(sovrnBidReq, 'source.tid', tid)
175+
}
176+
172177
if (bidderRequest.gdprConsent) {
173178
deepSetValue(sovrnBidReq, 'regs.ext.gdpr', +bidderRequest.gdprConsent.gdprApplies);
174179
deepSetValue(sovrnBidReq, 'user.ext.consent', bidderRequest.gdprConsent.consentString)

test/spec/modules/sovrnBidAdapter_spec.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,40 @@ describe('sovrnBidAdapter', function() {
183183
expect(payload.tmax).to.equal(3000)
184184
})
185185

186+
it('forwards auction level tid', function() {
187+
const bidderRequest = {
188+
...baseBidderRequest,
189+
ortb2: {
190+
source: {
191+
tid: '1d1a030790a475'
192+
}
193+
},
194+
bids: [baseBidRequest]
195+
}
196+
197+
const payload = JSON.parse(spec.buildRequests([baseBidRequest], bidderRequest).data)
198+
expect(payload.source?.tid).to.equal('1d1a030790a475')
199+
})
200+
201+
it('forwards impression level tid', function() {
202+
const bidRequest = {
203+
...baseBidRequest,
204+
ortb2Imp: {
205+
ext: {
206+
tid: '1a2c032473f4983'
207+
}
208+
},
209+
}
210+
211+
const bidderRequest = {
212+
...baseBidderRequest,
213+
bids: [bidRequest]
214+
}
215+
216+
const payload = JSON.parse(spec.buildRequests([bidRequest], bidderRequest).data)
217+
expect(payload.imp[0]?.ext?.tid).to.equal('1a2c032473f4983')
218+
})
219+
186220
it('includes the ad unit code in the request', function() {
187221
const impression = payload.imp[0]
188222
expect(impression.adunitcode).to.equal('adunit-code')

0 commit comments

Comments
 (0)