Skip to content

Commit

Permalink
Merge branch 'prebid:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
YakirLavi authored Apr 20, 2023
2 parents 53db894 + 1fc1ec3 commit c25259c
Show file tree
Hide file tree
Showing 41 changed files with 1,862 additions and 2,137 deletions.
9 changes: 7 additions & 2 deletions modules/admaticBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getValue, logError, deepAccess, getBidIdParameter, isArray } from '../src/utils.js';
import { getValue, logError, isEmpty, deepAccess, getBidIdParameter, isArray } from '../src/utils.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { config } from '../src/config.js';
import { BANNER, VIDEO } from '../src/mediaTypes.js';
Expand Down Expand Up @@ -34,6 +34,7 @@ export const spec = {
*/
buildRequests: (validBidRequests, bidderRequest) => {
const bids = validBidRequests.map(buildRequestObject);
const blacklist = bidderRequest.ortb2 || {};
const networkId = getValue(validBidRequests[0].params, 'networkId');
const host = getValue(validBidRequests[0].params, 'host');
const currency = config.getConfig('currency.adServerCurrency') || 'TRY';
Expand All @@ -59,6 +60,10 @@ export const spec = {
}
};

if (!isEmpty(blacklist.badv)) {
payload.blacklist = blacklist.badv;
};

if (payload) {
switch (bidderName) {
case 'pixad':
Expand All @@ -69,7 +74,7 @@ export const spec = {
break;
}

return { method: 'POST', url: `https://${host}/pb?bidder=${bidderName}`, data: payload, options: { contentType: 'application/json' } };
return { method: 'POST', url: `https://${host}/pb`, data: payload, options: { contentType: 'application/json' } };
}
},

Expand Down
4 changes: 3 additions & 1 deletion modules/adnuntiusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { getStorageManager } from '../src/storageManager.js';

const BIDDER_CODE = 'adnuntius';
const ENDPOINT_URL = 'https://ads.adnuntius.delivery/i';
const ENDPOINT_URL_EUROPE = 'https://europe.delivery.adnuntius.com/i';
const GVLID = 855;
const DEFAULT_VAST_VERSION = 'vast4'
// const DEFAULT_NATIVE = 'native'
Expand Down Expand Up @@ -130,10 +131,11 @@ export const spec = {
const network = networkKeys[j];
const networkRequest = [...request]
if (network.indexOf('_video') > -1) { networkRequest.push('tt=' + DEFAULT_VAST_VERSION) }
const requestURL = gdprApplies ? ENDPOINT_URL_EUROPE : ENDPOINT_URL
// if (network.indexOf('_native') > -1) { networkRequest.push('tt=' + DEFAULT_NATIVE) }
requests.push({
method: 'POST',
url: ENDPOINT_URL + '?' + networkRequest.join('&'),
url: requestURL + '?' + networkRequest.join('&'),
data: JSON.stringify(networks[network]),
bid: bidRequests[network]
});
Expand Down
2 changes: 2 additions & 0 deletions modules/bidwatchAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import adapter from '../libraries/analyticsAdapter/AnalyticsAdapter.js';
import adapterManager from '../src/adapterManager.js';
import CONSTANTS from '../src/constants.json';
import { ajax } from '../src/ajax.js';
import { getRefererInfo } from '../src/refererDetection.js';

const analyticsType = 'endpoint';
const url = 'URL_TO_SERVER_ENDPOINT';
Expand Down Expand Up @@ -145,6 +146,7 @@ function handleBidWon(args) {
});
}
args['cpmIncrement'] = increment;
args['referer'] = encodeURIComponent(getRefererInfo().page || getRefererInfo().topmostLocation);
if (typeof saveEvents.bidRequested == 'object' && saveEvents.bidRequested.length > 0 && saveEvents.bidRequested[0].gdprConsent) { args.gdpr = saveEvents.bidRequested[0].gdprConsent; }
ajax(endpoint + '.bidwatch.io/analytics/bid_won', null, JSON.stringify(args), {method: 'POST', withCredentials: true});
}
Expand Down
3 changes: 3 additions & 0 deletions modules/conversantBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ export const spec = {
const payload = {
id: requestId,
imp: conversantImps,
source: {
tid: requestId
},
site: {
id: siteId,
mobile: document.querySelector('meta[name="viewport"][content*="width=device-width"]') !== null ? 1 : 0,
Expand Down
72 changes: 72 additions & 0 deletions modules/eskimiBidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER} from '../src/mediaTypes.js';
import * as utils from '../src/utils.js';
import {ortbConverter} from '../libraries/ortbConverter/converter.js'

const BIDDER_CODE = 'eskimi';
// const ENDPOINT = 'https://hb.eskimi.com/bids'
const ENDPOINT = 'https://sspback.eskimi.com/bid-request'

const DEFAULT_BID_TTL = 30;
const DEFAULT_CURRENCY = 'USD';
const DEFAULT_NET_REVENUE = true;
const GVLID = 814;

export const spec = {
code: BIDDER_CODE,
gvlid: GVLID,
supportedMediaTypes: [BANNER],

isBidRequestValid: function (bid) {
return !!bid.params.placementId;
},

buildRequests(bidRequests, bidderRequest) {
const data = converter.toORTB({bidRequests, bidderRequest})

let bid = bidRequests.find((b) => b.params.placementId)
if (!data.site) data.site = {}
data.site.ext = {placementId: bid.params.placementId}

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

return [{
method: 'POST',
url: ENDPOINT,
data,
options: {contentType: 'application/json;charset=UTF-8', withCredentials: false}
}]
},

interpretResponse(response, request) {
return converter.fromORTB({response: response.body, request: request.data}).bids;
},

/**
* Register bidder specific code, which will execute if a bid from this bidder won the auction
* @param {Bid} bid The bid that won the auction
*/
onBidWon: function (bid) {
if (bid.burl) {
utils.triggerPixel(bid.burl);
}
}
}

const converter = ortbConverter({
context: {
netRevenue: DEFAULT_NET_REVENUE,
ttl: DEFAULT_BID_TTL,
currency: DEFAULT_CURRENCY,
mediaType: BANNER // TODO: support more types, we should set mtype on the winning bid
}
});

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

Module Name: ESKIMI Bidder Adapter
Module Type: Bidder Adapter
Maintainer: tech@eskimi.com

# Description

An adapter to get a bid from Eskimi DSP.

# Test Parameters
```javascript
var adUnits = [{
code: 'div-gpt-ad-1460505748561-0',
mediaTypes: {
banner: {
sizes: [[300, 250], [300, 600]]
}
},

bids: [{
bidder: 'eskimi',
params: {
placementId: 612
}
}]

}];
```

Where:

* placementId - Placement ID of the ad unit (required)

61 changes: 42 additions & 19 deletions modules/gridBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import {
generateUUID,
mergeDeep,
logWarn,
parseUrl, isArray, isNumber
parseUrl,
isArray,
isNumber,
isStr
} from '../src/utils.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { Renderer } from '../src/Renderer.js';
Expand Down Expand Up @@ -52,15 +55,20 @@ const ALIAS_CONFIG = {
bidResponseExternal: {
netRevenue: false
}
}
},
'gridNM': {
defaultParams: {
multiRequest: true
}
},
};

let hasSynced = false;

export const spec = {
code: BIDDER_CODE,
gvlid: GVLID,
aliases: ['playwire', 'adlivetech', { code: 'trustx', skipPbsAliasing: true }],
aliases: ['playwire', 'adlivetech', 'gridNM', { code: 'trustx', skipPbsAliasing: true }],
supportedMediaTypes: [ BANNER, VIDEO ],
/**
* Determines whether or not the given bid request is valid.
Expand Down Expand Up @@ -126,8 +134,9 @@ export const spec = {
if (!endpoint) {
endpoint = ALIAS_CONFIG[bid.bidder] && ALIAS_CONFIG[bid.bidder].endpoint;
}
const { params: { uid, keywords, forceBidder, multiRequest }, mediaTypes, bidId, adUnitCode, rtd, ortb2Imp } = bid;
const { secid, pubid, source, content: bidParamsContent } = bid.params;
const { params, mediaTypes, bidId, adUnitCode, rtd, ortb2Imp } = bid;
const { defaultParams } = ALIAS_CONFIG[bid.bidder] || {};
const { secid, pubid, source, uid, keywords, forceBidder, multiRequest, content: bidParamsContent, video: videoParams } = { ...defaultParams, ...params };
const bidFloor = _getFloor(mediaTypes || {}, bid);
const jwTargeting = rtd && rtd.jwplayer && rtd.jwplayer.targeting;
if (jwTargeting && !content && jwTargeting.content) {
Expand Down Expand Up @@ -178,7 +187,7 @@ export const spec = {
}
}
if (mediaTypes && mediaTypes[VIDEO]) {
const video = createVideoRequest(bid, mediaTypes[VIDEO]);
const video = createVideoRequest(videoParams, mediaTypes[VIDEO], bid.sizes);
if (video) {
impObj.video = video;
}
Expand Down Expand Up @@ -588,27 +597,41 @@ function _addBidResponse(serverBid, bidRequest, bidResponses, RendererConst, bid
}
}

function createVideoRequest(bid, mediaType) {
const { playerSize, mimes, durationRangeSec, protocols } = mediaType;
const size = (playerSize || bid.sizes || [])[0];
if (!size) return;
function createVideoRequest(videoParams, mediaType, bidSizes) {
const { mind, maxd, size, playerSize, protocols, durationRangeSec = [], ...videoData } = { ...mediaType, ...videoParams };
if (size && isStr(size)) {
const sizeArray = size.split('x');
if (sizeArray.length === 2 && parseInt(sizeArray[0]) && parseInt(sizeArray[1])) {
videoData.w = parseInt(sizeArray[0]);
videoData.h = parseInt(sizeArray[1]);
}
}
if (!videoData.w || !videoData.h) {
const pSizesString = (playerSize || bidSizes || []).toString();
const pSizeString = (pSizesString.match(/^\d+,\d+/) || [])[0];
const pSize = pSizeString && pSizeString.split(',').map((d) => parseInt(d));
if (pSize && pSize.length === 2) {
Object.assign(videoData, parseGPTSingleSizeArrayToRtbSize(pSize));
}
}

let result = parseGPTSingleSizeArrayToRtbSize(size);
if (!videoData.w || !videoData.h) return;

if (mimes) {
result.mimes = mimes;
}
const minDur = mind || durationRangeSec[0] || videoData.minduration;
const maxDur = maxd || durationRangeSec[1] || videoData.maxduration;

if (durationRangeSec && durationRangeSec.length === 2) {
result.minduration = durationRangeSec[0];
result.maxduration = durationRangeSec[1];
if (minDur) {
videoData.minduration = minDur;
}
if (maxDur) {
videoData.maxduration = maxDur;
}

if (protocols && protocols.length) {
result.protocols = protocols;
videoData.protocols = protocols;
}

return result;
return videoData;
}

function createBannerRequest(bid, mediaType) {
Expand Down
Loading

0 comments on commit c25259c

Please sign in to comment.