Skip to content
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

Merged
merged 6 commits into from
Aug 4, 2017
Merged

Added C1X Adapter #1369

merged 6 commits into from
Aug 4, 2017

Conversation

CathyHuangtw
Copy link
Contributor

@CathyHuangtw CathyHuangtw commented Jul 11, 2017

Type of change

  • New bidder adapter

Description of change

  • test parameters for validating bids
{
  bidder: 'c1x'
}

Note

  • test ad unit
var adUnits = [
    {
         code: 'div-gpt-ad-1498193081995-0',
         sizes: [[300, 250], [300, 600]],
         bids: [
             {
                      bidder: 'c1x',
                      params: {
                          siteId: '999'
                      }
              }
         ]
    }
];

@CathyHuangtw
Copy link
Contributor Author

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.

@matthewlane matthewlane self-assigned this Jul 18, 2017
Copy link
Collaborator

@matthewlane matthewlane left a 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

},
BIDDER_CODE = 'c1x';

var pbjs = window.pbjs;
Copy link
Collaborator

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

bidmanager.addBidResponse(data.adId, bidObject);
} else {
// no bid
utils.logInfo(LOG_MSG.nobid + data.adId);
Copy link
Collaborator

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

var response = c1xResponse;

if (typeof c1xResponse === CONSTANTS.objectType_string) {
response = JSON.parse(c1xResponse);
Copy link
Collaborator

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

var data = response[i],
bidObject = null;
if (data.bid) {
bidObject = bidfactory.createBid(1);
Copy link
Collaborator

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

};

function noBidResponse() {
var bidObject = bidfactory.createBid(2);
Copy link
Collaborator

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
matthewlane previously approved these changes Jul 20, 2017
@CathyHuangtw
Copy link
Contributor Author

@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!

Copy link
Contributor

@dbemiller dbemiller left a 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 || {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should use $$PREBID_GLOBAL$$ too.

Copy link
Contributor Author

@CathyHuangtw CathyHuangtw Aug 4, 2017

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.

@CathyHuangtw
Copy link
Contributor Author

@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 :)

@dbemiller dbemiller merged commit 1a1028c into prebid:master Aug 4, 2017
philipwatson pushed a commit to mbrtargeting/Prebid.js that referenced this pull request Sep 18, 2017
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants