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

API for bidder parameters #1309

Closed
kcramu opened this issue Jun 19, 2017 · 4 comments
Closed

API for bidder parameters #1309

kcramu opened this issue Jun 19, 2017 · 4 comments

Comments

@kcramu
Copy link

kcramu commented Jun 19, 2017

Question

Please suggest how to programmatically pull all bidder parameters?

Description

As a SSP, I want to programmatically add new bidders for my publishers. I want to know if Prebid.js provides an API to pull the list of bidders and bidder parameters.

@mkendall07
Copy link
Member

Currently no, although this is a great idea!

@aneuway2
Copy link
Contributor

aneuway2 commented Jun 20, 2017

Hey @kcramu while there isn't an API, doesn't pbjs.adUnits give you want you need? That object has the list of bidders and parameters that PBJS uses to run the auction

@iamcarrico
Copy link

I, too, would like this.

My personal use case, is that we build the configuration on the frontend depending on what is available on that page. Would love to be able to get the list of required and optional params from a partner— to see if we actually have that config available.

Some sample code that is kinda what I am going for—

var bids = [];
var bidders = ["appnexus"];

Object.keys(bidders).forEach(bidder => {
  var params = {};
  var allParams = true;
  var bidderParams = prebidInfoforSlot[bidder] || {};
  var defaultBidderParams = prebidSettings.defaultConfig[bidder] || {};

  // Allow us to disable a single slot or partner by configuration.
  if (bidderParams.disabled || defaultBidderParams.disabled) { return; }

  pbjs.bidderParams(bidder).forEach(function(param) {
    var value = bidderParams[param] || false;

    if (!value) {
      value = defaultBidderParams[param] || false;
    }

    if (!value) {
      allParams = false;
    } else {
      params[param] = value;
    }
  });

  if (!allParams) { return; }

  bids.push({ bidder, params });
});

Where I have the variable prebidInfoforSlot set to all the prebid information I know about that slot, and we go into all the params to get everything we need for that bid. If all required params exist, then we will add it to the bids variable.

I dont have on here the difference between required and optional— but I think the general gist is here.

@stale
Copy link

stale bot commented Mar 6, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Mar 6, 2018
@stale stale bot closed this as completed Mar 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants