Skip to content

Commit

Permalink
feat: set request source tid to auctionId [PB-1296] (prebid#9051)
Browse files Browse the repository at this point in the history
Co-authored-by: shahin.rahbariasl <shahin.rahbariasl@indexexchange.com>
  • Loading branch information
2 people authored and JacobKlein26 committed Feb 8, 2023
1 parent 3f8123d commit baad436
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 7 additions & 5 deletions modules/ixBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -602,13 +602,15 @@ function buildRequest(validBidRequests, bidderRequest, impressions, version) {
r.ext.ixdiag.err = cachedErrors;
}

// set source.tid to auctionId for outgoing request to Exchange.
r.source = {
tid: validBidRequests[0].auctionId,
}

// if an schain is provided, send it along
if (validBidRequests[0].schain) {
r.source = {
ext: {
schain: validBidRequests[0].schain
}
};
r.source.ext = {};
r.source.ext.schain = validBidRequests[0].schain;
}

if (userEids.length > 0) {
Expand Down
3 changes: 2 additions & 1 deletion test/spec/modules/ixBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1739,6 +1739,7 @@ describe('IndexexchangeAdapter', function () {
expect(payload.source.ext.schain).to.deep.equal(SAMPLE_SCHAIN);
expect(payload.imp).to.be.an('array');
expect(payload.imp).to.have.lengthOf(1);
expect(payload.source.tid).to.equal(DEFAULT_BANNER_VALID_BID[0].auctionId);
});

it('payload should have correct format and value for r.id when bidderRequestId is a number ', function () {
Expand Down Expand Up @@ -1767,7 +1768,7 @@ describe('IndexexchangeAdapter', function () {

it('payload should not include schain when not provided', function () {
const payload = JSON.parse(queryWithoutSchain.r);
expect(payload.source).to.not.exist; // source object currently only written for schain
expect(payload.source.schain).to.not.exist; // source object currently only written for schain
});

it('impression should have correct format and value', function () {
Expand Down

0 comments on commit baad436

Please sign in to comment.