This repository was archived by the owner on Feb 13, 2021. It is now read-only.
forked from prebid/Prebid.js
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request prebid#88 in AOLP_ADS_JS/prebid.js from release/1.…
…18.0 to aolgithub-master * commit '2881f03dd76bfcf484fbfeaf0f9e1000b383d20d': Added adapters in aolPartnersIds.json. Added changelog entry. Prebid 0.20.0 Release Remove test that intermittently fails unit tests (prebid#1020) Create bids for requests without mutating ad units (prebid#1019) Use optimize js to improve parse time (https://github.com/nolanlawson/optimize-js) (prebid#1018) Fixes for Centro adapter (prebid#992) adbund adapter (prebid#932) Fix bug with supporting non-cpm dealId bids. (prebid#1006) Added referrer parameter (prebid#966) Support Video for GetIntent adapter (prebid#987) Currency support for SmartAdServer adapter (prebid#979) Deal support for SmartAdServer adapter (prebid#978) Skip test causing build failures (prebid#997) E2etest concurrency (prebid#982) Add ThoughtLeadr adapter (prebid#894) Increment Pre Version
- Loading branch information
Showing
29 changed files
with
677 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
var CONSTANTS = require('../constants.json'); | ||
var utils = require('../utils.js'); | ||
var bidfactory = require('../bidfactory.js'); | ||
var bidmanager = require('../bidmanager.js'); | ||
var adloader = require('../adloader'); | ||
|
||
var adBundAdapter = function adBundAdapter() { | ||
var timezone = (new Date()).getTimezoneOffset(); | ||
var bidAPIs = [ | ||
'http://us-east-engine.adbund.xyz/prebid/ad/get', | ||
'http://us-west-engine.adbund.xyz/prebid/ad/get' | ||
]; | ||
//Based on the time zone to select the interface to the server | ||
var bidAPI = bidAPIs[timezone < 0 ? 0 : 1]; | ||
|
||
function _stringify(param) { | ||
var result = []; | ||
var key; | ||
for (key in param) { | ||
if (param.hasOwnProperty(key)) { | ||
result.push(key + '=' + encodeURIComponent(param[key])); | ||
} | ||
} | ||
return result.join('&'); | ||
} | ||
|
||
function _createCallback(bid) { | ||
return function (data) { | ||
var response; | ||
if (data && data.cpm) { | ||
response = bidfactory.createBid(CONSTANTS.STATUS.GOOD); | ||
response.bidderCode = 'adbund'; | ||
Object.assign(response, data); | ||
} else { | ||
response = bidfactory.createBid(CONSTANTS.STATUS.NO_BID); | ||
response.bidderCode = 'adbund'; | ||
} | ||
bidmanager.addBidResponse(bid.placementCode, response); | ||
}; | ||
} | ||
|
||
function _requestBids(bid) { | ||
var info = { | ||
referrer: utils.getTopWindowUrl(), | ||
domain: utils.getTopWindowLocation().hostname, | ||
ua: window.navigator.userAgent | ||
}; | ||
var param = Object.assign({}, bid.params, info); | ||
param.sizes = JSON.stringify(param.sizes || bid.sizes); | ||
param.callback = '$$PREBID_GLOBAL$$.adbundResponse'; | ||
$$PREBID_GLOBAL$$.adbundResponse = _createCallback(bid); | ||
adloader.loadScript(bidAPI + '?' + _stringify(param)); | ||
} | ||
|
||
function _callBids(params) { | ||
(params.bids || []).forEach(function (bid) { | ||
_requestBids(bid); | ||
}); | ||
} | ||
|
||
return { | ||
callBids: _callBids | ||
}; | ||
}; | ||
|
||
module.exports = adBundAdapter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.