Skip to content

Releases: prebid/Prebid.js

Major API Updates for Refreshing Ad Units

24 Aug 23:32
Compare
Choose a tag to compare

In the new API, we've made the below changes to better support the refresh functionality. Note that this new API has introduced a few breaking changes:

Breaking Changes

Change 1: A command queue

Now all pbjs commands should be wrapped by pbjs.que.push. This ensures pbjs commands are in scope and are executed in the right order. Example:

pbjs.que.push(function() {
   pbjs.setTargetingForGPTAsync();
});
Change 2: Add ad units

Instead of directly pushing objects into the pbjs.adUnits array (as in the previous versions), the new API requires the function pbjs.addAdUnits(adUnits). Example:

var adUnits = [{
        code: '/9968336/header-bid-tag-0',
        sizes: [[300, 250], [300, 600]],
        bids: [{
            bidder: 'appnexus',
            params: { placementId: 'TO ADD' }
        }]
}];
pbjs.addAdUnits(adUnits);
Change 3: Request bids

Previously, prebid.js automatically sends out bid requests as soon as the library loads. This isn't needed for many sites. The new API requires the page to explicit call pbjs.requestBids to send out bid requests. Example:

pbjs.requestBids({
    bidsBackHandler: function(bidResponses) { }
});
Change 4: Bids back callback

The callback when requested bids are returned are now in pbjs.requestBids (as in the above example). No more pbjs.registerBidCallbackHandler()

Deprecated Functions

1. Function getAdserverTargetingParamsForAdUnit(adUnitCode)

It's now split into getAdserverTargeting() and getAdserverTargetingForAdUnitCode([adunitCode])
Find out docs here

2. Function requestBidsForAdUnit(adUnitCode)

It's now requestBids()

3. Function registerBidCallbackHandler()

It's now a callback within the requestBids()

New Features

1. Request selected array of bids
pbjs.requestBids({
    adUnitCodes: ['/99336/slot-0'],
    bidsBackHandler: function() {
        pbjs.setTargetingForGPTAsync(['/99336/slot-0']);
        googletag.pubads().refresh([slotObj]); 
    }
});

See docs for pbjs.requestBids()
http://prebid.org/publisher-api.html#function-reference

2. New callback functionality (more events will be added)

A new callback when all bids are back for individual ad units:

pbjs.addCallback('adUnitBidsBack', function(adUnitCode){
       console.log('ad unit bids back for : ' + adUnitCode);
});

Version 0.2.1 - Many bug fixes

13 Aug 02:10
Compare
Choose a tag to compare
Pre-release

Bug story fixes:

  • pbjs.getBidResponses returns String not Object
  • OpenX - jstag always loads
  • hasOwn not defined problem
  • Updated the price map: pbLg, pbMg
  • The below Rubicon creative doesn't serve.
  • Remove empty bids in targeting params
  • Refresh API call for Prebid.js
  • Prebid.js Loops
  • Implement per ad unit: pbjs.requestBidsForAdUnit( code )

First Release

06 Aug 22:37
Compare
Choose a tag to compare
First Release Pre-release
Pre-release

Bidders supported:

  • AppNexus
  • OpenX
  • Pubmatic
  • Rubicon
  • Amazon (not well)
  • Criteo (not well)

Ad server supported:

  • GPT
  • Custom

API functions supported (docs here):

  • setTargetingForGPTAsync()
  • getAdserverTargetingParamsForAdUnit(adUnitCode)
  • requestBidsForAdUnit()
  • registerBidCallbackHandler()

The script is decently tested and live. However, we'll call this a pre-release due to limited amount of testing done.