From 83b63dba45b9ff5535831934a125f6b449b91a0c Mon Sep 17 00:00:00 2001 From: susyt Date: Fri, 23 Apr 2021 11:25:35 -0700 Subject: [PATCH] GumGum Bid Adapter: use ad response sizes when found (#6649) * adds meta field to bidresponse * adds meta mediatype and advertiserdomain default * use response sizes in bidresponse --- modules/gumgumBidAdapter.js | 11 ++++++++--- test/spec/modules/gumgumBidAdapter_spec.js | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/modules/gumgumBidAdapter.js b/modules/gumgumBidAdapter.js index 606f8335a19..4786fd04b15 100644 --- a/modules/gumgumBidAdapter.js +++ b/modules/gumgumBidAdapter.js @@ -384,7 +384,9 @@ function interpretResponse (serverResponse, bidRequest) { ad: { price: 0, id: 0, - markup: '' + markup: '', + width: 0, + height: 0 }, pag: { pvid: 0 @@ -399,7 +401,9 @@ function interpretResponse (serverResponse, bidRequest) { price: cpm, id: creativeId, markup, - cur + cur, + width: responseWidth, + height: responseHeight }, cw: wrapper, pag: { @@ -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 || [], diff --git a/test/spec/modules/gumgumBidAdapter_spec.js b/test/spec/modules/gumgumBidAdapter_spec.js index 2365fddd01f..a7b18a16173 100644 --- a/test/spec/modules/gumgumBidAdapter_spec.js +++ b/test/spec/modules/gumgumBidAdapter_spec.js @@ -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,