Skip to content

Commit

Permalink
PBS adapter: set source.tid to auction ID (#9073)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgirardi committed Oct 5, 2022
1 parent 5d09d25 commit 7186178
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion modules/prebidServerBidAdapter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ Object.assign(ORTB2.prototype, {
}
const request = {
id: firstBidRequest.auctionId,
source: {tid: s2sBidRequest.tid},
source: {tid: firstBidRequest.auctionId},
tmax: s2sConfig.timeout,
imp: imps,
// to do: add setconfig option to pass test = 1
Expand Down
6 changes: 2 additions & 4 deletions src/adapterManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,6 @@ adapterManager.callBids = (adUnits, bidRequests, addBidResponse, doneCb, request

let counter = 0;

// $.source.tid MUST be a unique UUID and also THE SAME between all PBS Requests for a given Auction
const sourceTid = generateUUID();
_s2sConfigs.forEach((s2sConfig) => {
if (s2sConfig && uniqueServerBidRequests[counter] && getS2SBidderSet(s2sConfig).has(uniqueServerBidRequests[counter].bidderCode)) {
// s2s should get the same client side timeout as other client side requests.
Expand All @@ -374,7 +372,7 @@ adapterManager.callBids = (adUnits, bidRequests, addBidResponse, doneCb, request
let uniqueServerRequests = serverBidRequests.filter(serverBidRequest => serverBidRequest.uniquePbsTid === uniquePbsTid);

if (s2sAdapter) {
let s2sBidRequest = {tid: sourceTid, 'ad_units': adUnitsS2SCopy, s2sConfig, ortb2Fragments};
let s2sBidRequest = {'ad_units': adUnitsS2SCopy, s2sConfig, ortb2Fragments};
if (s2sBidRequest.ad_units.length) {
let doneCbs = uniqueServerRequests.map(bidRequest => {
bidRequest.start = timestamp();
Expand All @@ -387,7 +385,7 @@ adapterManager.callBids = (adUnits, bidRequests, addBidResponse, doneCb, request
// fire BID_REQUESTED event for each s2s bidRequest
uniqueServerRequests.forEach(bidRequest => {
// add the new sourceTid
events.emit(CONSTANTS.EVENTS.BID_REQUESTED, {...bidRequest, tid: sourceTid});
events.emit(CONSTANTS.EVENTS.BID_REQUESTED, {...bidRequest, tid: bidRequest.auctionId});
});

// make bid requests
Expand Down
7 changes: 3 additions & 4 deletions test/spec/modules/prebidServerBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,15 +607,14 @@ describe('S2S Adapter', function () {
resetSyncedStatus();
});

it('should set id to auction ID and source.tid to tid', function () {
it('should set id and source.tid to auction ID', function () {
config.setConfig({ s2sConfig: CONFIG });

adapter.callBids(OUTSTREAM_VIDEO_REQUEST, BID_REQUESTS, addBidResponse, done, ajax);

const requestBid = JSON.parse(server.requests[0].requestBody);
expect(requestBid.id).to.equal('173afb6d132ba3');
expect(requestBid.source).to.be.an('object');
expect(requestBid.source.tid).to.equal('437fbbf5-33f5-487a-8e16-a7112903cfe5');
expect(requestBid.id).to.equal(BID_REQUESTS[0].auctionId);
expect(requestBid.source.tid).to.equal(BID_REQUESTS[0].auctionId);
});

it('should block request if config did not define p1Consent URL in endpoint object config', function () {
Expand Down

0 comments on commit 7186178

Please sign in to comment.