AMPHTML ads over RTB

This page describes how to get started using AMPHTML ads with RTB. Check out the Resources below for additional info about AMPHTML ads and tools to help you get started.

High-level approach

RTB bid request

The RTB bid request indicates whether the request is coming from an AMP page and the requirements for AMPHTML ads

  • AdX OpenRTB:
    • AMP Page:
      message SiteExt {
        enum AmpPage {
          // This is not an AMP page.
          DIALECT_HTML = 0;
          // This is an Amp page.
          DIALECT_HTML_AMP = 1;
        }
        // Whether this is an AMP page or not. Omitted if unknown.
        optional AmpPage amp = 1;
      }
      
      
    • AMPHTML ad requirements:
      // Ad Exchange extensions for the Imp object.
      message ImpExt {
      
        // Possible requirement types for AMP ads.
        enum AmpAdRequirementType {
          // AMP ad requirements unknown.
          UNKNOWN_AMP_AD_REQUIREMENT_TYPE = 1;
          // AMP ads are not allowed.
          AMP_AD_NOT_ALLOWED = 2;
          // Either AMP ads or non-AMP ads are allowed;
          // AMP ads are not early rendered.
          AMP_AD_ALLOWED_AND_NOT_EARLY_RENDERED = 3;
          // Either AMP ads or non-AMP ads are allowed;
          // AMP ads are early rendered.
          AMP_AD_ALLOWED_AND_EARLY_RENDERED = 4;
          // AMP ads are required.
          // Ads that are non-AMP may be rejected by the publisher.
          AMP_AD_REQUIRED = 5;
          // Exchange-specific values above 500.
        }
        optional AmpAdRequirementType ampad = 8
          [default = UNKNOWN_AMP_AD_REQUIREMENT_TYPE];
      }
      
  • AdX Protocol:
    • AMP Page:
      // Whether this is an AMP page or not.
          enum AmpPage {
            // AMP page status unknown.
            UNKNOWN_AMP_PAGE = 0;
            // This is not an AMP page.
            DIALECT_HTML = 1;
            // This is an Amp page.
            DIALECT_HTML_AMP = 2;
          }
          optional AmpPage is_amp_page = 38;
    • AMPHTML ad requirements:
      // Possible requirement types for AMP ads.
          enum AmpAdRequirementType {
            // AMP ad requirements unknown.
            UNKNOWN_AMP_AD_REQUIREMENT_TYPE = 0;
            // AMP ads are not allowed.
            AMP_AD_NOT_ALLOWED = 1;
            // Either AMP ads or non-AMP ads are allowed;
            // AMP ads are not early rendered.
            AMP_AD_ALLOWED_AND_NOT_EARLY_RENDERED = 2;
            // Either AMP ads or non-AMP ads are allowed;
            // AMP ads are early rendered.
            AMP_AD_ALLOWED_AND_EARLY_RENDERED = 3;
            // AMP ads are required.
            // Ads that are non-AMP may be rejected by the publisher.
            AMP_AD_REQUIRED = 4;
          }
          optional AmpAdRequirementType amp_ad_requirement_type = 39;
      

RTB bid response

  • The BidResponse.Ad.amp_ad_url field in Authorized Buyers bid responses accepts a URL pointing to AMPHTML ad content. The same field exists as an extension in the Bid object in AdX OpenRTB.
    // The URL to fetch an AMPHTML ad. Only one of the following should be set:
    html_snippet, video_url, amp_ad_url.
    
    optional string amp_ad_url = 23
    
  • In OpenRTB 3.0 and the accompanying Advertising Common Model several additions to support AMPHTML ads are included in the most recent draft specs by the IAB, including the following.
    Bid Field Attr Type Description
    Request Site.amp amp integer The Site.amp field indicates whether the page is rendered in AMP, omitted if unknown:
    0 = page is non-AMP
    1 = page is built with AMP HTML
    Request ampformat rend integer The AMP Format Specification indicates the requirements and rendering behavior for AMPHTML ads:
    1 = AMP ad requirements are unknown
    2 = AMP ads are not allowed
    3 = Either AMP ads or non-AMP ads are allowed; AMP ads are not early rendered
    4 = Either AMP ads or non-AMP ads are allowed, and AMP ads are early rendered
    5 = AMP ads are required. Ads that are non-AMP may be rejected by the publisher
    500+ = Exchange-specific values; should be communicated to bidders a priori
    Response display curl string In the bid response, display.curl has been added to be able to submit creatives via a URL, including support for AMPHTML ads.
    This is the URL at which the creative markup will be found. Applicable to creatives types such as: AMP Ads, VAST, and DAAST and Native. Normally only one of adm or curl is valid in a given ad.

