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

amazon adapter: bid on a slot-level #39

Closed
wants to merge 1 commit into from
Closed

Conversation

nickjacob
Copy link
Collaborator

re-structuring amazon adapter to allow integration w/ prebid line items + creative rendering. By default this uses the existing amznslots k-v pair, but if the user overrides the adserverTargeting (to use the default), it can use a CPM.

In order to do this, I added a callback system so that the publisher can modify the bid after it's created (so they can add site-specific/proprietary information).

On the publisher side, the integration with amazon would require something like:

pbjs.bidderSettings = {
  amazon: {
    // override the bidder settings
    usesGenericKeys: true,
  }
};

pbjs.que.push(function () {

  pbjs.events.on('beforeAddBidResponse', function (code, bidResponse) {
    if (!bidResponse || bidResponse.bidderCode !== 'amazon') return;
    // ....code to generate an actual CPM....
    bidResponse.cpm = cpm;
  });

});

I know that exposing this functionality to publishers is a challenge; by using callbacks I wanted to add flexibility without affecting the current architecture—in our integration (@ aplus), we really want to be able to serve amazon through the same line items/creatives.

this uses the following algorithm (the current one selects the first unit bidded on):

  1. Sort the bids by size
  2. for each size
    1. order the bids for that size by bid - take the highest
    2. pick a unit (random) from available units for that size (remove from further amazon bidding)
    3. register bid on that unit @ the size

A callback could be added there (at step 3) to give the publisher more control. As far as I know the above is the same logic as DFP when the keys are set as page targeting. Feedback on this approach would be great. thanks!

@mkendall07
Copy link
Member

This looks like a promising approach. I'd like to get @Heray feedback on this before approving the PR.

}
};

exports.events = (function (){
Copy link
Member

Choose a reason for hiding this comment

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

I like this approach to the event handling. Did you write this yourself or get it from another library?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

wrote it myself; based on node.js EventEmitter api (use a similar but more object-oriented impl. on aplus)

Copy link
Member

Choose a reason for hiding this comment

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

Awesome! I think we can probably extend this to use for all the event handling in prebid.js if we tweak it a bit. I'll play with it a bit...

Copy link

Choose a reason for hiding this comment

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

You guys are badass

@nickjacob nickjacob closed this Oct 8, 2015
@protonate protonate deleted the amazon-slot-level branch March 24, 2016 22:33
Walexander pushed a commit to MbidIO/Prebid.js that referenced this pull request Mar 6, 2017
mp-12301 pushed a commit to aol/Prebid.js that referenced this pull request Apr 10, 2017
…ebid-official-0.19.0 to release/1.14.0

* commit 'b13f7ba7ee8b3c168dc0af7c8bfc94747d017e70': (34 commits)
  Add changelog entry.
  Prebid 0.19.0 Release
  check truthiness of adUnitCode (prebid#990)
  fixed exception when refreshing individual Ad Units and bidder responds slowly (prebid#989)
  Stub pixel drop to prevent network request in test (prebid#988)
  Updating Komoona adapter to support future Prebid requirements (prebid#974)
  Use stable version of Chrome (prebid#984)
  Revert to running browser tests in Travis (prebid#983)
  Fix issue with appnexusAst sending `user` object in the wrong place. (prebid#980)
  Integrate Browserstack tests into Travis CI build (prebid#839)
  Add StickyAdsTV Bidder adapter (prebid#916)
  Stronger xdomain checks (prebid#971)
  added matomy as an alias for appnexus (prebid#850)
  Added 152Media Appnexus Alias (prebid#952)
  OpenX Adapter: Handles fallback ads correctly as a no fill (prebid#39) (prebid#963)
  Use package dependencies for ES6 Array shims (prebid#962)
  Make x-domain safe frame example work out of the box (prebid#955)
  added usersync for adkernel adapter (prebid#951)
  Rubicon adapter: add a floor variable (prebid#964)
  Added Lifestreet adapter. (prebid#965)
  ...
mp-12301 pushed a commit to aol/Prebid.js that referenced this pull request Apr 10, 2017
…14.0 to master

* commit 'c008f3f531ae3409f4a16bf03470d84e82aead0e': (35 commits)
  Add adapters in aolPartnersIds.json.
  Add changelog entry.
  Prebid 0.19.0 Release
  check truthiness of adUnitCode (prebid#990)
  fixed exception when refreshing individual Ad Units and bidder responds slowly (prebid#989)
  Stub pixel drop to prevent network request in test (prebid#988)
  Updating Komoona adapter to support future Prebid requirements (prebid#974)
  Use stable version of Chrome (prebid#984)
  Revert to running browser tests in Travis (prebid#983)
  Fix issue with appnexusAst sending `user` object in the wrong place. (prebid#980)
  Integrate Browserstack tests into Travis CI build (prebid#839)
  Add StickyAdsTV Bidder adapter (prebid#916)
  Stronger xdomain checks (prebid#971)
  added matomy as an alias for appnexus (prebid#850)
  Added 152Media Appnexus Alias (prebid#952)
  OpenX Adapter: Handles fallback ads correctly as a no fill (prebid#39) (prebid#963)
  Use package dependencies for ES6 Array shims (prebid#962)
  Make x-domain safe frame example work out of the box (prebid#955)
  added usersync for adkernel adapter (prebid#951)
  Rubicon adapter: add a floor variable (prebid#964)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants