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 pull request #21 from prebid/master
Update remote fork
- Loading branch information
Showing
73 changed files
with
5,362 additions
and
2,525 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import {registerBidder} from '../src/adapters/bidderFactory.js'; | ||
import {BANNER} from '../src/mediaTypes.js'; | ||
|
||
const BIDDER_CODE = 'biddo'; | ||
const ENDPOINT_URL = 'https://ad.adopx.net/delivery/impress'; | ||
|
||
export const spec = { | ||
code: BIDDER_CODE, | ||
supportedMediaTypes: [BANNER], | ||
/** | ||
* Determines whether or not the given bid request is valid. | ||
* | ||
* @param {BidRequest} bidRequest The bid request params to validate. | ||
* @return boolean True if this is a valid bid request, and false otherwise. | ||
*/ | ||
isBidRequestValid: function(bidRequest) { | ||
return !!bidRequest.params.zoneId; | ||
}, | ||
/** | ||
* Make a server request from the list of BidRequests. | ||
* | ||
* @param {Array<BidRequest>} validBidRequests an array of bid requests | ||
* @return ServerRequest Info describing the request to the server. | ||
*/ | ||
buildRequests: function(validBidRequests) { | ||
let serverRequests = []; | ||
|
||
validBidRequests.forEach(bidRequest => { | ||
const sizes = bidRequest.mediaTypes.banner.sizes; | ||
|
||
sizes.forEach(([width, height]) => { | ||
bidRequest.params.requestedSizes = [width, height]; | ||
|
||
const payload = { | ||
ctype: 'div', | ||
pzoneid: bidRequest.params.zoneId, | ||
width, | ||
height, | ||
}; | ||
|
||
const payloadString = Object.keys(payload).map(k => k + '=' + encodeURIComponent(payload[k])).join('&'); | ||
|
||
serverRequests.push({ | ||
method: 'GET', | ||
url: ENDPOINT_URL, | ||
data: payloadString, | ||
bidderRequest: bidRequest, | ||
}); | ||
}); | ||
}); | ||
|
||
return serverRequests; | ||
}, | ||
/** | ||
* Unpack the response from the server into a list of bids. | ||
* | ||
* @param {ServerResponse} serverResponse A successful response from the server. | ||
* @param {BidRequest} bidderRequest A matched bid request for this response. | ||
* @return Array<BidResponse> An array of bids which were nested inside the server. | ||
*/ | ||
interpretResponse: function(serverResponse, {bidderRequest}) { | ||
const response = serverResponse.body; | ||
const bidResponses = []; | ||
|
||
if (response && response.template && response.template.html) { | ||
const {bidId} = bidderRequest; | ||
const [width, height] = bidderRequest.params.requestedSizes; | ||
|
||
const bidResponse = { | ||
requestId: bidId, | ||
cpm: response.hb.cpm, | ||
creativeId: response.banner.hash, | ||
currency: 'USD', | ||
netRevenue: response.hb.netRevenue, | ||
ttl: 600, | ||
ad: response.template.html, | ||
mediaType: 'banner', | ||
meta: { | ||
advertiserDomains: response.hb.adomains || [], | ||
}, | ||
width, | ||
height, | ||
}; | ||
|
||
bidResponses.push(bidResponse); | ||
} | ||
|
||
return bidResponses; | ||
}, | ||
} | ||
|
||
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,30 @@ | ||
# Overview | ||
|
||
``` | ||
Module Name: Biddo Bidder Adapter | ||
Module Type: Bidder Adapter | ||
Maintainer: [email protected] | ||
``` | ||
|
||
# Description | ||
|
||
Module that connects to Invamia demand sources. | ||
|
||
# Test Parameters | ||
|
||
``` | ||
const adUnits = [{ | ||
code: 'test-div', | ||
mediaTypes: { | ||
banner: { | ||
sizes: [[300, 250]], | ||
}, | ||
}, | ||
bids: [{ | ||
bidder: 'biddo', | ||
params: { | ||
zoneId: 7254, | ||
}, | ||
}], | ||
}]; | ||
``` |
Oops, something went wrong.