Skip to content

Commit

Permalink
Kargo Bid Adapter: Updates to GPID retrieval (prebid#10618)
Browse files Browse the repository at this point in the history
* 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  <[email protected]>

* 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 <[email protected]>
Co-authored-by: Neil Flynn <[email protected]>
  • Loading branch information
3 people authored Oct 17, 2023
1 parent 59cbc9c commit 665f356
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 31 deletions.
27 changes: 2 additions & 25 deletions modules/kargoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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,
Expand Down
13 changes: 7 additions & 6 deletions test/spec/modules/kargoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand All @@ -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'
}
}
}
Expand All @@ -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'
}
}
}
Expand Down

0 comments on commit 665f356

Please sign in to comment.