AMPHTML ads over RTB

This page describes how to get started using AMPHTML ads with RTB. Check out the following Resources for additional information 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.

AMP page

The BidRequest.site.ext.amp field can be used to determine if the request is coming from an AMP page. It can be set to the following values:

 enum 
  
 AmpPage 
  
 { 
  
 // 
  
 This 
  
 is 
  
 not 
  
 an 
  
 AMP 
  
 page 
 . 
  
 DIALECT_HTML 
  
 = 
  
 0 
 ; 
  
 // 
  
 This 
  
 is 
  
 an 
  
 Amp 
  
 page 
 . 
  
 DIALECT_HTML_AMP 
  
 = 
  
 1 
 ; 
 } 

AMPHTML ad requirements

The BidRequest.imp.ext.ampad field can be used to determine the requirements 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 
 ; 
 } 

RTB bid response

The BidResponse.seatbid.bid.ext.amp_ad_url field accepts a URL pointing to AMPHTML ad content.

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 won't 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.

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>

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
Create a Mobile Website
View Site in Mobile | Classic
Share by: