Skip to content

Commit

Permalink
Fix to merge site fpd into payload as opposed to overwriting (prebid#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoschovas authored and JacobKlein26 committed Feb 8, 2023
1 parent 7ab9bab commit 3c56475
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
7 changes: 4 additions & 3 deletions modules/ttdBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,15 @@ function getUser(bidderRequest) {
}

function getSite(bidderRequest, firstPartyData) {
var site = {
var site = utils.mergeDeep({
page: utils.deepAccess(bidderRequest, 'refererInfo.page'),
ref: utils.deepAccess(bidderRequest, 'refererInfo.ref'),
publisher: {
id: utils.deepAccess(bidderRequest, 'bids.0.params.publisherId'),
},
...firstPartyData.site
};
},
firstPartyData.site
);

var publisherDomain = bidderRequest.refererInfo.domain;
if (publisherDomain) {
Expand Down
13 changes: 13 additions & 0 deletions test/spec/modules/ttdBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,19 @@ describe('ttdBidAdapter', function () {
expect(requestBody.imp[0].banner.expdir).to.equal(expdir);
});

it('merges first party site data', function () {
const ortb2 = {
site: {
publisher: {
domain: 'https://foo.bar',
}
}
};
const requestBody = testBuildRequests(baseBannerBidRequests, {...baseBidderRequest, ortb2}).data;
config.resetConfig();
expect(requestBody.site.publisher).to.deep.equal({domain: 'https://foo.bar', id: '13144370'});
});

it('sets keywords properly if sent', function () {
const ortb2 = {
site: {
Expand Down

0 comments on commit 3c56475

Please sign in to comment.