Skip to content

Prebid.js Integration ​

Mocktioneer works with Prebid.js for client-side header bidding integration.

Fork Required

The Mocktioneer adapter is not yet merged into upstream Prebid.js. Use the Stackpop fork:

github.com/stackpop/Prebid.js

Push the config first

Mocktioneer's auction endpoint (/openrtb2/auction) only returns bids after the typed config has been pushed once (mocktioneer-cli config push --adapter <name>). Do this before pointing Prebid.js at your Mocktioneer instance, or the adapter will see errors instead of bids. See Configuration › Typed App Config.

Installation ​

Clone and build from the Stackpop fork:

bash
git clone https://github.com/stackpop/Prebid.js.git
cd Prebid.js
npm install
gulp build --modules=mocktioneerBidAdapter

The built prebid.js will include the Mocktioneer adapter.

Configuration ​

Basic Setup ​

javascript
var adUnits = [
  {
    code: 'div-banner-1',
    mediaTypes: {
      banner: {
        sizes: [
          [300, 250],
          [320, 50],
        ],
      },
    },
    bids: [
      {
        bidder: 'mocktioneer',
        params: {
          // Optional: custom endpoint
          endpoint: 'https://mocktioneer.edgecompute.app/openrtb2/auction',
        },
      },
    ],
  },
]

Default Endpoint ​

If no endpoint is specified, the adapter uses:

https://mocktioneer.edgecompute.app/openrtb2/auction

Local Development ​

Point to your local Mocktioneer instance:

javascript
params: {
  endpoint: 'http://localhost:8787/openrtb2/auction'
}

Parameters ​

ParameterTypeRequiredDescription
endpointstringNoCustom auction endpoint URL

Mocktioneer returns a default bid price of $0.20 CPM (configurable via bid_cpm in mocktioneer.toml).

Example Page ​

Full HTML Example (click to expand)
html
<!DOCTYPE html>
<html>
  <head>
    <script src="prebid.js"></script>
    <script>
      var adUnits = [
        {
          code: 'div-banner',
          mediaTypes: { banner: { sizes: [[300, 250]] } },
          bids: [
            {
              bidder: 'mocktioneer',
              params: { endpoint: 'http://localhost:8787/openrtb2/auction' },
            },
          ],
        },
      ]

      var pbjs = pbjs || {}
      pbjs.que = pbjs.que || []
      pbjs.que.push(function () {
        pbjs.addAdUnits(adUnits)
        pbjs.requestBids({
          bidsBackHandler: function () {
            var winner = pbjs.getHighestCpmBids('div-banner')[0]
            if (winner)
              pbjs.renderAd(document.getElementById('div-banner'), winner.adId)
          },
          timeout: 1000,
        })
      })
    </script>
  </head>
  <body>
    <div id="div-banner" style="width:300px;height:250px;"></div>
  </body>
</html>

Debugging ​

Enable Prebid Debug ​

javascript
pbjs.setConfig({
  debug: true,
})

Check Bid Responses ​

Open browser console and look for:

Prebid Debug: Bids Received for mocktioneer

Inspect Network Requests ​

In DevTools Network tab, filter for openrtb2/auction:

  • Request payload shows OpenRTB bid request
  • Response shows bid with creative URL

Multiple Ad Units ​

javascript
var adUnits = [
  {
    code: 'header-banner',
    mediaTypes: {
      banner: {
        sizes: [
          [728, 90],
          [970, 250],
        ],
      },
    },
    bids: [
      {
        bidder: 'mocktioneer',
        params: {},
      },
    ],
  },
  {
    code: 'sidebar',
    mediaTypes: {
      banner: {
        sizes: [
          [300, 250],
          [300, 600],
        ],
      },
    },
    bids: [
      {
        bidder: 'mocktioneer',
        params: {},
      },
    ],
  },
  {
    code: 'mobile-banner',
    mediaTypes: {
      banner: {
        sizes: [
          [320, 50],
          [320, 100],
        ],
      },
    },
    bids: [
      {
        bidder: 'mocktioneer',
        params: {},
      },
    ],
  },
]

Testing Scenarios ​

No Bid Response ​

Mocktioneer returns a bid for valid banner impressions (non-standard sizes are coerced to 300x250). If you need a no-bid path, filter it on the client side or use the mediation endpoint with a price_floor above the bids you send.

Multiple Bidders ​

Compare Mocktioneer with other bidders:

javascript
bids: [
  {
    bidder: 'mocktioneer',
    params: {},
  },
  {
    bidder: 'appnexus',
    params: { placementId: '12345' },
  },
]

GAM Integration ​

Send Mocktioneer bids to Google Ad Manager:

javascript
pbjs.que.push(function () {
  pbjs.setConfig({
    priceGranularity: 'dense',
  })

  pbjs.addAdUnits(adUnits)

  pbjs.requestBids({
    bidsBackHandler: function () {
      pbjs.setTargetingForGPTAsync()
      googletag.pubads().refresh()
    },
  })
})

Troubleshooting ​

No Bids Returned ​

  1. Check endpoint is accessible
  2. Verify ad unit sizes are standard
  3. Enable Prebid debug mode
  4. Check browser console for errors

Creative Not Rendering ​

  1. Verify iframe src URL is correct
  2. Check for CORS issues (shouldn't occur with Mocktioneer)
  3. Ensure creative size matches ad unit

Timeout Issues ​

javascript
pbjs.setConfig({
  bidderTimeout: 3000, // Increase timeout
})

For local development, ensure Mocktioneer is running before requesting bids.

Built with EdgeZero