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

Kargo Bid Adapter: Adds ortb2 and ortb2Imp to request #11248

Merged
merged 3 commits into from
Mar 21, 2024
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
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