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

UNICORN Adapter - accept multiple formats #6255

Merged
merged 3 commits into from
Feb 3, 2021
Merged
Changes from 1 commit
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
Next Next commit
enable multiple formats
add version
  • Loading branch information
ctylim committed Feb 2, 2021
commit 74a13dbefac86f7b7e2d456ce80cd43811bb88a1
16 changes: 12 additions & 4 deletions modules/unicornBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const BIDDER_CODE = 'unicorn';
const UNICORN_ENDPOINT = 'https://ds.uncn.jp/pb/0/bid.json';
const UNICORN_DEFAULT_CURRENCY = 'JPY';
const UNICORN_PB_COOKIE_KEY = '__pb_unicorn_aud';
const UNICORN_PB_VERSION = '1.0';

/**
* Placement ID and Account ID are required.
Expand Down Expand Up @@ -47,12 +48,10 @@ function buildOpenRtbBidRequestPayload(validBidRequests, bidderRequest) {
bidderRequest
);
const imp = validBidRequests.map(br => {
const sizes = utils.parseSizesInput(br.sizes)[0];
return {
id: br.bidId,
banner: {
w: sizes.split('x')[0],
h: sizes.split('x')[1]
format: makeFormat(br.sizes)
},
tagid: utils.deepAccess(br, 'params.placementId') || br.adUnitCode,
secure: 1,
Expand Down Expand Up @@ -84,7 +83,8 @@ function buildOpenRtbBidRequestPayload(validBidRequests, bidderRequest) {
source: {
ext: {
stype: 'prebid_uncn',
bidder: BIDDER_CODE
bidder: BIDDER_CODE,
prebid_version: UNICORN_PB_VERSION
}
},
ext: {
Expand Down Expand Up @@ -138,6 +138,14 @@ const getUid = () => {
}
};

/**
* Make imp.banner.format
* @param {Array<Number>} arr
*/
const makeFormat = arr => arr.map((s) => {
return { w: s[0], h: s[1] };
});

export const spec = {
code: BIDDER_CODE,
aliases: ['uncn'],
Expand Down