Skip to content

Commit

Permalink
GumGum: sets mediaType of bidRequest depending on product id (#6066)
Browse files Browse the repository at this point in the history
* adds support for zone and pubId params

* adds support for iriscat field

* sets mediatype depending on product id

* Update doc for mediaType needed for video products
  • Loading branch information
susyt authored Dec 4, 2020
1 parent 8107da6 commit 8ea3f3b
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 13 deletions.
5 changes: 3 additions & 2 deletions modules/gumgumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ function interpretResponse (serverResponse, bidRequest) {
} = Object.assign(defaultResponse, serverResponseBody)
let data = bidRequest.data || {}
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)
let [width, height] = sizes[0].split('x')
Expand All @@ -424,9 +425,9 @@ function interpretResponse (serverResponse, bidRequest) {
bidResponses.push({
// dealId: DEAL_ID,
// referrer: REFERER,
...(product === 7 && { vastXml: markup, mediaType: VIDEO }),
ad: wrapper ? getWrapperCode(wrapper, Object.assign({}, serverResponseBody, { bidRequest })) : markup,
...(product === 6 && {ad: markup}),
...(mediaType === VIDEO && {ad: markup, vastXml: markup}),
mediaType,
cpm: isTestUnit ? 0.1 : cpm,
creativeId,
currency: cur || 'USD',
Expand Down
27 changes: 26 additions & 1 deletion modules/gumgumBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,22 @@ Maintainer: engineering@gumgum.com

# Description

GumGum adapter for Prebid.js 1.0
GumGum adapter for Prebid.js
Please note that both video and in-video products require a mediaType of video.
All other products (in-screen, slot, native) should have a mediaType of banner.


# Test Parameters
```
var adUnits = [
{
code: 'test-div',
sizes: [[300, 250]],
mediaTypes: {
banner: {
sizes: [[300, 250]],
}
},
bids: [
{
bidder: 'gumgum',
Expand All @@ -28,6 +36,11 @@ var adUnits = [
},{
code: 'test-div',
sizes: [[300, 50]],
mediaTypes: {
banner: {
sizes: [[1, 1]],
}
},
bids: [
{
bidder: 'gumgum',
Expand All @@ -40,6 +53,18 @@ var adUnits = [
},{
code: 'test-div',
sizes: [[300, 50]],
mediaTypes: {
video: {
context: 'instream',
playerSize: [640, 480],
minduration: 1,
maxduration: 2,
linearity: 2,
startdelay: 1,
placement: 1,
protocols: [1, 2]
}
}
bids: [
{
bidder: 'gumgum',
Expand Down
34 changes: 24 additions & 10 deletions test/spec/modules/gumgumBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect } from 'chai';
import { newBidder } from 'src/adapters/bidderFactory.js';
import { spec } from 'modules/gumgumBidAdapter.js';
import { BANNER, VIDEO } from 'src/mediaTypes.js';

const ENDPOINT = 'https://g2.gumgum.com/hbid/imp';
const JCSI = { t: 0, rq: 8, pbv: '$prebid.version$' }
Expand Down Expand Up @@ -462,16 +463,15 @@ describe('gumgumAdapter', function () {
pi: 3
}
let expectedResponse = {
'ad': '<html><h3>I am an ad</h3></html>',
'cpm': 0,
'creativeId': 29593,
'currency': 'USD',
'height': '250',
'netRevenue': true,
'requestId': 12345,
'width': '300',
// dealId: DEAL_ID,
// referrer: REFERER,
ad: '<html><h3>I am an ad</h3></html>',
cpm: 0,
creativeId: 29593,
currency: 'USD',
height: '250',
netRevenue: true,
requestId: 12345,
width: '300',
mediaType: BANNER,
ttl: 60
};

Expand Down Expand Up @@ -552,6 +552,20 @@ describe('gumgumAdapter', function () {
const decodedResponse = JSON.parse(atob(bidResponse));
expect(decodedResponse.jcsi).to.eql(JCSI);
});

it('sets the correct mediaType depending on product', function () {
const bannerBidResponse = spec.interpretResponse({ body: serverResponse }, bidRequest)[0];
const invideoBidResponse = spec.interpretResponse({ body: serverResponse }, { ...bidRequest, data: { pi: 6 } })[0];
const videoBidResponse = spec.interpretResponse({ body: serverResponse }, { ...bidRequest, data: { pi: 7 } })[0];
expect(bannerBidResponse.mediaType).to.equal(BANNER);
expect(invideoBidResponse.mediaType).to.equal(VIDEO);
expect(videoBidResponse.mediaType).to.equal(VIDEO);
});

it('sets a vastXml property if mediaType is video', function () {
const videoBidResponse = spec.interpretResponse({ body: serverResponse }, { ...bidRequest, data: { pi: 7 } })[0];
expect(videoBidResponse.vastXml).to.exist;
});
})
describe('getUserSyncs', function () {
const syncOptions = {
Expand Down

0 comments on commit 8ea3f3b

Please sign in to comment.