-
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
Added C1X Adapter #1369
Added C1X Adapter #1369
Conversation
Hi, would you be able to do a review on our adapter this week? Please let me know if you have further questions :) Thank you. |
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.
Thanks for the adapter. I was able to verify bid responses and tests passing. A few changes requested below
modules/c1xBidAdapter.js
Outdated
}, | ||
BIDDER_CODE = 'c1x'; | ||
|
||
var pbjs = window.pbjs; |
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.
The global variable name may be configured by the publisher as something other than pbjs
, so here use window.$$PREBID_GLOBAL$$
instead of window.pbjs
modules/c1xBidAdapter.js
Outdated
bidmanager.addBidResponse(data.adId, bidObject); | ||
} else { | ||
// no bid | ||
utils.logInfo(LOG_MSG.nobid + data.adId); |
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.
Capitalize the b
to LOG_MSG.noBid
to match the case defined on line 25
modules/c1xBidAdapter.js
Outdated
var response = c1xResponse; | ||
|
||
if (typeof c1xResponse === CONSTANTS.objectType_string) { | ||
response = JSON.parse(c1xResponse); |
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.
Please wrap JSON.parse
in a try/catch
block to catch any parsing exceptions. See appnexusAstBidAdapter
or other adapters for examples of this if needed
modules/c1xBidAdapter.js
Outdated
var data = response[i], | ||
bidObject = null; | ||
if (data.bid) { | ||
bidObject = bidfactory.createBid(1); |
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.
Prefer CONSTANTS.STATUS.GOOD
in place of 1
modules/c1xBidAdapter.js
Outdated
}; | ||
|
||
function noBidResponse() { | ||
var bidObject = bidfactory.createBid(2); |
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.
Prefer CONSTANTS.STATUS.NO_BID
in place of 2
@matthewlane Thank you for your review. I've also added a doc for our bidder to update on Prebid website in this repo. Will our adapter be merged soon and be included in your next release? Thanks! |
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.
Hey @CathyHuangtw. Code looks good, except for one small issue in the tests.
Some ESLint PRs have been merged since you last pushed, though, which makes our code style a bit more strict than it was when you last pushed. Once you pull & fix them, we can merge it.
}; | ||
|
||
describe('c1x adapter tests: ', () => { | ||
let pbjs = window.pbjs || {}; |
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.
should use
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.
thanks for the reminder. Already corrected this for the global naming convention.
@dbemiller thank you for taking the time to review my adapter code. I have fixed and pushed the changes. Hope it can get merged soon :) |
* Added C1X Adapter and adapter test file * corrected bidder's params for c1x bidder * code updates after code review from Prebid team * add try/catch block to catch any paring exceptions * fix ESLint errors * use $$PREBID_GLOBAL$$ for the global naming convention
Type of change
Description of change
Note