Skip to content

Commit

Permalink
Merge branch 'master' into prebid-7
Browse files Browse the repository at this point in the history
  • Loading branch information
dgirardi committed May 10, 2022
2 parents 670ee19 + 04fefef commit 863b2ee
Show file tree
Hide file tree
Showing 38 changed files with 1,494 additions and 187 deletions.
1 change: 1 addition & 0 deletions modules/.submodules.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"amxIdSystem",
"britepoolIdSystem",
"connectIdSystem",
"cpexIdSystem",
"criteoIdSystem",
"dacIdSystem",
"deepintentDpesIdSystem",
Expand Down
5 changes: 5 additions & 0 deletions modules/adfBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@ export const spec = {
request.is_debug = !!test;
request.test = 1;
}

if (config.getConfig('coppa')) {
deepSetValue(request, 'regs.coppa', 1);
}

if (deepAccess(bidderRequest, 'gdprConsent.gdprApplies') !== undefined) {
deepSetValue(request, 'user.ext.consent', bidderRequest.gdprConsent.consentString);
deepSetValue(request, 'regs.ext.gdpr', bidderRequest.gdprConsent.gdprApplies & 1);
Expand Down
1 change: 1 addition & 0 deletions modules/admanBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export const spec = {
if (bid.userId) {
getUserId(placement.eids, bid.userId.uid2 && bid.userId.uid2.id, 'uidapi.com');
getUserId(placement.eids, bid.userId.lotamePanoramaId, 'lotame.com');
getUserId(placement.eids, bid.userId.idx, 'idx.lat');
}
if (traff === VIDEO) {
placement.playerSize = bid.mediaTypes[VIDEO].playerSize;
Expand Down
119 changes: 119 additions & 0 deletions modules/alkimiBidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { deepClone, deepAccess } from '../src/utils.js';
import { ajax } from '../src/ajax.js';
import { VIDEO } from '../src/mediaTypes.js';
import { config } from '../src/config.js';

const BIDDER_CODE = 'alkimi';
export const ENDPOINT = 'https://exchange.alkimi-onboarding.com/bid?prebid=true';

export const spec = {
code: BIDDER_CODE,
supportedMediaTypes: ['banner', 'video'],

isBidRequestValid: function (bid) {
return !!(bid.params && bid.params.bidFloor && bid.params.token);
},

buildRequests: function (validBidRequests, bidderRequest) {
let bids = [];
let bidIds = [];
validBidRequests.forEach(bidRequest => {
let sizes = prepareSizes(bidRequest.sizes)

bids.push({
token: bidRequest.params.token,
pos: bidRequest.params.pos,
bidFloor: bidRequest.params.bidFloor,
width: sizes[0].width,
height: sizes[0].height,
impMediaType: getFormatType(bidRequest)
})
bidIds.push(bidRequest.bidId)
})

const alkimiConfig = config.getConfig('alkimi');

let payload = {
requestId: bidderRequest.auctionId,
signRequest: { bids, randomUUID: alkimiConfig && alkimiConfig.randomUUID },
bidIds,
referer: bidderRequest.refererInfo.referer,
signature: alkimiConfig && alkimiConfig.signature
}

const options = {
contentType: 'application/json',
customHeaders: {
'Rtb-Direct': true
}
}

return {
method: 'POST',
url: ENDPOINT,
data: payload,
options
};
},

interpretResponse: function (serverResponse, request) {
const serverBody = serverResponse.body;
if (!serverBody || typeof serverBody !== 'object') {
return [];
}

const { prebidResponse } = serverBody;
if (!prebidResponse || typeof prebidResponse !== 'object') {
return [];
}

let bids = [];
prebidResponse.forEach(bidResponse => {
let bid = deepClone(bidResponse);
bid.cpm = parseFloat(bidResponse.cpm);

// banner or video
if (VIDEO === bid.mediaType) {
bid.vastXml = bid.ad;
}

bid.meta = {};
bid.meta.advertiserDomains = bid.adomain || [];

bids.push(bid);
})

return bids;
},

onBidWon: function (bid) {
let winUrl;
if (bid.winUrl || bid.vastUrl) {
winUrl = bid.winUrl ? bid.winUrl : bid.vastUrl;
winUrl = winUrl.replace(/\$\{AUCTION_PRICE\}/, bid.cpm);
} else if (bid.ad) {
let trackImg = bid.ad.match(/(?!^)<img src=".+dsp-win.+">/);
bid.ad = bid.ad.replace(trackImg[0], '');
winUrl = trackImg[0].split('"')[1];
winUrl = winUrl.replace(/\$%7BAUCTION_PRICE%7D/, bid.cpm);
} else {
return false;
}

ajax(winUrl, null);
return true;
}
}

function prepareSizes(sizes) {
return sizes && sizes.map(size => ({ width: size[0], height: size[1] }));
}

const getFormatType = bidRequest => {
if (deepAccess(bidRequest, 'mediaTypes.banner')) return 'Banner'
if (deepAccess(bidRequest, 'mediaTypes.video')) return 'Video'
if (deepAccess(bidRequest, 'mediaTypes.audio')) return 'Audio'
}

registerBidder(spec);
29 changes: 29 additions & 0 deletions modules/alkimiBidAdapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Overview

```
Module Name: Alkimi Bidder Adapter
Module Type: Bidder Adapter
Maintainer: abogdanov@asteriosoft.com
```

# Description

Connects to Alkimi Bidder for bids.
Alkimi bid adapter supports Banner and Video ads.

# Test Parameters
```
const adUnits = [
{
bids: [
{
bidder: 'alkimi',
params: {
bidFloor: 0.1,
token: '?????????????????????', // Publisher Token provided by Alkimi
}
}
]
}
];
```
90 changes: 90 additions & 0 deletions modules/bidwatchAnalyticsAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import adapter from '../src/AnalyticsAdapter.js';
import adapterManager from '../src/adapterManager.js';
import CONSTANTS from '../src/constants.json';
import { ajax } from '../src/ajax.js';

const analyticsType = 'endpoint';
const url = 'URL_TO_SERVER_ENDPOINT';

const {
EVENTS: {
AUCTION_END,
BID_WON,
}
} = CONSTANTS;

let allEvents = {}
let initOptions = {}
let endpoint = 'https://default'
let objectToSearchForBidderCode = ['bidderRequests', 'bidsReceived', 'noBids']

function getAdapterNameForAlias(aliasName) {
return adapterManager.aliasRegistry[aliasName] || aliasName;
}

function setOriginalBidder(arg) {
Object.keys(arg).forEach(key => {
arg[key]['originalBidder'] = getAdapterNameForAlias(arg[key]['bidderCode']);
if (typeof arg[key]['creativeId'] == 'number') { arg[key]['creativeId'] = arg[key]['creativeId'].toString(); }
});
return arg
}

function checkBidderCode(args) {
if (typeof args == 'object') {
for (let i = 0; i < objectToSearchForBidderCode.length; i++) {
if (typeof args[objectToSearchForBidderCode[i]] == 'object') { args[objectToSearchForBidderCode[i]] = setOriginalBidder(args[objectToSearchForBidderCode[i]]) }
}
}
if (typeof args['bidderCode'] == 'string') { args['originalBidder'] = getAdapterNameForAlias(args['bidderCode']); } else if (typeof args['bidder'] == 'string') { args['originalBidder'] = getAdapterNameForAlias(args['bidder']); }
if (typeof args['creativeId'] == 'number') { args['creativeId'] = args['creativeId'].toString(); }
return args
}

function addEvent(eventType, args) {
if (allEvents[eventType] == undefined) { allEvents[eventType] = [] }
if (eventType && args) { args = checkBidderCode(args); }
allEvents[eventType].push(args);
}

function handleBidWon(args) {
if (typeof allEvents.bidRequested == 'object' && allEvents.bidRequested.length > 0 && allEvents.bidRequested[0].gdprConsent) { args.gdpr = allEvents.bidRequested[0].gdprConsent; }
ajax(endpoint + '.bidwatch.io/analytics/bid_won', null, JSON.stringify(args), {method: 'POST', withCredentials: true});
}

function handleAuctionEnd() {
ajax(endpoint + '.bidwatch.io/analytics/auctions', null, JSON.stringify(allEvents), {method: 'POST', withCredentials: true});
}

let bidwatchAnalytics = Object.assign(adapter({url, analyticsType}), {
track({
eventType,
args
}) {
addEvent(eventType, args);
switch (eventType) {
case AUCTION_END:
handleAuctionEnd();
break;
case BID_WON:
handleBidWon(args);
break;
}
}});

// save the base class function
bidwatchAnalytics.originEnableAnalytics = bidwatchAnalytics.enableAnalytics;

// override enableAnalytics so we can get access to the config passed in from the page
bidwatchAnalytics.enableAnalytics = function (config) {
bidwatchAnalytics.originEnableAnalytics(config); // call the base class function
initOptions = config.options;
if (initOptions.domain) { endpoint = 'https://' + initOptions.domain; }
};

adapterManager.registerAnalyticsAdapter({
adapter: bidwatchAnalytics,
code: 'bidwatch'
});

export default bidwatchAnalytics;
21 changes: 21 additions & 0 deletions modules/bidwatchAnalyticsAdapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Overview
Module Name: bidwatch Analytics Adapter

Module Type: Analytics Adapter

Maintainer: tech@bidwatch.io

# Description

Analytics adapter for bidwatch.io.

# Test Parameters

```
{
provider: 'bidwatch',
options : {
domain: 'test.endpoint'
}
}
```
10 changes: 9 additions & 1 deletion modules/big-richmediaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const BIDDER_CODE = 'big-richmedia';
const metadataByRequestId = {};

export const spec = {
version: '1.4.0',
version: '1.5.0',
code: BIDDER_CODE,
gvlid: baseAdapter.GVLID, // use base adapter gvlid
supportedMediaTypes: [ BANNER, VIDEO ],
Expand Down Expand Up @@ -78,6 +78,14 @@ export const spec = {
customSelector,
isReplayable
};

// This is a workaround needed for the rendering step (so that the adserver iframe does not get resized to 1800x1000
// when there is skin demand
if (format === 'skin') {
renderParams.width = 1
renderParams.height = 1
}

const encoded = window.btoa(JSON.stringify(renderParams));
bid.ad = `<script src="//cdn.hubvisor.io/wrapper/${publisherId}/richmedia-renderer.js" async="true"></script>
<script>var hbvrm = hbvrm || {}; hbvrm.cmd = hbvrm.cmd || []; hbvrm.cmd.push(function() { hbvrm.render('${encoded}'); });</script>`;
Expand Down
19 changes: 5 additions & 14 deletions modules/bizzclickBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export const spec = {
},
regs: {
coppa: config.getConfig('coppa') === true ? 1 : 0,
ext: {}
},
user: {
ext: {}
Expand All @@ -106,25 +107,15 @@ export const spec = {
imp: [impObject],
};

if (bidderRequest && bidderRequest.uspConsent) {
data.regs.ext.us_privacy = bidderRequest.uspConsent;
}

if (bidderRequest && bidderRequest.gdprConsent) {
let { gdprApplies, consentString } = bidderRequest.gdprConsent;
data.regs.ext.gdpr = gdprApplies ? 1 : 0;
data.user.ext.consent = consentString;
}

if (bidRequest.schain) {
deepSetValue(data, 'source.ext.schain', bidRequest.schain);
}

let connection = navigator.connection || navigator.webkitConnection;
if (connection && connection.effectiveType) {
data.device.connectiontype = connection.effectiveType;
}
if (bidRequest) {
if (bidRequest.schain) {
deepSetValue(data, 'source.ext.schain', bidRequest.schain);
}

if (bidRequest.gdprConsent && bidRequest.gdprConsent.gdprApplies) {
deepSetValue(data, 'regs.ext.gdpr', bidRequest.gdprConsent.gdprApplies ? 1 : 0);
deepSetValue(data, 'user.ext.consent', bidRequest.gdprConsent.consentString);
Expand Down
Loading

0 comments on commit 863b2ee

Please sign in to comment.