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:
Installation
Clone and build from the Stackpop fork:
git clone https://github.com/stackpop/Prebid.js.git
cd Prebid.js
npm install
gulp build --modules=mocktioneerBidAdapterThe built prebid.js will include the Mocktioneer adapter.
Configuration
Basic Setup
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/auctionLocal Development
Point to your local Mocktioneer instance:
params: {
endpoint: 'http://localhost:8787/openrtb2/auction'
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
endpoint | string | No | Custom auction endpoint URL |
bid | float | No | Override bid price (CPM) |
Price Override
Force a specific bid price for testing:
bids: [
{
bidder: 'mocktioneer',
params: {
bid: 5.0, // Force $5.00 CPM
},
},
]The price override is passed via imp[].ext.mocktioneer.bid in the OpenRTB request.
Example Page
Full HTML Example (click to expand)
<!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
pbjs.setConfig({
debug: true,
})Check Bid Responses
Open browser console and look for:
Prebid Debug: Bids Received for mocktioneerInspect 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
var adUnits = [
{
code: 'header-banner',
mediaTypes: {
banner: {
sizes: [
[728, 90],
[970, 250],
],
},
},
bids: [
{
bidder: 'mocktioneer',
params: { bid: 3.0 },
},
],
},
{
code: 'sidebar',
mediaTypes: {
banner: {
sizes: [
[300, 250],
[300, 600],
],
},
},
bids: [
{
bidder: 'mocktioneer',
params: { bid: 2.0 },
},
],
},
{
code: 'mobile-banner',
mediaTypes: {
banner: {
sizes: [
[320, 50],
[320, 100],
],
},
},
bids: [
{
bidder: 'mocktioneer',
params: { bid: 1.5 },
},
],
},
]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.
High CPM Testing
Test price floor logic:
params: {
bid: 100.0 // $100 CPM
}Multiple Bidders
Compare Mocktioneer with other bidders:
bids: [
{
bidder: 'mocktioneer',
params: { bid: 2.0 },
},
{
bidder: 'appnexus',
params: { placementId: '12345' },
},
]GAM Integration
Send Mocktioneer bids to Google Ad Manager:
pbjs.que.push(function () {
pbjs.setConfig({
priceGranularity: 'dense',
})
pbjs.addAdUnits(adUnits)
pbjs.requestBids({
bidsBackHandler: function () {
pbjs.setTargetingForGPTAsync()
googletag.pubads().refresh()
},
})
})Troubleshooting
No Bids Returned
- Check endpoint is accessible
- Verify ad unit sizes are standard
- Enable Prebid debug mode
- Check browser console for errors
Creative Not Rendering
- Verify iframe src URL is correct
- Check for CORS issues (shouldn't occur with Mocktioneer)
- Ensure creative size matches ad unit
Timeout Issues
pbjs.setConfig({
bidderTimeout: 3000, // Increase timeout
})For local development, ensure Mocktioneer is running before requesting bids.