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

add triple lift #5

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
172 changes: 172 additions & 0 deletions build/dist/33acrossBidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
pbjsChunk([59],{

/***/ 58:
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(59);
module.exports = __webpack_require__(64);


/***/ }),

/***/ 59:
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var _require = __webpack_require__(6),
registerBidder = _require.registerBidder;

var utils = __webpack_require__(0);

var BIDDER_CODE = '33across';
var END_POINT = 'https://ssc.33across.com/api/v1/hb';
var SYNC_ENDPOINT = 'https://de.tynt.com/deb/v2?m=xch&rt=html';

// All this assumes that only one bid is ever returned by ttx
function _createBidResponse(response) {
return {
requestId: response.id,
bidderCode: BIDDER_CODE,
cpm: response.seatbid[0].bid[0].price,
width: response.seatbid[0].bid[0].w,
height: response.seatbid[0].bid[0].h,
ad: response.seatbid[0].bid[0].adm,
ttl: response.seatbid[0].bid[0].ttl || 60,
creativeId: response.seatbid[0].bid[0].crid,
currency: response.cur,
netRevenue: true
};
}

// infer the necessary data from valid bid for a minimal ttxRequest and create HTTP request
function _createServerRequest(bidRequest) {
var ttxRequest = {};
var params = bidRequest.params;

ttxRequest.imp = [];
ttxRequest.imp[0] = {
banner: {
format: bidRequest.sizes.map(_getFormatSize)
},
ext: {
ttx: {
prod: params.productId
}
}

// Allowing site to be a test configuration object or just the id (former required for testing,
// latter when used by publishers)
};ttxRequest.site = params.site || { id: params.siteId };

// Go ahead send the bidId in request to 33exchange so it's kept track of in the bid response and
// therefore in ad targetting process
ttxRequest.id = bidRequest.bidId;
// Finally, set the openRTB 'test' param if this is to be a test bid
if (params.test === 1) {
ttxRequest.test = 1;
}

var options = {
contentType: 'application/json',
withCredentials: true
};

if (bidRequest.params.customHeaders) {
options.customHeaders = bidRequest.params.customHeaders;
}

return {
'method': 'POST',
'url': bidRequest.params.url || END_POINT,
'data': JSON.stringify(ttxRequest),
'options': options
};
}

// Sync object will always be of type iframe for ttx
function _createSync(bid) {
var syncUrl = bid.params.syncUrl || SYNC_ENDPOINT;

return {
type: 'iframe',
url: syncUrl + '&id=' + (bid.params.siteId || bid.params.site.id)
};
}

function _getFormatSize(sizeArr) {
return {
w: sizeArr[0],
h: sizeArr[1],
ext: {}
};
}

function isBidRequestValid(bid) {
if (bid.bidder !== BIDDER_CODE || typeof bid.params === 'undefined') {
return false;
}

if ((typeof bid.params.site === 'undefined' || typeof bid.params.site.id === 'undefined') && typeof bid.params.siteId === 'undefined') {
return false;
}

if (typeof bid.params.productId === 'undefined') {
return false;
}

return true;
}

// NOTE: At this point, 33exchange only accepts request for a single impression
function buildRequests(bidRequests) {
return bidRequests.map(_createServerRequest);
}

// NOTE: At this point, the response from 33exchange will only ever contain one bid i.e. the highest bid
function interpretResponse(serverResponse) {
var bidResponses = [];

// If there are bids, look at the first bid of the first seatbid (see NOTE above for assumption about ttx)
if (serverResponse.body.seatbid.length > 0 && serverResponse.body.seatbid[0].bid.length > 0) {
bidResponses.push(_createBidResponse(serverResponse.body));
}

return bidResponses;
}

// Register one sync per bid since each ad unit may potenitally be linked to a uniqe guid
function getUserSyncs(syncOptions) {
var syncs = [];
var ttxBidRequests = utils.getBidderRequestAllAdUnits(BIDDER_CODE).bids;

if (syncOptions.iframeEnabled) {
syncs = ttxBidRequests.map(_createSync);
}

return syncs;
}

var spec = {
code: BIDDER_CODE,
isBidRequestValid: isBidRequestValid,
buildRequests: buildRequests,
interpretResponse: interpretResponse,
getUserSyncs: getUserSyncs
};

registerBidder(spec);

module.exports = spec;

/***/ }),

/***/ 64:
/***/ (function(module, exports) {



/***/ })

},[58]);
121 changes: 121 additions & 0 deletions build/dist/a4gBidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
pbjsChunk([58],{

/***/ 65:
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(66);
module.exports = __webpack_require__(67);


/***/ }),

/***/ 66:
/***/ (function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
value: true
});
exports.spec = undefined;

var _bidderFactory = __webpack_require__(6);

var _utils = __webpack_require__(0);

var utils = _interopRequireWildcard(_utils);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var A4G_BIDDER_CODE = 'a4g';
var A4G_CURRENCY = 'USD';
var A4G_DEFAULT_BID_URL = '//ads.ad4game.com/v1/bid';
var A4G_TTL = 120;

var LOCATION_PARAM_NAME = 'siteurl';
var ID_PARAM_NAME = 'id';
var IFRAME_PARAM_NAME = 'if';
var ZONE_ID_PARAM_NAME = 'zoneId';
var SIZE_PARAM_NAME = 'size';

var ARRAY_PARAM_SEPARATOR = ';';
var ARRAY_SIZE_SEPARATOR = ',';
var SIZE_SEPARATOR = 'x';

