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: floors and CreativeID update #11153

Merged
merged 39 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
e388cc3
KargoBidAdapter: GPP Support
jsadwith Apr 14, 2023
54587b4
Merge branch 'prebid:master' into master
jsadwith May 10, 2023
b03324a
kargo adapter to forward schain object (#21)
juliangan07 Jul 10, 2023
97840d6
Merge branch 'prebid:master' into master
juliangan07 Jul 10, 2023
a901875
wrap in if statement (#22)
juliangan07 Jul 11, 2023
cf27337
KRKPD-572: Add spec for schain (#23)
juliangan07 Jul 11, 2023
85145c0
Adding site to Kargo adapter.
njflynn Oct 2, 2023
5477a26
KRKPD-619 Updating Site object.
njflynn Oct 4, 2023
1e4221d
KRKPD-619 Adding null check for Site object.
njflynn Oct 4, 2023
2d99f19
Update modules/kargoBidAdapter.js
njflynn Oct 4, 2023
26d0c84
Reducing the size of Site object.
njflynn Oct 4, 2023
8b9f588
Resolving conflicts.
njflynn Oct 4, 2023
203abca
Merge pull request #24 from KargoGlobal/KRKPD-619
njflynn Oct 5, 2023
f661ac3
Merge branch 'master' into master
njflynn Oct 10, 2023
e232543
remove white space that is causing linting error
juliangan07 Oct 10, 2023
5cbd24f
Merge branch 'prebid:master' into master
jsadwith Oct 16, 2023
2c60821
Kargo Bid Adapter: Updates to gpid retrieval
jsadwith Oct 16, 2023
0f2addd
Merge branch 'prebid:master' into master
jsadwith Oct 30, 2023
4e561e7
Support for sending ortb2.user.data
jsadwith Oct 30, 2023
22a44b5
update bid Response to use actual creativeID
sj1815 Feb 26, 2024
b58ae56
update spec
sj1815 Feb 27, 2024
14eec2e
Merge branch 'prebid:master' into master
sj1815 Feb 27, 2024
da8b72e
Merge branch 'master' into KRKPD-928
sj1815 Feb 27, 2024
9f54cf4
fix nomencalature based on Kargo's service
sj1815 Feb 27, 2024
b20c7b3
Prebid.js - Update bid Response to use actual creativeID (#25)
sj1815 Feb 28, 2024
b1b4682
Merge branch 'prebid:master' into master
juliangan07 Feb 28, 2024
eb6747f
utilize floors mod
Mar 6, 2024
dd489a3
fixes tests
Mar 6, 2024
33abc77
mediatype specific floors
Mar 6, 2024
c4825a2
simpler implementation leveraging Prebid's smart rule selection
Mar 6, 2024
4cfad02
Merge branch 'prebid:master' into master
sj1815 Mar 7, 2024
f9f67fc
revert nomenclature change
sj1815 Mar 7, 2024
55f5218
Merge branch 'master' into fix/krkpd-928
sj1815 Mar 7, 2024
917624b
fix
sj1815 Mar 7, 2024
0698fbc
Merge pull request #27 from KargoGlobal/fix/krkpd-928
sj1815 Mar 7, 2024
26cb056
removes comment
Mar 8, 2024
3acaeda
Merge remote-tracking branch 'origin/master' into krkpd-987-utilizeFl…
Mar 8, 2024
2344cab
Merge pull request #26 from KargoGlobal/krkpd-987-utilizeFloorsMod
nickllerandi Mar 8, 2024
e58f4a6
Merge branch 'prebid:master' into master
sj1815 Mar 9, 2024
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
38 changes: 25 additions & 13 deletions modules/kargoBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { _each, isEmpty, buildUrl, deepAccess, pick, triggerPixel } from '../src/utils.js';
import { _each, isEmpty, buildUrl, deepAccess, pick, triggerPixel, logError } from '../src/utils.js';
import { config } from '../src/config.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { getStorageManager } from '../src/storageManager.js';
Expand Down Expand Up @@ -221,7 +221,7 @@ function interpretResponse(response, bidRequest) {
width: adUnit.width,
height: adUnit.height,
ttl: 300,
creativeId: adUnit.id,
creativeId: adUnit.creativeID,
dealId: adUnit.targetingCustom,
netRevenue: true,
currency: adUnit.currency || bidRequest.currency,
Expand Down Expand Up @@ -459,10 +459,6 @@ function getImpression(bid) {
code: bid.adUnitCode
};

if (bid.floorData != null && bid.floorData.floorMin > 0) {
imp.floor = bid.floorData.floorMin;
}

if (bid.bidRequestsCount > 0) {
imp.bidRequestCount = bid.bidRequestsCount;
}
Expand All @@ -482,17 +478,33 @@ function getImpression(bid) {
}
}

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

if (banner) {
imp.banner = banner;
}

if (bid.mediaTypes.video != null) {
imp.video = bid.mediaTypes.video;
if (video) {
imp.video = video;
}

if (bid.mediaTypes.native != null) {
imp.native = bid.mediaTypes.native;
if (native) {
imp.native = native;
}

if (typeof bid.getFloor === 'function') {
let floorInfo;
try {
floorInfo = bid.getFloor({
currency: 'USD',
mediaType: '*',
size: '*'
});
} catch (e) {
logError('Kargo: getFloor threw an error: ', e);
}
imp.floor = typeof floorInfo === 'object' && floorInfo.currency === 'USD' && !isNaN(parseInt(floorInfo.floor)) ? floorInfo.floor : undefined;
}
}

Expand Down
40 changes: 29 additions & 11 deletions test/spec/modules/kargoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,8 @@ describe('kargo adapter tests', function () {
},
fpd: {
gpid: '/22558409563,18834096/dfy_mobile_adhesion'
}
},
floor: 2
},
{
code: '303',
Expand All @@ -503,7 +504,8 @@ describe('kargo adapter tests', function () {
},
fpd: {
gpid: '/22558409563,18834096/dfy_mobile_adhesion'
}
},
floor: 3
}
],
socan: {
Expand Down Expand Up @@ -605,6 +607,16 @@ describe('kargo adapter tests', function () {
payload['gdprConsent'] = gdpr
}

clonedBids.forEach(bid => {
if (bid.mediaTypes.banner) {
bid.getFloor = () => ({ currency: 'USD', floor: 1 });
} else if (bid.mediaTypes.video) {
bid.getFloor = () => ({ currency: 'USD', floor: 2 });
} else if (bid.mediaTypes.native) {
bid.getFloor = () => ({ currency: 'USD', floor: 3 });
}
});

var request = spec.buildRequests(clonedBids, payload);
var krakenParams = request.data;

Expand Down Expand Up @@ -725,7 +737,8 @@ describe('kargo adapter tests', function () {
adm: '<div id="1"></div>',
width: 320,
height: 50,
metadata: {}
metadata: {},
creativeID: 'bar'
},
2: {
id: 'bar',
Expand All @@ -736,14 +749,16 @@ describe('kargo adapter tests', function () {
targetingCustom: 'dmpmptest1234',
metadata: {
landingPageDomain: ['https://foobar.com']
}
},
creativeID: 'foo'
},
3: {
id: 'bar',
cpm: 2.5,
adm: '<div id="2"></div>',
width: 300,
height: 250
height: 250,
creativeID: 'foo'
},
4: {
id: 'bar',
Expand All @@ -753,6 +768,7 @@ describe('kargo adapter tests', function () {
height: 250,
mediaType: 'banner',
metadata: {},
creativeID: 'foo',
currency: 'EUR'
},
5: {
Expand All @@ -763,6 +779,7 @@ describe('kargo adapter tests', function () {
height: 250,
mediaType: 'video',
metadata: {},
creativeID: 'foo',
currency: 'EUR'
},
6: {
Expand All @@ -774,6 +791,7 @@ describe('kargo adapter tests', function () {
height: 250,
mediaType: 'video',
metadata: {},
creativeID: 'foo',
currency: 'EUR'
}
}
Expand Down Expand Up @@ -818,7 +836,7 @@ describe('kargo adapter tests', function () {
width: 320,
height: 50,
ttl: 300,
creativeId: 'foo',
creativeId: 'bar',
dealId: undefined,
netRevenue: true,
currency: 'USD',
Expand All @@ -833,7 +851,7 @@ describe('kargo adapter tests', function () {
width: 300,
height: 250,
ttl: 300,
creativeId: 'bar',
creativeId: 'foo',
dealId: 'dmpmptest1234',
netRevenue: true,
currency: 'USD',
Expand All @@ -850,7 +868,7 @@ describe('kargo adapter tests', function () {
width: 300,
height: 250,
ttl: 300,
creativeId: 'bar',
creativeId: 'foo',
dealId: undefined,
netRevenue: true,
currency: 'USD',
Expand All @@ -865,7 +883,7 @@ describe('kargo adapter tests', function () {
width: 300,
height: 250,
ttl: 300,
creativeId: 'bar',
creativeId: 'foo',
dealId: undefined,
netRevenue: true,
currency: 'EUR',
Expand All @@ -880,7 +898,7 @@ describe('kargo adapter tests', function () {
height: 250,
vastXml: '<VAST></VAST>',
ttl: 300,
creativeId: 'bar',
creativeId: 'foo',
dealId: undefined,
netRevenue: true,
currency: 'EUR',
Expand All @@ -895,7 +913,7 @@ describe('kargo adapter tests', function () {
height: 250,
vastUrl: 'https://foobar.com/vast_adm',
ttl: 300,
creativeId: 'bar',
creativeId: 'foo',
dealId: undefined,
netRevenue: true,
currency: 'EUR',
Expand Down