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: fix bug where source.tid is not sent even with enableTIDs: true #10454

Merged
merged 1 commit into from
Sep 8, 2023
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
4 changes: 4 additions & 0 deletions modules/prebidServerBidAdapter/ortbConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ const PBS_CONVERTER = ortbConverter({
// FPD is handled different for PBS - the base request will only contain global FPD;
// bidder-specific values are set in ext.prebid.bidderconfig

if (context.transmitTids) {
deepSetValue(ortbRequest, 'source.tid', proxyBidderRequest.auctionId);
}

mergeDeep(ortbRequest, context.s2sBidRequest.ortb2Fragments?.global);

// also merge in s2sConfig.extPrebid
Expand Down
12 changes: 6 additions & 6 deletions test/spec/modules/prebidServerBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -712,8 +712,8 @@ describe('S2S Adapter', function () {
beforeEach(() => {
s2sReq = {
...REQUEST,
ortb2Fragments: {global: {source: {tid: 'mock-tid'}}},
ad_units: REQUEST.ad_units.map(au => ({...au, ortb2Imp: {ext: {tid: 'mock-tid'}}}))
ortb2Fragments: {global: {}},
ad_units: REQUEST.ad_units.map(au => ({...au, ortb2Imp: {ext: {tid: 'mock-tid'}}})),
};
BID_REQUESTS[0].bids[0].ortb2Imp = {ext: {tid: 'mock-tid'}};
});
Expand All @@ -726,15 +726,15 @@ describe('S2S Adapter', function () {
it('should not be set when transmitTid is not allowed, with ext.prebid.createtids: false', () => {
config.setConfig({ s2sConfig: CONFIG, enableTIDs: false });
const req = makeRequest();
expect(req.source.tid).to.not.exist;
expect(req.imp[0].ext.tid).to.not.exist;
expect(req.source?.tid).to.not.exist;
expect(req.imp[0].ext?.tid).to.not.exist;
expect(req.ext.prebid.createtids).to.equal(false);
});

it('should be picked from FPD otherwise', () => {
it('should be set to auction ID otherwise', () => {
config.setConfig({s2sConfig: CONFIG, enableTIDs: true});
const req = makeRequest();
expect(req.source.tid).to.eql('mock-tid');
expect(req.source.tid).to.eql(BID_REQUESTS[0].auctionId);
expect(req.imp[0].ext.tid).to.eql('mock-tid');
})
})
Expand Down