Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PBS adapter: set source.tid to auction ID #9073

Merged
merged 1 commit into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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