Skip to content

Commit

Permalink
Fix adapter getSize (#1064)
Browse files Browse the repository at this point in the history
* Vertamedia prebid.js adapter initial

* sync

* remove https

* add http

* remove let

* fix typo

* fix spaces

* add descriptionUrl; remove log

* fix getSize

* add usege parseSizesInput
  • Loading branch information
Millerrok authored and Nate Cozi committed Mar 27, 2017
1 parent f7216e1 commit 41e6891
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions src/adapters/vertamedia.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,36 @@ function VertamediaAdapter() {
}

bidRequest = bid;
bidRequest.width = parseInt(bid.sizes[0], 10) || undefined;
bidRequest.height = parseInt(bid.sizes[1], 10) || undefined;

let size = getSize(bid.sizes);

bidRequest.width = size.width;
bidRequest.height = size.height;

return {
aid: bid.params.aid,
w: parseInt(bid.sizes[0], 10) || undefined,
h: parseInt(bid.sizes[1], 10) || undefined,
w: size.width,
h: size.height,
domain: document.location.hostname
};
}

function getSize(requestSizes) {
var parsed = {},
size = utils.parseSizesInput(requestSizes)[0];

if (typeof size !== 'string') {
return parsed;
}

let parsedSize = size.toUpperCase().split('X');

return {
width: parseInt(parsedSize[0], 10) || undefined,
height: parseInt(parsedSize[1], 10) || undefined
};
}

/* Notify Prebid of bid responses so bids can get in the auction */
function handleResponse(response) {
var parsed;
Expand Down

0 comments on commit 41e6891

Please sign in to comment.