Skip to content

Commit

Permalink
Kargo Bid Adapter: Adds ortb2 and ortb2Imp to request (#11248)
Browse files Browse the repository at this point in the history
* adds full ortb2 and ortb2Imp to request

* fixes tests

---------

Co-authored-by: “Nick <“nick.llerandi”@kargo.com>
  • Loading branch information
nickllerandi and “Nick authored Mar 21, 2024
1 parent 9648399 commit 2fbdf06
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 6 deletions.
16 changes: 12 additions & 4 deletions modules/kargoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,16 @@ function buildRequests(validBidRequests, bidderRequest) {
]
},
imp: impressions,
user: getUserIds(tdidAdapter, bidderRequest.uspConsent, bidderRequest.gdprConsent, firstBidRequest.userIdAsEids, bidderRequest.gppConsent),
user: getUserIds(tdidAdapter, bidderRequest.uspConsent, bidderRequest.gdprConsent, firstBidRequest.userIdAsEids, bidderRequest.gppConsent)
});

if (firstBidRequest.ortb2 != null) {
krakenParams.site = {
cat: firstBidRequest.ortb2.site.cat
// Add full ortb2 object as backup
if (firstBidRequest.ortb2) {
const siteCat = firstBidRequest.ortb2.site?.cat;
if (siteCat != null) {
krakenParams.site = { cat: siteCat };
}
krakenParams.ext = { ortb2: firstBidRequest.ortb2 };
}

// Add schain
Expand Down Expand Up @@ -478,6 +481,11 @@ function getImpression(bid) {
}
}

// Add full ortb2Imp object as backup
if (bid.ortb2Imp) {
imp.ext = { ortb2Imp: bid.ortb2Imp };
}

if (bid.mediaTypes) {
const { banner, video, native } = bid.mediaTypes;

Expand Down
97 changes: 95 additions & 2 deletions test/spec/modules/kargoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,21 @@ describe('kargo adapter tests', function () {
floor: 1,
fpd: {
gpid: '/22558409563,18834096/dfy_mobile_adhesion'
},
ext: {
ortb2Imp: {
ext: {
tid: '10101',
data: {
adServer: {
name: 'gam',
adslot: '/22558409563,18834096/dfy_mobile_adhesion'
},
pbadslot: '/22558409563,18834096/dfy_mobile_adhesion'
},
gpid: '/22558409563,18834096/dfy_mobile_adhesion'
}
}
}
},
{
Expand All @@ -492,7 +507,21 @@ describe('kargo adapter tests', function () {
fpd: {
gpid: '/22558409563,18834096/dfy_mobile_adhesion'
},
floor: 2
floor: 2,
ext: {
ortb2Imp: {
ext: {
tid: '20202',
data: {
adServer: {
name: 'gam',
adslot: '/22558409563,18834096/dfy_mobile_adhesion'
},
pbadslot: '/22558409563,18834096/dfy_mobile_adhesion'
}
}
}
}
},
{
code: '303',
Expand All @@ -505,7 +534,21 @@ describe('kargo adapter tests', function () {
fpd: {
gpid: '/22558409563,18834096/dfy_mobile_adhesion'
},
floor: 3
floor: 3,
ext: {
ortb2Imp: {
ext: {
tid: '30303',
data: {
adServer: {
name: 'gam',
adslot: '/22558409563,18834096/dfy_mobile_adhesion'
}
},
gpid: '/22558409563,18834096/dfy_mobile_adhesion'
}
}
}
}
],
socan: {
Expand Down Expand Up @@ -555,6 +598,56 @@ describe('kargo adapter tests', function () {
]
}
]
},
ext: {
ortb2: {
device: {
sua: {
platform: {
brand: 'macOS',
version: ['12', '6', '0']
},
browsers: [
{
brand: 'Chromium',
version: ['106', '0', '5249', '119']
},
{
brand: 'Google Chrome',
version: ['106', '0', '5249', '119']
},
{
brand: 'Not;A=Brand',
version: ['99', '0', '0', '0']
}
],
mobile: 1,
model: 'model',
source: 1,
}
},
site: {
id: '1234',
name: 'SiteName',
cat: ['IAB1', 'IAB2', 'IAB3']
},
user: {
data: [
{
name: 'prebid.org',
ext: {
segtax: 600,
segclass: 'v1',
},
segment: [
{
id: '133'
},
]
},
]
}
}
}
};

Expand Down

0 comments on commit 2fbdf06

Please sign in to comment.