This page walks you through the steps required to create banner and outstream creatives to attach to your Prebid line items in Google Ad Manager (GAM).
For complete instructions on setting up Prebid line items in Google Ad Manager, see Google Ad Manager with Prebid Step by Step.
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, 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%%
.
<script src = "https://cdn.jsdelivr.net/npm/prebid-universal-creative@latest/dist/%%PATTERN:hb_format%%.js"></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%%";
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.
<script src = "https://cdn.jsdelivr.net/npm/prebid-universal-creative@latest/dist/%%PATTERN:hb_format%%.js"></script>
<script>
var ucTagData = {};
ucTagData.adServerDomain = "";
ucTagData.pubUrl = "%%PATTERN:url%%";
ucTagData.targetingMap = %%PATTERN:TARGETINGMAP%%;
ucTagData.hbPb = "%%PATTERN:hb_pb%%";
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: