Setting up Prebid Native in DFP (Alpha)

This page describes how to set up native creatives in DFP for use with Prebid.js.

For more information about DFP native ad setup, see the DFP native ads documentation.

1. Add a native ad unit

You can specify a size for the ad unit, or specify the “fluid” size. In this case we’ll go with Fluid.

prebid native adunit

2. Create a custom native ad format

For Prebid, create a custom native ad format.

Make sure to remove all variables except Click-through URL.

prebid native format

3. Create new native style

In this example, we’re targeting "prebid_native_adunit", so the Size is set to Fluid.

Add the HTML and CSS that define your native ad template. Note that %%PATTERN%% macros can be included in either field, and the HTML can contain JavaScript. For more information, see the DFP native styles docs.

Example HTML and CSS:

    <div class="sponsored-post">
        <div class="thumbnail"></div>
        <div class="content">
            <h1><a href="%%CLICK_URL_UNESC%%%%PATTERN:hb_native_linkurl%%" target="_blank">%%PATTERN:hb_native_title%%</a></h1>
            <p>%%PATTERN:hb_native_body%%</p>
            <div class="attribution">%%PATTERN:hb_native_brand%%</div>
        </div>
    </div>
.sponsored-post {
    background-color: #fffdeb;
    font-family: sans-serif;
    padding: 10px 20px 10px 20px;
}

.content {
    overflow: hidden;
}

.thumbnail {
    width: 120px;
    height: 100px;
    float: left;
    margin: 0 20px 10px 0;
    background-image: url(%%PATTERN:hb_native_image%%);
    background-size: cover;
}

h1 {
    font-size: 18px;
    margin: 0;
}

a {
    color: #0086b3;
    text-decoration: none;
}

p {
    font-size: 16px;
    color: #444;
    margin: 10px 0 10px 0;
}

.attribution {
    color: #fff;
    font-size: 9px;
    font-weight: bold;
    display: inline-block;
    letter-spacing: 2px;
    background-color: #ffd724;
    border-radius: 2px;
    padding: 4px;
}

4. Create new native order and line items

  1. Add the native format created in Step 1 under Inventory Sizes (in this case, “Prebid Native Format”)
  2. Be sure to set inventory targeting and key-value targeting on hb_pb corresponding to the line item’s CPM.

create a native order and line item

add targeting

5. Create a new native creative

  1. Be sure to select the format you created in Step 1 (in this case, “Prebid Native Format”)
  2. Under Click-through URL, add any value. This will be overwritten by Prebid.

create a new native creative

creative click-through URL