PrebidJS
Overview
Prebid.js for Web is an open-source Javascript library and community which allows publishers to implement Header Bidding.
In summary, Prebid.js and the Sharethrough bidder work like this:
Prebid.js (a library installed on the page) notifies the bidders
The bidders respond with bids
Prebid passes bids to the ad server (GAM)
The ad server selects a winner
Prebid.js loads the ad creative and renders it on the page
What’s an ad server?
While optional, an ad server simplifies ad inventory management, performance reporting and website setup.
There are advantages for publishers to use varying ad servers. However, we most notably see publishers using Google Ad Manager (GAM), the most popular free ad server. For bigger publishers, Google Ad Manager 360 is the paid version with premium features.
The Prebid.js library and configuration is included in the webpage and will work with an existing ad server such as Google Ad Manager, AppNexus, and others.
This specific page contains brief information on how to get started with Prebid using our demand.
For additional information, see:
Quick Start Guide
Select the latest version of Prebid to get all the latest features
Check the box for ‘Sharethrough’
Select the “Get Prebid.js!” button to download the library on browser.
Add the Prebid.js library to your web page using <script> tags like this. We recommend using a test page to configure Prebid before going live in production.
<html>
<head>
<script async src="prebid.js"></script>
<script>
var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
</script>
</head>
</html>
Configure your ad server (GAM). See: Google Ad Manager with Prebid Step by Step
Push Price Priority Line Items to your publisher ad server (for instance GAM for those using Google’s ad server) using the defined price granularity and setup specific for that ad server.
This Python project does a good job for users semi-familiar with the Ad Manager API and Python
Use the key-values 'sharethrough' per the bidder parameters documentation from Prebid.
Push Price Priority Line Items to your publisher adserver (for instance GAM for those using Google’s adserver) using the defined price granularity and setup specific for that adserver.
This Python project does a good job for users semi-familiar with the Ad Manager API and Python
Use the key-values 'sharethrough' per the bidder parameters documentation from Prebid.
Configure the ad units for which you want the
sharethrough
bidder to return bid responses. Sharethrough supports banner and video impression requests [**native remains unsupported in PrebidJS, but available through PBS (Go and Java]).. See the Prebid documentation for adunit configuration. It provides definitions for all the supported fields and examples for various types of ads.
The important fields are:code
: Associates the ad unit configuration with an ad slot on the page.mediaTypes
: The type of ads to serve. E.g. banner, video, native, etc.bids
: Bidder specific parameters.You must define the sharethrough bidder and associate this ad unit with a PubMaestro placement key using
pkey
ortb2Imp
: Optional parameters supported by OpenRTB. For example, you could configure a floor price, block advertiser domains or block IAB categories.Example:
<script> var adUnits = [ { code: 'my-html-div-tag-id', mediaTypes: { banner: { sizes: [[300,250]] } }, bids: [ { bidder: "sharethrough", params: { pkey: 'pkey1', } } ] }, ] pbjs.que.push(function() { pbjs.addAdUnits(adUnits); }); </script>
Request bids and render the winning ads
Call
pbjs.requestBids
to request bids for all ad units. This is typically called when the page loads or when an ad slot comes into view.The
bidsBackHandler
parameter is a callback function to call once the bid responses are received to render the winning ads.<script> pbjs.que.push(function() { pbjs.requestBids({ bidsBackHandler: renderAllAdUnits, // Your rendering logic here }); }); </script>
Examples:
With an ad server (GAM): Basic Example for Header Bidding
Without an ad server: No Adserver Example for Header Bidding
Sharethrough should immediately start competing in your header bidding auctions.
Verify the GAM setup
Open your GAM account
Open the reporting section
Check for spending from Sharethrough advertiser (created for Prebid setup)
Note: There’s a reporting delay of a couple of hours
Best Practices
Before implementing any Prebid demand on your pages we recommend some best practices to ensure the maximum benefit is provided to your bottom line while not impacting users.
Define and Request only what will be immediately rendered.
In some scenarios it might be useful to define and prepare all ad slots which will ever be displayed on page.
However, if some ad slots are never rendered these ad requests may reduce the fill % on the page, as well as possible SPO/optimization by buyers which exclude your inventory.
Keep the number of ad slots to less than 4
To improve view-ability and user experience we recommend limiting the number of active ad slots to 4, ensuring to keep them as view-able as possible.
Timeouts
A timeout of at least 1000ms is recommended per bidder unless most of your inventory is on slow mobile connections, in which case increasing the timeout to 3000ms is recommended.
Define, request, and render ad slots as they near view
If you are lazy loading ads on long article pages we recommend defining the new ad slots, making requests, and rendering the ad as the user scrolls through content and nears the ad slot.
This benefits the page by minimizing the ad load and reduces resources until such a time they are required.
Avoid creating new ad slots when you want to refresh ads
We recommend using Prebid’s documented refresh functionality.
Keep it simple
Avoid wrapping Prebid functionality in classes, functions, namespaces, etc
If you obfuscate Prebid you may introduce additional complexity when needing to troubleshoot
Add User ID Modules
Provide the position of the ad unit, using the
banner.pos
field (Open RTB Spec: Placement Positions)Check out the Sharethrough bidder page for other features that might interest you, such as first party data
Adapter Details
Sharethrough
End Point
https://btlr.sharethrough.com/universal/v1?supply_id=WYu2BXv1
Request and Response Attributes
Calls to Sharethrough are single Request
Bids are returned in NET (The bid returned reflect the bid amount with rev share already taken into account; no adjustment is necessary)
Sharethrough is GDPR & COPPA Compliant
Supported mediaTypes
Banner
Native
Video (instream and outstream)
Default Ad Server Key Value
sharethrough
Prebid Modules
For publishers on Prebid version 5 and above, current Prebid modules support include:
Price Floors
Supply Chain Object
User ID
Additional Notes on STR Adapter
For publishers on Prebid version 5 and above,
TTL is 360 for display and native, 3600 for video (in milliseconds)
Advertiser domains into the bid.meta object
Safeframes are supported
Configuring Prebid with GPID
The Global Placement ID (GPID) was an initiative in the Fall of 2021 led by the TradeDesk to solve the problem of inventory identification in an industry-wide way. i.e. Buyers want to be able to identify ad slots in a unique way even when the publisher uses the same ad slot name multiple times.
The suggestion for GPID is to simply append the HTML div element id (aka the ‘div-id’) to the ad slot name. But some publishers generate div-ids randomly, so the definition of GPID has become:
Example:
Support for GPID is available for the following:
display
video
Additional information on defining GPID can be found here: https://dev.prebid.org/features/pbadslot.