Skip to content

Commit

Permalink
Onetag Bid Adapter: add support for FPD (ortb2 field) (prebid#10329)
Browse files Browse the repository at this point in the history
* Onetag Bid Adapter: add support for FPD (ortb2 field)

* Onetag Bid Adapter: add support for FPD (ortb2 field)

---------

Co-authored-by: federico <f.liccione@onetag.com>
  • Loading branch information
2 people authored and Santiago Carabone committed Aug 22, 2023
1 parent 078aa5c commit c4f4402
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/onetagBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ function buildRequests(validBidRequests, bidderRequest) {
if (bidderRequest && bidderRequest.uspConsent) {
payload.usPrivacy = bidderRequest.uspConsent;
}
if (bidderRequest && bidderRequest.ortb2) {
payload.ortb2 = bidderRequest.ortb2;
}
if (validBidRequests && validBidRequests.length !== 0 && validBidRequests[0].userIdAsEids) {
payload.userId = validBidRequests[0].userIdAsEids;
}
Expand Down
69 changes: 69 additions & 0 deletions test/spec/modules/onetagBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,75 @@ describe('onetag', function () {
expect(payload.usPrivacy).to.exist;
expect(payload.usPrivacy).to.exist.and.to.equal(consentString);
});
it('Should send FPD (ortb2 field)', function () {
const firtPartyData = {
// this is where the contextual data is placed
site: {
name: 'example',
domain: 'page.example.com',
// OpenRTB 2.5 spec / Content Taxonomy
cat: ['IAB2'],
sectioncat: ['IAB2-2'],
pagecat: ['IAB2-2'],
page: 'https://page.example.com/here.html',
ref: 'https://ref.example.com',
keywords: 'power tools, drills',
search: 'drill',
content: {
userrating: '4',
data: [{
name: 'www.dataprovider1.com', // who resolved the segments
ext: {
segtax: 7, // taxonomy used to encode the segments
cids: ['iris_c73g5jq96mwso4d8']
},
// the bare minimum are the IDs. These IDs are the ones from the new IAB Content Taxonomy v3
segment: [ { id: '687' }, { id: '123' } ]
}]
},
ext: {
data: { // fields that aren't part of openrtb 2.6
pageType: 'article',
category: 'repair'
}
}
},
// this is where the user data is placed
user: {
keywords: 'a,b',
data: [{
name: 'dataprovider.com',
ext: {
segtax: 4
},
segment: [{
id: '1'
}]
}],
ext: {
data: {
registered: true,
interests: ['cars']
}
}
},
regs: {
gpp: 'abc1234',
gpp_sid: [7]
}
};
let bidderRequest = {
'bidderCode': 'onetag',
'auctionId': '1d1a030790a475',
'bidderRequestId': '22edbae2733bf6',
'timeout': 3000,
'ortb2': firtPartyData
}
let serverRequest = spec.buildRequests([bannerBid], bidderRequest);
const payload = JSON.parse(serverRequest.data);
expect(payload.ortb2).to.exist;
expect(payload.ortb2).to.exist.and.to.deep.equal(firtPartyData);
});
});
describe('interpretResponse', function () {
const request = getBannerVideoRequest();
Expand Down

0 comments on commit c4f4402

Please sign in to comment.