var spec = exports.spec = {
code: A4G_BIDDER_CODE,
isBidRequestValid: function isBidRequestValid(bid) {
return bid.params && !!bid.params.zoneId;
},

buildRequests: function buildRequests(validBidRequests) {
var _data;

var deliveryUrl = '';
var bidId = '';
var idParams = [];
var sizeParams = [];
var zoneIds = [];

utils._each(validBidRequests, (function (bid) {
if (!deliveryUrl && typeof bid.params.deliveryUrl === 'string') {
deliveryUrl = bid.params.deliveryUrl;
}
if (!bidId) {
bidId = bid.bidId;
}
idParams.push(bid.placementCode);
sizeParams.push(bid.sizes.map((function (size) {
return size.join(SIZE_SEPARATOR);
})).join(ARRAY_SIZE_SEPARATOR));
zoneIds.push(bid.params.zoneId);
}));

if (!deliveryUrl) {
deliveryUrl = A4G_DEFAULT_BID_URL;
}

return {
method: 'GET',
url: deliveryUrl,
bidId: bidId,
data: (_data = {}, _defineProperty(_data, IFRAME_PARAM_NAME, 0), _defineProperty(_data, LOCATION_PARAM_NAME, utils.getTopWindowUrl()), _defineProperty(_data, SIZE_PARAM_NAME, sizeParams.join(ARRAY_PARAM_SEPARATOR)), _defineProperty(_data, ID_PARAM_NAME, idParams.join(ARRAY_PARAM_SEPARATOR)), _defineProperty(_data, ZONE_ID_PARAM_NAME, zoneIds.join(ARRAY_PARAM_SEPARATOR)), _data)
};
},

interpretResponse: function interpretResponse(serverResponses, request) {
var bidResponses = [];
utils._each(serverResponses.body, (function (response) {
var bidResponse = {
requestId: request.bidId,
cpm: response.cpm,
width: response.width,
height: response.height,
creativeId: response.zoneid,
currency: A4G_CURRENCY,
netRevenue: true,
ttl: A4G_TTL,
ad: response.ad
};
bidResponses.push(bidResponse);
}));

return bidResponses;
}
};

(0, _bidderFactory.registerBidder)(spec);

/***/ }),

/***/ 67:
/***/ (function(module, exports) {



/***/ })

},[65]);
39 changes: 29 additions & 10 deletions build/dist/aardvarkBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
pbjsChunk([109],{
pbjsChunk([126],{

/***/ 44:
/***/ 68:
/***/ (function(module, exports, __webpack_require__) {

module.exports = __webpack_require__(45);
module.exports = __webpack_require__(69);


/***/ }),

/***/ 45:
/***/ 69:
/***/ (function(module, exports, __webpack_require__) {

"use strict";
Expand All @@ -23,11 +23,11 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
*/

var utils = __webpack_require__(0);
var bidfactory = __webpack_require__(3);
var bidfactory = __webpack_require__(4);
var bidmanager = __webpack_require__(2);
var adloader = __webpack_require__(5);
var Adapter = __webpack_require__(7)['default'];
var constants = __webpack_require__(4);
var Adapter = __webpack_require__(9)['default'];
var constants = __webpack_require__(3);
var adaptermanager = __webpack_require__(1);

var AARDVARK_CALLBACK_NAME = 'aardvarkResponse';
Expand All @@ -46,14 +46,24 @@ function requestBids(bidderCode, callbackName, bidReqs) {

ref = ref ? ref.host : DEFAULT_REFERRER;

for (var i = 0, l = bidReqs.length, bid, _ai, _sc, _endpoint; i < l; i += 1) {
var categories = window.rtkcategories || [];
if (!Array.isArray(categories)) {
categories = [];
}

for (var i = 0, l = bidReqs.length, bid, _ai, _sc, _endpoint, _categories; i < l; i += 1) {
bid = bidReqs[i];
_ai = utils.getBidIdParameter('ai', bid.params);
_sc = utils.getBidIdParameter('sc', bid.params);
if (!_ai || !_ai.length || !_sc || !_sc.length) {
continue;
}

_categories = utils.getBidIdParameter('categories', bid.params);
if (_categories && Array.isArray(_categories) && _categories.length) {
categories = categories.concat(_categories);
}

_endpoint = utils.getBidIdParameter('host', bid.params);
if (_endpoint) {
endpoint = _endpoint;
Expand All @@ -76,7 +86,16 @@ function requestBids(bidderCode, callbackName, bidReqs) {
return utils.logWarn('Bad bid request params given for adapter $' + bidderCode + ' (' + AARDVARK_BIDDER_CODE + ')');
}

adloader.loadScript(['//' + endpoint + '/', ai, '/', scs.join('_'), '/aardvark/?jsonp=pbjs.', callbackName, '&rtkreferer=', ref, '&', bidIds.join('&')].join(''));
var categoriesStr = '';
if (categories.length) {
categoriesStr = '&categories=' + categories.filter((function (elem, pos, arr) {
return arr.indexOf(elem) === pos;
})).map((function (c) {
return encodeURIComponent(c);
})).join(',');
}

adloader.loadScript(['//' + endpoint + '/', ai, '/', scs.join('_'), '/aardvark/?jsonp=pbjs.', callbackName, '&rtkreferer=', ref, categoriesStr, '&', bidIds.join('&')].join(''));
}

function registerBidResponse(bidderCode, rawBidResponse) {
Expand Down Expand Up @@ -159,4 +178,4 @@ module.exports = AardvarkAdapter;

/***/ })

},[44]);
},[68]);
Loading