From 665f3567d9776b0e7686e0580027ad672901d8df Mon Sep 17 00:00:00 2001 From: Jeremy Sadwith Date: Mon, 16 Oct 2023 23:00:15 -0400 Subject: [PATCH] Kargo Bid Adapter: Updates to GPID retrieval (#10618) * 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 --------- Co-authored-by: Julian Gan Co-authored-by: Neil Flynn --- modules/kargoBidAdapter.js | 27 ++--------------------- test/spec/modules/kargoBidAdapter_spec.js | 13 ++++++----- 2 files changed, 9 insertions(+), 31 deletions(-) diff --git a/modules/kargoBidAdapter.js b/modules/kargoBidAdapter.js index 01470354755..02e64e42f00 100644 --- a/modules/kargoBidAdapter.js +++ b/modules/kargoBidAdapter.js @@ -469,8 +469,8 @@ function getImpression(bid) { imp.bidderWinCount = bid.bidderWinsCount; } - const gpid = getGPID(bid) - if (gpid != null && gpid != '') { + const gpid = deepAccess(bid, 'ortb2Imp.ext.gpid') || deepAccess(bid, 'ortb2Imp.ext.data.pbadslot'); + if (gpid) { imp.fpd = { gpid: gpid } @@ -493,29 +493,6 @@ function getImpression(bid) { return imp } -function getGPID(bid) { - if (bid.ortb2Imp != null) { - if (bid.ortb2Imp.gpid != null && bid.ortb2Imp.gpid != '') { - return bid.ortb2Imp.gpid; - } - - if (bid.ortb2Imp.ext != null && bid.ortb2Imp.ext.data != null) { - if (bid.ortb2Imp.ext.data.pbAdSlot != null && bid.ortb2Imp.ext.data.pbAdSlot != '') { - return bid.ortb2Imp.ext.data.pbAdSlot; - } - - if (bid.ortb2Imp.ext.data.adServer != null && bid.ortb2Imp.ext.data.adServer.adSlot != null && bid.ortb2Imp.ext.data.adServer.adSlot != '') { - return bid.ortb2Imp.ext.data.adServer.adSlot; - } - } - } - - if (bid.adUnitCode != null && bid.adUnitCode != '') { - return bid.adUnitCode; - } - return ''; -} - export const spec = { gvlid: BIDDER.GVLID, code: BIDDER.CODE, diff --git a/test/spec/modules/kargoBidAdapter_spec.js b/test/spec/modules/kargoBidAdapter_spec.js index f7010c1886f..7a9d89eb3a1 100644 --- a/test/spec/modules/kargoBidAdapter_spec.js +++ b/test/spec/modules/kargoBidAdapter_spec.js @@ -155,9 +155,9 @@ describe('kargo adapter tests', function () { data: { adServer: { name: 'gam', - adSlot: '/22558409563,18834096/dfy_mobile_adhesion' + adslot: '/22558409563,18834096/dfy_mobile_adhesion' }, - pbAdSlot: '/22558409563,18834096/dfy_mobile_adhesion' + pbadslot: '/22558409563,18834096/dfy_mobile_adhesion' }, gpid: '/22558409563,18834096/dfy_mobile_adhesion' } @@ -184,9 +184,9 @@ describe('kargo adapter tests', function () { data: { adServer: { name: 'gam', - adSlot: '/22558409563,18834096/dfy_mobile_adhesion' + adslot: '/22558409563,18834096/dfy_mobile_adhesion' }, - pbAdSlot: '/22558409563,18834096/dfy_mobile_adhesion' + pbadslot: '/22558409563,18834096/dfy_mobile_adhesion' } } } @@ -209,9 +209,10 @@ describe('kargo adapter tests', function () { data: { adServer: { name: 'gam', - adSlot: '/22558409563,18834096/dfy_mobile_adhesion' + adslot: '/22558409563,18834096/dfy_mobile_adhesion' } - } + }, + gpid: '/22558409563,18834096/dfy_mobile_adhesion' } } }