Skip to content

Commit

Permalink
GumGum Bid Adapter: use ad response sizes when found (#6649)
Browse files Browse the repository at this point in the history
* adds meta field to bidresponse

* adds meta mediatype and advertiserdomain default

* use response sizes in bidresponse
  • Loading branch information
susyt authored and idettman committed May 21, 2021
1 parent 0923c13 commit 83b63db
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
11 changes: 8 additions & 3 deletions modules/gumgumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,9 @@ function interpretResponse (serverResponse, bidRequest) {
ad: {
price: 0,
id: 0,
markup: ''
markup: '',
width: 0,
height: 0
},
pag: {
pvid: 0
Expand All @@ -399,7 +401,9 @@ function interpretResponse (serverResponse, bidRequest) {
price: cpm,
id: creativeId,
markup,
cur
cur,
width: responseWidth,
height: responseHeight
},
cw: wrapper,
pag: {
Expand All @@ -415,7 +419,8 @@ function interpretResponse (serverResponse, bidRequest) {
let product = data.pi
let mediaType = (product === 6 || product === 7) ? VIDEO : BANNER
let isTestUnit = (product === 3 && data.si === 9)
let sizes = utils.parseSizesInput(bidRequest.sizes)
// use response sizes if available
let sizes = responseWidth && responseHeight ? [`${responseWidth}x${responseHeight}`] : utils.parseSizesInput(bidRequest.sizes)
let [width, height] = sizes[0].split('x')
let metaData = {
advertiserDomains: advertiserDomains || [],
Expand Down
19 changes: 19 additions & 0 deletions test/spec/modules/gumgumBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,25 @@ describe('gumgumAdapter', function () {
expect(result.length).to.equal(0);
});

it('uses response width and height', function () {
const result = spec.interpretResponse({ body: serverResponse }, bidRequest)[0];
expect(result.width).to.equal(serverResponse.ad.width.toString());
expect(result.height).to.equal(serverResponse.ad.height.toString());
});

it('defaults to use bidRequest sizes when width and height are not found', function () {
const { ad, jcsi, pag, thms, meta } = serverResponse
const noAdSizes = { ...ad }
delete noAdSizes.width
delete noAdSizes.height
const responseWithoutSizes = { jcsi, pag, thms, meta, ad: noAdSizes }
const request = { ...bidRequest, sizes: [[100, 200]] }
const result = spec.interpretResponse({ body: responseWithoutSizes }, request)[0];

expect(result.width).to.equal(request.sizes[0][0].toString())
expect(result.height).to.equal(request.sizes[0][1].toString())
});

it('returns 1x1 when eligible product and size available', function () {
let inscreenBidRequest = {
id: 12346,
Expand Down

0 comments on commit 83b63db

Please sign in to comment.