Skip to content

Commit 41e6891

Browse files
MillerrokNate Cozi
authored and
Nate Cozi
committed
Fix adapter getSize (#1064)
* 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
1 parent f7216e1 commit 41e6891

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

src/adapters/vertamedia.js

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,36 @@ function VertamediaAdapter() {
3535
}
3636

3737
bidRequest = bid;
38-
bidRequest.width = parseInt(bid.sizes[0], 10) || undefined;
39-
bidRequest.height = parseInt(bid.sizes[1], 10) || undefined;
38+
39+
let size = getSize(bid.sizes);
40+
41+
bidRequest.width = size.width;
42+
bidRequest.height = size.height;
4043

4144
return {
4245
aid: bid.params.aid,
43-
w: parseInt(bid.sizes[0], 10) || undefined,
44-
h: parseInt(bid.sizes[1], 10) || undefined,
46+
w: size.width,
47+
h: size.height,
4548
domain: document.location.hostname
4649
};
4750
}
4851

52+
function getSize(requestSizes) {
53+
var parsed = {},
54+
size = utils.parseSizesInput(requestSizes)[0];
55+
56+
if (typeof size !== 'string') {
57+
return parsed;
58+
}
59+
60+
let parsedSize = size.toUpperCase().split('X');
61+
62+
return {
63+
width: parseInt(parsedSize[0], 10) || undefined,
64+
height: parseInt(parsedSize[1], 10) || undefined
65+
};
66+
}
67+
4968
/* Notify Prebid of bid responses so bids can get in the auction */
5069
function handleResponse(response) {
5170
var parsed;

0 commit comments

Comments
 (0)