-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 github.com:prebid/Prebid.js into translation…
…-module
- Loading branch information
Showing
70 changed files
with
7,699 additions
and
970 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import * as utils from '../src/utils'; | ||
import {registerBidder} from '../src/adapters/bidderFactory'; | ||
|
||
const BIDDER_CODE = 'admedia'; | ||
const ENDPOINT_URL = '//prebid.admedia.com/bidder/'; | ||
|
||
export const spec = { | ||
code: BIDDER_CODE, | ||
|
||
isBidRequestValid: function (bid) { | ||
return bid.params && !!bid.params.aid; | ||
}, | ||
|
||
buildRequests: function (validBidRequests, bidderRequest) { | ||
let payload = {}; | ||
|
||
if (bidderRequest && bidderRequest.refererInfo) { | ||
payload.referer = encodeURIComponent(bidderRequest.refererInfo.referer); | ||
} | ||
|
||
payload.tags = []; | ||
|
||
utils._each(validBidRequests, function (bid) { | ||
const tag = { | ||
id: bid.bidId, | ||
sizes: bid.sizes, | ||
aid: bid.params.aid | ||
}; | ||
payload.tags.push(tag); | ||
}); | ||
|
||
const payloadString = JSON.stringify(payload); | ||
return { | ||
method: 'POST', | ||
url: ENDPOINT_URL, | ||
data: payloadString, | ||
}; | ||
}, | ||
|
||
interpretResponse: function (serverResponse, bidRequest) { | ||
const bidResponses = []; | ||
|
||
if (!serverResponse.body.tags) { | ||
return bidResponses; | ||
} | ||
|
||
utils._each(serverResponse.body.tags, function (response) { | ||
if (!response.error && response.cpm > 0) { | ||
const bidResponse = { | ||
requestId: response.id, | ||
cpm: response.cpm, | ||
width: response.width, | ||
height: response.height, | ||
creativeId: response.id, | ||
dealId: response.id, | ||
currency: 'USD', | ||
netRevenue: true, | ||
ttl: 120, | ||
// referrer: REFERER, | ||
ad: response.ad | ||
}; | ||
|
||
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,42 @@ | ||
# Overview | ||
|
||
``` | ||
Module Name: Admedia Bidder Adapter | ||
Module Type: Bidder Adapter | ||
Maintainer: developers@admedia.com | ||
``` | ||
|
||
# Description | ||
|
||
Admedia Bidder Adapter for Prebid.js. | ||
Only Banner format is supported. | ||
|
||
# Test Parameters | ||
``` | ||
var adUnits = [ | ||
{ | ||
code: 'test-div-0', | ||
sizes: [[300, 250]], // a display size | ||
bids: [ | ||
{ | ||
bidder: 'admedia', | ||
params: { | ||
aid: 86858 | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
code: 'test-div-1', | ||
sizes: [[300, 50]], // a mobile size | ||
bids: [ | ||
{ | ||
bidder: 'admedia', | ||
params: { | ||
aid: 86858 | ||
} | ||
} | ||
] | ||
} | ||
]; | ||
``` |
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.