This page walks you through the steps required to create banner and In-Renderer (formerly known as “outstream”) creatives to attach to your Prebid line items in Google Ad Manager (GAM). This same process can cover native creatives if you’ve chosen the in-adunit or external native template options. If you’re using GAM’s native design tool, you’ll need to follow the GAM native page.
For complete instructions on setting up Prebid line items in Google Ad Manager, see Google Ad Manager with Prebid Step by Step.
Note that for Prebid Mobile, the In-Renderer video scenario is covered by video line items. See the video creative reference for details.
This document describes how to implement the 3rd Party HTML creatives in GAM for banner/etc. See the creative considerations reference for an overview.
This procedure works for both Prebid.js and Prebid Mobile, with a few differences noted below.
Prebid – banner – 1x1 - 1
.1x1
. This allows the creative to serve on all inventory sizes.These instructions assume you’re using the Prebid Universal Creative (PUC) after v1.15 that supports the separate banner.js
file. See the Prebid Universal Creative documentation for alternate approaches.
AMP: If you choose to bypass the PUC for AMP or Prebid Mobile, Prebid Server analytics will not work.
AMP: If you are using AMP, you should still select Standard as the code type. The “AMP” option is for AMPHTML hosted by a 3rd party.
Send All Bids Configuration
Be sure to replace BIDDERCODE with the appropriate bidder. For example, if the bidder code is PBbidder
, the adid
would be %%PATTERN:hb_adid_PBbidder%%
.
Also, replace “PUCFILE” with:
<script src = "https://cdn.jsdelivr.net/npm/prebid-universal-creative@latest/dist/PUCFILE"></script>
<script>
var ucTagData = {};
ucTagData.adServerDomain = "";
ucTagData.pubUrl = "%%PATTERN:url%%";
ucTagData.adId = "%%PATTERN:hb_adid_BIDDERCODE%%";
ucTagData.cacheHost = "%%PATTERN:hb_cache_host_BIDDERCODE%%";
ucTagData.cachePath = "%%PATTERN:hb_cache_path_BIDDERCODE%%";
ucTagData.uuid = "%%PATTERN:hb_cache_id_BIDDERCODE%%";
ucTagData.mediaType = "%%PATTERN:hb_format_BIDDERCODE%%";
ucTagData.env = "%%PATTERN:hb_env%%";
ucTagData.size = "%%PATTERN:hb_size_BIDDERCODE%%";
ucTagData.hbPb = "%%PATTERN:hb_pb_BIDDERCODE%%";
// mobileResize needed for mobile GAM only
ucTagData.mobileResize = "hb_size:%%PATTERN:hb_size_BIDDERCODE%%";
// these next two are only needed for native creatives but are ok for banner
ucTagData.requestAllAssets = true;
ucTagData.clickUrlUnesc = "%%CLICK_URL_UNESC%%";
try {
ucTag.renderAd(document, ucTagData);
} catch (e) {
console.log(e);
}
</script>
Note: the mobileResize
parameter is a workaround to a bug in the Google Mobile Ads SDK. The Prebid SDK uses the existence of the “hb_size” string that’s provided in %%PATTERN:TARGETINGMAP%%, but this bidder-specific version of the creative doesn’t utilize the TARGETINGMAP, so the value is added here. The important part is the value that contains hb_size:
.
Warning: Be sure none of the attribute names are longer than 20 characters. See Send All Bids Key Value Pairs for more information.
Send Top Price Bid Configuration
In top-price mode, you can make use of the GAM TARGETINGMAP
feature instead of listing out each attribute.
Be sure to replace “PUCFILE” with:
<script src = "https://cdn.jsdelivr.net/npm/prebid-universal-creative@latest/dist/PUCFILE"></script>
<script>
var ucTagData = {};
ucTagData.adServerDomain = "";
ucTagData.pubUrl = "%%PATTERN:url%%";
ucTagData.targetingMap = %%PATTERN:TARGETINGMAP%%;
ucTagData.hbPb = "%%PATTERN:hb_pb%%";
// these next two are only needed for native creatives but are ok for banner
ucTagData.requestAllAssets = true;
ucTagData.clickUrlUnesc = "%%CLICK_URL_UNESC%%";
try {
ucTag.renderAd(document, ucTagData);
} catch (e) {
console.log(e);
}
</script>
AMP: For AMP, you must select Serve into a SafeFrame.
Your creative settings will look something like this. In this example we’re assuming a Send All Bids configuration, and we’ve replaced BIDDERCODE with the code for our bidder, PBbidder. (Notice that some of the key names have been truncated to adhere to the GAM 20-character key length limit.)
Note: You can ignore the “Sorry, we don’t recognize this tag” warning. GAM doesn’t have built-in macros for Prebid and so doesn’t recognize them. The ad tag will still work correctly.
As of August 2020, privacy regulations have changed such that new creatives entered in GAM may require a declaration of the ad technology provider. The first step is to note the domain you serve the creative from. The examples above offer the use of the jsdelvr CDN. However, you may obtain the creative from a managed service or you may host it yourself. If you receive a warning from ad manager about “declaring self-created ad technology”, you should be able to work around this by editing the creative and filling out the “Associated ad technology providers” section as shown in this screen capture:
The process for the Prebid Dynamic Creative is exactly the same except that the body of the creative is different. In Step 7 above, instead of using the creative body that loads the PUC:
For Send-Top-Bid setups, copy the dynamic creative from github and paste it into GAM.
For Send-All-Bids setups, copy the dynamic creative from github and paste it into GAM. Then replace %%PATTERN:hb_adid%%
with %%PATTERN:hb_adid_BIDDERCODE%%
. For example, if the bidder code is PBbidder
, the adid
would be %%PATTERN:hb_adid_PBbidder%%
. Remember to truncate the whole hb_adid_BIDDERCODE to 20 characters.