-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Update adapter to prebid v1.0 #1908
Merged
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a6762af
Update adapter to prebid v1.0
Spacedragoon 2e86861
corrected some things following pullrequest review
Spacedragoon 35b3ec6
slight change to avoid potential error
Spacedragoon aea62dc
added the maintainer email
Spacedragoon 33aad90
merged master to resolve conflict
Spacedragoon fea1e24
Updated the tests to fit changes
Spacedragoon 55056e7
Updated the doc, removed the bidderCode, added adUrl
Spacedragoon cd90cc8
fix adapter
Spacedragoon 9e3a814
Added try catch around JSON.parse
Spacedragoon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,15 +31,12 @@ export const spec = { | |
// to find which one the ad server needs | ||
|
||
// pull requested transaction ID from bidderRequest.bids[].transactionId | ||
if (!Array.isArray(validBidRequests)) { | ||
validBidRequests = [validBidRequests]; | ||
} | ||
var bid = validBidRequests[0]; | ||
const payload = { | ||
siteid: bid.params.siteId, | ||
pageid: bid.params.pageId, | ||
formatid: bid.params.formatId, | ||
currencyCode: config.getConfig('currency'), | ||
currencyCode: config.getConfig('currency').adServerCurrency, | ||
bidfloor: bid.params.bidfloor || 0.0, | ||
targeting: bid.params.target && bid.params.target != '' ? bid.params.target : undefined, | ||
tagId: bid.adUnitCode, | ||
|
@@ -66,28 +63,25 @@ export const spec = { | |
*/ | ||
interpretResponse: function (serverResponse, bidRequest) { | ||
const bidResponses = []; | ||
if (serverResponse) { | ||
var response = serverResponse.body; | ||
if (response) { | ||
const bidResponse = { | ||
requestId: bidRequest.bidId, | ||
bidderCode: spec.code, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
cpm: serverResponse.cpm, | ||
width: serverResponse.width, | ||
height: serverResponse.height, | ||
creativeId: serverResponse.creativeId, | ||
dealId: serverResponse.dealId, | ||
currency: serverResponse.currency, | ||
netRevenue: serverResponse.isNetCpm, | ||
ttl: serverResponse.ttl, | ||
cpm: response.cpm, | ||
width: response.width, | ||
height: response.height, | ||
creativeId: response.creativeId, | ||
dealId: response.dealId, | ||
currency: response.currency, | ||
netRevenue: response.isNetCpm, | ||
ttl: response.ttl, | ||
referrer: utils.getTopWindowUrl(), | ||
ad: serverResponse.ad | ||
ad: response.ad | ||
}; | ||
bidResponses.push(bidResponse); | ||
} | ||
return bidResponses; | ||
}, | ||
getUserSyncs: function (syncOptions) { | ||
// iframe || image | ||
return undefined; | ||
} | ||
} | ||
registerBidder(spec); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use
config.getConfig('currency.adServerCurency')
since the config module does safe deep access. The way you have it here if currency hasn't been set then it will throw "can't read adServerCurrency of undefined" error.