From a94f7f02c874d6f0df6cd98d5282bb383ab93540 Mon Sep 17 00:00:00 2001 From: Jeremy Sadwith Date: Mon, 30 Oct 2023 12:19:03 -0400 Subject: [PATCH] Kargo Bid Adapter: Support for sending ortb2.user.data (#10659) * KargoBidAdapter: GPP Support * kargo adapter to forward schain object (#21) * wrap in if statement (#22) * KRKPD-572: Add spec for schain (#23) * wrap in if statement * update test for schain, file formatting * Adding site to Kargo adapter. * KRKPD-619 Updating Site object. * KRKPD-619 Adding null check for Site object. * Update modules/kargoBidAdapter.js Co-authored-by: Julian Gan * Reducing the size of Site object. * remove white space that is causing linting error * Kargo Bid Adapter: Updates to gpid retrieval * Support for sending ortb2.user.data --------- Co-authored-by: Julian Gan Co-authored-by: Neil Flynn --- modules/kargoBidAdapter.js | 6 +++++ test/spec/modules/kargoBidAdapter_spec.js | 30 +++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/modules/kargoBidAdapter.js b/modules/kargoBidAdapter.js index 02e64e42f00..9d8c7bc06a1 100644 --- a/modules/kargoBidAdapter.js +++ b/modules/kargoBidAdapter.js @@ -24,6 +24,7 @@ const CURRENCY = Object.freeze({ }); const REQUEST_KEYS = Object.freeze({ + USER_DATA: 'ortb2.user.data', SOCIAL_CANVAS: 'params.socialCanvas', SUA: 'ortb2.device.sua', TDID_ADAPTER: 'userId.tdid', @@ -103,15 +104,20 @@ function buildRequests(validBidRequests, bidderRequest) { } } + // Add schain if (firstBidRequest.schain && firstBidRequest.schain.nodes) { krakenParams.schain = firstBidRequest.schain } + // Add user data object if available + krakenParams.user.data = deepAccess(firstBidRequest, REQUEST_KEYS.USER_DATA) || []; + const reqCount = getRequestCount() if (reqCount != null) { krakenParams.requestCount = reqCount; } + // Add currency if not USD if (currency != null && currency != CURRENCY.US_DOLLAR) { krakenParams.cur = currency; } diff --git a/test/spec/modules/kargoBidAdapter_spec.js b/test/spec/modules/kargoBidAdapter_spec.js index 7a9d89eb3a1..f43c3b11aac 100644 --- a/test/spec/modules/kargoBidAdapter_spec.js +++ b/test/spec/modules/kargoBidAdapter_spec.js @@ -147,6 +147,22 @@ describe('kargo adapter tests', function () { id: '1234', name: 'SiteName', cat: ['IAB1', 'IAB2', 'IAB3'] + }, + user: { + data: [ + { + name: 'prebid.org', + ext: { + segtax: 600, + segclass: 'v1', + }, + segment: [ + { + id: '133' + }, + ] + }, + ] } }, ortb2Imp: { @@ -522,6 +538,20 @@ describe('kargo adapter tests', function () { } ] } + ], + data: [ + { + name: 'prebid.org', + ext: { + segtax: 600, + segclass: 'v1', + }, + segment: [ + { + id: '133' + } + ] + } ] } };