Prebid.js icon indicating copy to clipboard operation
Prebid.js copied to clipboard

Compiler UI for selectively choosing embedded adaptors

Open ghost opened this issue 11 years ago • 6 comments

As a publisher, I'd like to have prebid.js only include required bidder adaptors, so that I don't have to load up adaptors that are not relevant to me.

*Note that today prebid.js is only 15KB, so this has not become a concern yet. But please leave your comments if you think otherwise or see other problems. Thanks!

ghost avatar Dec 01 '15 23:12 ghost

I'm already doing this which has reduced my prebid.min.js to 9k gzipped. In the end every byte that needs to be loaded for header bidding makes the display of creatives slower which results in a worse user experience and lower revenue.

Besides that size is not the only argument. Parsing and running prebid.js takes quite a bit of time, removing redundant code helps with keeping the pages fast (or helps with reducing the slowdown).

BartVB avatar Dec 05 '15 05:12 BartVB

I've done a similar thing on my branch -- I added gulp-preprocess and changed my src/adaptermanager to look like this:

/* @ifndef excludes.rubicon */
var RubiconAdapter = require('./adapters/rubicon.js');
this.registerBidAdapter(RubiconAdapter(), 'rubicon');
/* @endif */
/* @ifndef excludes.appnexus */
var AppNexusAdapter = require('./adapters/appnexus.js');
this.registerBidAdapter(AppNexusAdapter(), 'appnexus');
/* @endif */
/* @ifndef excludes.openx */
var OpenxAdapter = require('./adapters/openx');
this.registerBidAdapter(OpenxAdapter(), 'openx');
/* @endif */
/* @ifndef excludes.pubmatic */
var PubmaticAdapter = require('./adapters/pubmatic.js');
this.registerBidAdapter(PubmaticAdapter(), 'pubmatic');
/* @endif */

in my gulpfile I added a preprocess task as the first dependency to build-dev, which does something like:

preprocess({
  excludes: {
    index: true,
    rubicon: true
  }
});

Not sure if this is the best way to do this, but would make it pretty easy to add a web UI to download a custom bundle, just need to set the excludes with query/form params from the client

nickjacob avatar Jan 11 '16 18:01 nickjacob

Thanks for the idea @nickjacob . I think that's a good solution because it will omit the adapter sources if browserify doesn't see the require statement.

mkendall07 avatar Jan 11 '16 19:01 mkendall07

Small suggestion; I would prefer a config with 'include' instead of 'exclude'. Easier to work with without the negation.

BartVB avatar Jan 12 '16 08:01 BartVB

PR #220 provides for an adapters array in package.json to specify what adapters will be built.

protonate avatar Feb 26 '16 22:02 protonate

#220 was merged and released with Prebid 0.7.0. Closing.

protonate avatar Mar 24 '16 22:03 protonate