GAM Step by Step - Banner/Outstream/AMP Creatives

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.

  1. In GAM, select Delivery > Creatives.
  2. Under the Display creatives tab, click New Creative.
  3. Select your advertiser, then click Third party.
  4. Enter a Name for your creative. For example, Prebid – banner – 1x1 - 1.
  5. Enter a Target ad unit size of 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.

  1. Select Standard as the Code type.

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.

  1. Enter one of the scripts shown below, depending on whether Prebid is configured to send all bids or only the top price bid.

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>
  1. Select whether to Serve into a SafeFrame. See Creative Considerations for more on using SafeFrames.

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.)

Banner creative settings

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.

  1. If you’re using jsdelivr, set your Associated ad technology provider:

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:

Creative Declaration

  1. Click Save and preview.

Further Reading