prebid / Prebid.js

Setup and manage header bidding advertising partners without writing code or confusing line items. Prebid.js is open source and free.
https://docs.prebid.org
Apache License 2.0
1.33k stars 2.08k forks source link

Compiler UI for selectively choosing embedded adaptors #121

Closed prebid closed 8 years ago

prebid commented 8 years ago

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!

BartVB commented 8 years ago

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).

nickjacob commented 8 years ago

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

mkendall07 commented 8 years ago

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.

BartVB commented 8 years ago

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

protonate commented 8 years ago

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

protonate commented 8 years ago

220 was merged and released with Prebid 0.7.0. Closing.