Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gamoshi: Refactor GDPR consent #3507

Merged
merged 13 commits into from
Feb 4, 2019
13 changes: 8 additions & 5 deletions modules/gamoshiBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import * as utils from '../src/utils';
import {registerBidder} from '../src/adapters/bidderFactory';
import {config} from '../src/config';
import {Renderer} from '../src/Renderer';
import {BANNER, VIDEO} from "../src/mediaTypes";
import {BANNER, VIDEO} from '../src/mediaTypes';

const ENDPOINTS = {
'viewdeos': 'https://rtb.viewdeos.com',
'cleanmedia': 'https://bidder.cleanmediaads.com',
'gamoshi': 'https://rtb.gamoshi.io',
'gambid': 'https://rtb.gamoshi.io',
Expand Down Expand Up @@ -42,7 +43,7 @@ export const helper = {

export const spec = {
code: 'gamoshi',
aliases: ['gambid', 'cleanmedia'],
aliases: ['gambid', 'cleanmedia', 'viewdeos'],
supportedMediaTypes: ['banner', 'video'],

isBidRequestValid: function (bid) {
Expand Down Expand Up @@ -76,7 +77,9 @@ export const spec = {
'ext': {}
};

if (bidderRequest.gdprConsent) {
if (bidderRequest.gdprConsent &&
bidderRequest.gdprConsent.consentString &&
bidderRequest.gdprConsent.gdprApplies) {
rtbBidRequest.ext.gdpr_consent = {
consent_string: bidderRequest.gdprConsent.consentString,
consent_required: bidderRequest.gdprConsent.gdprApplies
Expand All @@ -96,7 +99,7 @@ export const spec = {
params.favoredMediaType && this.supportedMediaTypes.includes(params.favoredMediaType);

if ((!mediaTypes || mediaTypes.banner)) {
if (!hasFavoredMediaType || params.favoredMediaType === 'banner') {
if (!hasFavoredMediaType || params.favoredMediaType === BANNER) {
const bannerImp = Object.assign({}, imp, {
banner: {
w: sizes.length ? sizes[0][0] : 300,
Expand All @@ -110,7 +113,7 @@ export const spec = {
}

if (mediaTypes && mediaTypes.video) {
if (!hasFavoredMediaType || params.favoredMediaType === 'video') {
if (!hasFavoredMediaType || params.favoredMediaType === VIDEO) {
const videoImp = Object.assign({}, imp, {
video: {
w: sizes.length ? sizes[0][0] : 300,
Expand Down