Skip to content

Commit

Permalink
MinuteMediaPlus Bid Adapter: added support for all user id systems. (p…
Browse files Browse the repository at this point in the history
  • Loading branch information
saar120 authored May 11, 2023
1 parent b5a9556 commit facd0b7
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 34 deletions.
62 changes: 30 additions & 32 deletions modules/minutemediaplusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,7 @@ const BIDDER_VERSION = '1.0.0';
const CURRENCY = 'USD';
const TTL_SECONDS = 60 * 5;
const UNIQUE_DEAL_ID_EXPIRY = 1000 * 60 * 15;
export const SUPPORTED_ID_SYSTEMS = {
'britepoolid': 1,
'criteoId': 1,
'id5id': 1,
'idl_env': 1,
'lipb': 1,
'netId': 1,
'parrableId': 1,
'pubcid': 1,
'tdid': 1,
'pubProvidedId': 1
};

const storage = getStorageManager({bidderCode: BIDDER_CODE});

function getTopWindowQueryParams() {
Expand Down Expand Up @@ -161,25 +150,23 @@ function buildRequest(bid, topWindowUrl, sizes, bidderRequest, bidderTimeout) {
function appendUserIdsToRequestPayload(payloadRef, userIds) {
let key;
_each(userIds, (userId, idSystemProviderName) => {
if (SUPPORTED_ID_SYSTEMS[idSystemProviderName]) {
key = `uid.${idSystemProviderName}`;

switch (idSystemProviderName) {
case 'digitrustid':
payloadRef[key] = deepAccess(userId, 'data.id');
break;
case 'lipb':
payloadRef[key] = userId.lipbid;
break;
case 'parrableId':
payloadRef[key] = userId.eid;
break;
case 'id5id':
payloadRef[key] = userId.uid;
break;
default:
payloadRef[key] = userId;
}
key = `uid.${idSystemProviderName}`;

switch (idSystemProviderName) {
case 'digitrustid':
payloadRef[key] = deepAccess(userId, 'data.id');
break;
case 'lipb':
payloadRef[key] = userId.lipbid;
break;
case 'parrableId':
payloadRef[key] = userId.eid;
break;
case 'id5id':
payloadRef[key] = userId.uid;
break;
default:
payloadRef[key] = userId;
}
});
}
Expand Down Expand Up @@ -207,7 +194,18 @@ function interpretResponse(serverResponse, request) {

try {
results.forEach(result => {
const {creativeId, ad, price, exp, width, height, currency, metaData, advertiserDomains, mediaType = BANNER} = result;
const {
creativeId,
ad,
price,
exp,
width,
height,
currency,
metaData,
advertiserDomains,
mediaType = BANNER
} = result;
if (!ad || !price) {
return;
}
Expand Down
5 changes: 3 additions & 2 deletions test/spec/modules/minutemediaplusBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {expect} from 'chai';
import {
spec as adapter,
SUPPORTED_ID_SYSTEMS,
createDomain,
hashCode,
extractPID,
Expand All @@ -18,6 +17,8 @@ import {useFakeTimers} from 'sinon';
import {BANNER, VIDEO} from '../../../src/mediaTypes';
import {config} from '../../../src/config';

export const TEST_ID_SYSTEMS = ['britepoolid', 'criteoId', 'id5id', 'idl_env', 'lipb', 'netId', 'parrableId', 'pubcid', 'tdid', 'pubProvidedId'];

const SUB_DOMAIN = 'exchange';

const BID = {
Expand Down Expand Up @@ -498,7 +499,7 @@ describe('MinuteMediaPlus Bid Adapter', function () {
});

describe('user id system', function () {
Object.keys(SUPPORTED_ID_SYSTEMS).forEach((idSystemProvider) => {
TEST_ID_SYSTEMS.forEach((idSystemProvider) => {
const id = Date.now().toString();
const bid = utils.deepClone(BID);

Expand Down

0 comments on commit facd0b7

Please sign in to comment.