forked from prebid/Prebid.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/prebid/Prebid.js
* 'master' of https://github.com/prebid/Prebid.js: Prebid 1.2.0 Release Use polyfilled includes method (prebid#2061) RockYou Adapter: Added RockYou Adapter supporting Prebid 1.0 (prebid#1977) Optimera Adapter for 1.0. (prebid#1961) Use cross-browser integer check (prebid#2058) Fix skipped test (prebid#2059) Support multiple media formats within a single ad unit (prebid#1991) pre1api module that allows use of deprecated pre1.0 API in Prebid 1.0 (prebid#1976) Colossus SSP header bidding adapter 1.0.0 (prebid#2029) InSkin Bidder Adapter (prebid#2016) Update adapter to prebid v1.0 (prebid#1908) PubMatic 1.0 adapter (prebid#2011)
- Loading branch information
Showing
44 changed files
with
2,977 additions
and
167 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
import { registerBidder } from 'src/adapters/bidderFactory'; | ||
import * as utils from 'src/utils'; | ||
|
||
const BIDDER_CODE = 'colossusssp'; | ||
const URL = '//colossusssp.com/?c=o&m=multi'; | ||
const URL_SYNC = '//colossusssp.com/?c=o&m=cookie'; | ||
|
||
let sizeObj = { | ||
'468x60': 1, | ||
'728x90': 2, | ||
'300x600': 10, | ||
'300x250': 15, | ||
'300x100': 19, | ||
'320x50': 43, | ||
'300x50': 44, | ||
'300x300': 48, | ||
'300x1050': 54, | ||
'970x90': 55, | ||
'970x250': 57, | ||
'1000x90': 58, | ||
'320x80': 59, | ||
'640x480': 65, | ||
'320x480': 67, | ||
'320x320': 72, | ||
'320x160': 73, | ||
'480x300': 83, | ||
'970x310': 94, | ||
'970x210': 96, | ||
'480x320': 101, | ||
'768x1024': 102, | ||
'1000x300': 113, | ||
'320x100': 117, | ||
'800x250': 118, | ||
'200x600': 119 | ||
}; | ||
|
||
utils._each(sizeObj, (item, key) => sizeObj[item] = key); | ||
|
||
export const spec = { | ||
code: BIDDER_CODE, | ||
|
||
/** | ||
* Determines whether or not the given bid request is valid. | ||
* | ||
* @param {object} bid The bid to validate. | ||
* @return boolean True if this is a valid bid, and false otherwise. | ||
*/ | ||
isBidRequestValid: (bid) => { | ||
return (!isNaN(bid.params.placement_id) && | ||
((bid.params.sizes !== undefined && bid.params.sizes.length > 0 && bid.params.sizes.some((sizeIndex) => sizeObj[sizeIndex] !== undefined)) || | ||
(bid.sizes !== undefined && bid.sizes.length > 0 && bid.sizes.map((size) => `${size[0]}x${size[1]}`).some((size) => sizeObj[size] !== undefined)))); | ||
}, | ||
|
||
/** | ||
* Make a server request from the list of BidRequests. | ||
* | ||
* @param {BidRequest[]} validBidRequests A non-empty list of valid bid requests that should be sent to the Server. | ||
* @return ServerRequest Info describing the request to the server. | ||
*/ | ||
buildRequests: (validBidRequests) => { | ||
let winTop = window; | ||
try { | ||
window.top.location.toString(); | ||
winTop = window.top; | ||
} catch (e) { | ||
utils.logMessage(e); | ||
}; | ||
let location = utils.getTopWindowLocation(); | ||
let placements = []; | ||
let request = { | ||
'deviceWidth': winTop.screen.width, | ||
'deviceHeight': winTop.screen.height, | ||
'language': (navigator && navigator.language) ? navigator.language : '', | ||
'secure': location.protocol === 'https:' ? 1 : 0, | ||
'host': location.host, | ||
'page': location.pathname, | ||
'placements': placements | ||
}; | ||
for (let i = 0; i < validBidRequests.length; i++) { | ||
let bid = validBidRequests[i]; | ||
let placement = {}; | ||
placement['placementId'] = bid.params.placement_id; | ||
placement['bidId'] = bid.bidId; | ||
placement['sizes'] = bid.sizes; | ||
placements.push(placement); | ||
} | ||
return { | ||
method: 'POST', | ||
url: URL, | ||
data: request | ||
}; | ||
}, | ||
|
||
/** | ||
* Unpack the response from the server into a list of bids. | ||
* | ||
* @param {*} serverResponse A successful response from the server. | ||
* @return {Bid[]} An array of bids which were nested inside the server. | ||
*/ | ||
interpretResponse: (serverResponse) => { | ||
let response = []; | ||
try { | ||
serverResponse = serverResponse.body; | ||
for (let i = 0; i < serverResponse.length; i++) { | ||
let resItem = serverResponse[i]; | ||
if (resItem.width && !isNaN(resItem.width) && | ||
resItem.height && !isNaN(resItem.height) && | ||
resItem.requestId && typeof resItem.requestId === 'string' && | ||
resItem.cpm && !isNaN(resItem.cpm) && | ||
resItem.ad && typeof resItem.ad === 'string' && | ||
resItem.ttl && !isNaN(resItem.ttl) && | ||
resItem.creativeId && typeof resItem.creativeId === 'string' && | ||
resItem.netRevenue && typeof resItem.netRevenue === 'boolean' && | ||
resItem.currency && typeof resItem.currency === 'string') { | ||
response.push(resItem); | ||
} | ||
} | ||
} catch (e) { | ||
utils.logMessage(e); | ||
}; | ||
return response; | ||
}, | ||
|
||
getUserSyncs: () => { | ||
return [{ | ||
type: 'image', | ||
url: URL_SYNC | ||
}]; | ||
} | ||
}; | ||
|
||
registerBidder(spec); |
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,26 @@ | ||
# Overview | ||
|
||
``` | ||
Module Name: Colossus SSP Bidder Adapter | ||
Module Type: Bidder Adapter | ||
Maintainer: support@colossusmediallc.com | ||
``` | ||
|
||
# Description | ||
|
||
Module that connects to Colossus SSP demand sources | ||
|
||
# Test Parameters | ||
``` | ||
var adUnits = [{ | ||
code: 'placementid_0', | ||
sizes: [[300, 250]], | ||
bids: [{ | ||
bidder: 'colossusssp', | ||
params: { | ||
placement_id: 0 | ||
} | ||
}] | ||
} | ||
]; | ||
``` |
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
Oops, something went wrong.