How to Integrate Prebid.js with Video: A Practical Guide for Publishers

Video ad monetization is increasingly crucial for publishers seeking to maximize revenue without sacrificing user experience. Yet integrating video demand into the Prebid.js header bidding stack introduces new complexities, from handling VAST XML to configuring diverse bidder requirements.

This guide breaks down how to set up Prebid.js for both instream and outstream video, tackle configuration hurdles, and avoid common pitfalls—ensuring you get the most from your video inventory.

Defining Prebid.js Video Ad Units: Instream vs. Outstream

Setting up video ad units in Prebid.js is similar in structure to display, but requires careful attention to video-specific parameters. The most important distinction is between instream (ads within video content) and outstream (standalone video ads placed outside video content) contexts, set using the mediaTypes.video.context property.

Key Configuration Parameters

For every video ad unit, you’ll need to specify:
– context: ‘instream’ or ‘outstream’
– plcmt: Placement type (e.g., 1 for Instream Sound On, 2 for Accompanying Content, etc.)
– playerSize: The video player dimensions (e.g., [640, 480])
– mimes: Supported video MIME types (particularly required when using Prebid Server)
– protocols: Supported video protocols
– playbackmethod and skip: Control engagement and skippability

Example: If you run a 640×480 video player with outstream ads, set context to ‘outstream’, supply the appropriate plcmt code, and list the accepted MIME types your demand partners require.

Bidder Definitions and Compatibility

Each bidder integrated into your video ad unit has its own set of required parameters. For example, AppNexus might use a placementId, while others require unique attributes. Failing to correctly define these can result in bidding errors or missing demand.

Check each bidder’s documentation and cross-reference with your video ad unit setup. For example, differences in parameter requirements between client-side and server-side setups can lead to subtle failures—especially as some bidders only support video in one environment.

Storing VAST XML: Video Creative Caching

Unlike banner ads, video creatives are passed as VAST XML—an industry-standard format expected by most video players. Since VAST tags cannot be passed directly through the browser, Prebid.js must use a video cache to make the creatives accessible.

Configuring Video Cache in Prebid.js

You must set a cache URL in your Prebid.js configuration. This is where Prebid stores each VAST document for retrieval by your video player when the ad wins.

For instance, set pbjs.setConfig({ cache: { url: ‘https://your-cache.example.com/cache’ } }). Double-check this endpoint—an incorrect or unsupported cache will break ad serving for video units.

Bidder and Player Compatibility

Some demand partners manage their own creative caching, while others rely on your Prebid cache setup. Test for edge cases: If your auction returns VAST XML but the cache is misconfigured, your player will throw errors or display blank ad breaks.

Advanced Prebid.js Video Configuration: Price Granularity and Server-Adapters

Video inventory typically commands higher CPMs, so precise price settings matter. Misconfigured price granularity can result in mismatches with your ad server or even lost revenue.

Setting Price Granularity Strategically

Prebid.js supports custom CPM buckets via the setConfig API. If you sell both banner and video inventory, you can define separate price granularities using mediaTypePriceGranularity. A fine-grained configuration ensures you’re not leaving money on the table during auctions where small CPM differences could dictate the winning bid.

Prebid Server and Video: Special Considerations

If you’re leveraging Prebid Server for server-to-server video auctions, bidder adapter configuration becomes even more critical. Double-check server adapter settings and confirm mimes, protocols, and caching endpoints are fully aligned across your setup.

Common Publisher Mistakes and How to Avoid Them

Implementing Prebid.js video is rife with avoidable pitfalls. Even sophisticated publishers stumble over inconsistent parameters or missing cache settings.

Frequent Configuration Errors

– Misaligned playerSize or MIME settings between ad units and bidders
– Omitting required fields like mimes when using Prebid Server
– Conflicting price granularity leading to unpredictable auction outcomes
– Neglecting cache setup or using a misconfigured cache endpoint

Real-World Example: Troubleshooting Blank Video Slots

A typical scenario: Outstream placements serve blank ads after a new Prebid.js integration. After analysis, the mistake is often a missing VAST cache URL or incompatible playerSize configuration with a specific demand partner. Proactively validating each parameter saves hours of debugging.

What this means for publishers

Operationally, tightly aligning your Prebid.js video configuration with your video player and demand partners minimizes wasted impressions and maximizes revenue. Accurate bidder parameters and robust cache setup lower the risk of serving errors while providing flexibility to quickly adapt to new partners or formats. In short, careful Prebid.js video configuration gives you more control, fewer headaches, and a more scalable monetization stack.

Practical takeaway

For publishers and ad ops teams, successful Prebid.js video setup hinges on attention to technical details. Start with a thorough mapping of each bidder’s required parameters and verify these in your video ad unit definitions. Double check cache URLs and run end-to-end QA—both for instream and outstream placements.

Regularly audit your price granularity settings and leverage mediaTypePriceGranularity to optimize for the higher value video inventory. Don’t hesitate to test with multiple players and bidders in parallel to quickly identify integration issues. The key is robust initial configuration and continuous validation as you scale your video monetization efforts.