Verification of valid AMPHTML

For AMPHTML ads to be early rendered, the exchange is required to verify and sign them, indicating that the ad is written in amp4ads <html amp4ads> creative format.

Ads that are valid AMPHTML will be allowed to render early by AMP pages. Ads that are not verified as valid AMPHTML will render at the same speed as non-AMPHTML ads.

Only AMPHTML ads should be returned in the amp_ad_url.

In the future, if a publisher requires AMPHTML ads only, ads not signed as AMPHTML will not be rendered.

With Authorized Buyers, bidders will still be charged if they return a non-AMPHTML Ad to an AMPHTML ad-required adslot.

Server-side fetch

  • For AMPHTML ads to be early rendered, AMPHTML ad content must be rendered without requiring additional hops from the client. This is designed to avoid poor user experiences due to ad latency and extra client-side calls.
  • After a bidder wins the auction, the exchange will perform a server-to-server request to retrieve the AMPHTML ad content located at the URL provided in amp_ad_url. Creative servers must respond and return content within 300 ms.
  • The AMPHTML ad returned from the creative server will be injected into the adslot and subsequently rendered. Note that a valid AMPHTML ad cannot contain iframes or other <amp-ad> tags. See the AMPHTML ads spec for more details.
  • Beta only feature: Contact your account team if you require this.

    During server-to-server retrieval of the AMPHTML ad (specified in amp_ad_url), Authorized Buyers may pass the HTTP header and IP from the user's browser to the creative server. This ensures the creative server receives information similar to that sent from a standard client-side fetch. In some cases, the IP address may be truncated to only the first 3 bytes (IPv4) or first 6 bytes (IPv6). Contact your account team if you require this feature. Here is a sample HTTP header:

Impression tracking URLs and click macros

RTB buyers often include impression trackers as a structured field in the bid response (this is Bid.burl, the "billing notice URL" in OpenRTB 2.5).

With Authorized Buyers, these will be fired client-side; amp-pixel fires tracking URLs when the creative is rendered. amp-analytics can handle more advanced tracking use cases beyond rendering.

AMPHTML ads are required to contain a valid click macro in the AMPHTML. This will typically take the form of something like this:

<a href="%%CLICK_URL_UNESC%%http%3A%2F%2my.adserver.com%2Fsome%2Fpath%2Fhandleclick%3Fclick%3Dclk"></a>
<a href=”https://my.adserver.com/click?google_click_url=%%CLICK_URL_ESC%%”></a>

Cookie matching

Creatives often include cookie matching pixels within the creative code. AMPHTML ads can use the amp-pixel and amp-analytics components for this use case. If your use case cannot be accommodated by using amp-analytics or amp-pixel, open a GitHub issue to discuss alternate options. We welcome new extensions that can be broadly used by a number of different companies. See detailed guidelines or a technical guide to building a new extension.

Sample AMP Ad URLs for testing

You can use the following sample AMPHTML ad content for testing:

Resources

The AMP Project and Google have released a number of resources to help you get started:

Building ads in AMP
RTB-specific proposals to IAB / OpenRTB Group

Send feedback about...

Authorized Buyers
Authorized Buyers