layout | title | head_title | description | pid | hide | sidebarType |
---|---|---|---|---|---|---|
page_v2 |
Enable Deals |
Enable Deals in Prebid for Header Bidding |
Enable Deals in Prebid for Header Bidding Analysis. |
4 |
false |
3 |
{:.no_toc}
In order to enable deals for prebid, the ad ops setup is slightly different from the standard header bidding setup. Specifically:
-
From the ad ops side, you'll create separate orders and line items that target the deal ID key-values. These line items will be at different (probably higher) priorities than your standard header bidding line items.
-
From the dev side, if your page is using the standard prebid.js key-values, no change or work is required.
{: .bg-info :} In this example we will use the Google Ad Manager setup to illustrate, but the steps are basically the same for any ad server.
- TOC {:toc}
Whenever a bidder responds with a bid containing a deal ID, Prebid.js will generate and attach deal-related key-values to the ad server call in the format: hb_deal_BIDDERCODE = DEAL_ID
.
For example, given the submitted bids, prices, and deals shown here:
bid 1: Bidder = Rubicon, CPM = 1.50, Deal ID = RBC_123
bid 2: Bidder = AppNexus, CPM = 1.20, Deal ID = APN_456
The key-values attached to the ad server call (that the line items will target) will be:
hb_pb_rubicon = 1.50
hb_deal_rubicon = RBC_123
hb_pb_appnexus = 1.20
hb_deal_appnexus = APN_456
// hb_adid, hb_size, and hb_adid omitted
{% capture noteAlert %} We recommend confirming with your development team that the page is set up to send all deal targeting to the ad server. There are two ways to do this:
- Set the
enableSendAllBids
to true. - Set
enableSendAllBids
to false andalwaysIncludeDeals
to true. This option will minimize the number of targeting variables sent to the ad server.
See the enableSendAllBids documentation for details. {% endcapture %}
{% include alerts/alert_note.html content=noteAlert %}
For each header bidding partner you work with, create a keyword in the format of hb_deal_BIDDERCODE
, e.g., hb_deal_pubmatic
. For more examples of the keyword format, see the API Reference for pbjs.getAdserverTargeting
.
![Inventory Sizes]({{ site.github.url }}/assets/images/demo-setup/deals/key-val.png){: .pb-lg-img :}
In Google Ad Manager, create a new line item.
Enter all the Inventory sizes for your deal (or deals):
![Inventory Sizes]({{ site.github.url }}/assets/images/demo-setup/inventory-sizes.png){: .pb-md-img :}
Set the priority to the level you prefer.
![Inventory Sizes]({{ site.github.url }}/assets/images/demo-setup/deals/deal-priority.png){: .pb-lg-img :}
Set Display Creatives to One or More since we'll have one or more creatives attached to this line item.
Set Rotate Creatives to Evenly.
![Display and Rotation]({{ site.github.url }}/assets/images/demo-setup/display-and-rotation.png){: .pb-md-img :}
Then you'll need to target the inventory that you want to this deal to run on.
Use Key-values targeting to target deal ID(s)
There are two ways to target deal IDs using Key-values targeting:
- If you would like the deals to have the same priority and target the same inventory, you can include multiple deal IDs (as shown below).
- Otherwise, you must create a separate line item for each deal ID you want to target.
![Inventory Sizes]({{ site.github.url }}/assets/images/demo-setup/deals/targeting.png){: .pb-lg-img :}
Like all line items, those that represent deals need to be associated with creatives that pass the correct adid back to Prebid.js for display.
e.g. if the line item is targeted to hb_deal_pubmatic
, then the creative needs to send hb_adid_pubmatic
in the creative. Like this:
<script src = "https://cdn.jsdelivr.net/npm/prebid-universal-creative@latest/dist/creative.js"></script>
<script>
var ucTagData = {};
ucTagData.adServerDomain = "";
ucTagData.pubUrl = "%%PATTERN:url%%";
ucTagData.env = "%%PATTERN:hb_env%%";
ucTagData.adId = "%%PATTERN:hb_adid_pubmatic%%";
ucTagData.cacheHost = "%%PATTERN:hb_cache_host_pubmatic%%";
ucTagData.cachePath = "%%PATTERN:hb_cache_path_pubmatic%%";
ucTagData.uuid = "%%PATTERN:hb_cache_id_pubmatic%%";
ucTagData.mediaType = "%%PATTERN:hb_format_pubmatic%%";
ucTagData.size = "%%PATTERN:hb_size_pubmatic%%";
ucTagData.hbPb = "%%PATTERN:hb_pb_pubmatic%%";
try {
ucTag.renderAd(document, ucTagData);
} catch (e) {
console.log(e);
}
</script>
If however, the line item is targeted to hb_deal
(without a bidder code),
then the simplified creative setup in the step-by-step instructions will be fine.