/find

[TEST] Code-heavy post: Prebid.js ad unit examples

Sharad Yadav
Founder, BidCliq
· Updated

This post checks code block styling. The second block has a very long line that should scroll horizontally rather than break the layout.

Basic ad unit

const adUnits = [{
  code: 'div-gpt-ad-top',
  mediaTypes: { banner: { sizes: [[300, 250], [728, 90]] } },
  bids: [{ bidder: 'appnexus', params: { placementId: 13144370 } }]
}];

A very long line

pbjs.que.push(function() { pbjs.addAdUnits(adUnits); pbjs.requestBids({ bidsBackHandler: initAdserver, timeout: PREBID_TIMEOUT, labels: ['desktop', 'above-the-fold', 'test-label-to-make-this-line-very-long'] }); });

Shell example

npm install prebid.js --save
gulp build --modules=appnexusBidAdapter,rubiconBidAdapter

Inline code like pbjs.getHighestCpmBids() should also be readable inside a sentence.

Sharad Yadav

About the author

Founder, BidCliq

Sharad Yadav is the founder of BidCliq, a publisher-first ad monetization platform that helps publishers and ad ops teams run header bidding, Prebid and programmatic across display, video, app and CTV. Before BidCliq, he led AdTech and product at GeeksforGeeks, where he built an in-house ads product that doubled programmatic revenue within nine months and an anti-adblock solution that lifted ad yield by 10%. He is a founding member of AdCP.