采用实时出价的 AMPHTML 广告

本页介绍了如何将 AMPHTML 广告与 RTB 结合使用。请查看下面的资源,详细了解 AMPHTML 广告以及有助于您着手使用 AMPHTML 广告的工具。

大致的方法

RTB 出价请求

RTB 出价请求会指明请求是否来自 AMP 网页,以及 AMPHTML 广告需要满足的要求。

OpenRTB

AMP 网页

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;
  enum VisibilityState {
    VISIBILITY_STATE_UNKNOWN = 0;

    // The page is at least partially visible. For example, in the foreground
    // tab of a non-minimized window.
    VISIBILITY_STATE_VISIBLE = 1;

    // The page is not visible to users. For example, when the page is in a
    // background browser tab, or in a minimized window.
    VISIBILITY_STATE_HIDDEN = 2;
  }

  // The visibility state of the web page containing the ad slot.
  // See https://www.w3.org/TR/page-visibility/.
  // [AdX: BidRequest.page_visibility]
  optional VisibilityState page_visibility = 2 [default =
    VISIBILITY_STATE_UNKNOWN];

  // Information about a browser window's user activation state. See
  // https://html.spec.whatwg.org/multipage/interaction.html#the-useractivation-interface.
  message UserActivation {
    // Indicates whether a user has completed an interaction since page load.
    optional bool wasact = 1;

    // Indicates whether a user is currently interacting with the page.
    optional bool isact = 2;
  }

  // User activation information from the browser for the current request, if
  // the request is for a web page.
  optional UserActivation uact = 5;

  // The set of possible web navigation types that predicate a page load. Each
  // of these types may have different performance characteristics. For example,
  // users going back and forth might experience a faster site than users
  // performing navigation for the first time or submitting forms. See
  // https://w3c.github.io/navigation-timing/#dom-performancenavigationtiming-type.
  enum NavigationType {
    NAVIGATION_TYPE_UNKNOWN = 0;

    // Navigation started by clicking a link, entering the URL in the browser's
    // address bar, form submission, or initializing through a script operation
    // other than reload and back_forward.
    NAVIGATION_TYPE_NAVIGATE = 1;

    // Navigation is through the browser's reload operation, location.reload(),
    // or a Refresh pragma directive like
    // <meta http-equiv="refresh" content="300">.
    NAVIGATION_TYPE_RELOAD = 2;

    // Navigation is through the browser's history traversal operation.
    NAVIGATION_TYPE_BACK_FORWARD = 3;

    // Navigation is initiated by a prerender hint (deprecated). See
    // https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/prerender.
    NAVIGATION_TYPE_PRERENDER = 4;
  }

  // The type of browser navigation that led to the current page. Unset for
  // non-web ad requests.
  optional NavigationType ntype = 6;

  // Indicates that the request is using semi-transparent branding,
  // which means only a truncated version of the request URL will
  // be provided. This decision is made by the publisher, see
  // https://support.google.com/admanager/answer/4584891#urls for context.
  optional bool is_semi_transparent_request = 3;

  // The domain of the partner (of the site owner) with ownership
  // of some portion of ad inventory on the site. The partner's ads.txt file
  // will be hosted here. More detail at
  // http://iabtechlab.com/wp-content/uploads/2021/03/ctv-app-ads-explainer-guide.pdf
  optional string inventorypartnerdomain = 4;
}

AMPHTML 广告要求

// 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];
}

Authorized Buyers 实时出价

AMP 网页

// Whether this is an AMP page or not.
enum AmpPage {
  // AMP page status unknown.
  UNKNOWN_AMP_PAGE = 0;

AMPHTML 广告要求

// Possible requirement types for AMP ads.
enum AmpAdRequirementType {
  // AMP ad requirements unknown.
  UNKNOWN_AMP_AD_REQUIREMENT_TYPE = 0;

实时出价响应

OpenRTB

OpenRTB 3.0 和随附的广告通用模型中,为支持 AMPHTML 广告,在最新的规范草稿中纳入了 IAB 的几项新增内容,其中包括:

出价 字段 Attr 类型 说明
请求 Site.amp amp integer Site.amp 字段用于指明网页是否以 AMP 网页呈现;如果未知,则省略:
0 = 网页为非 AMP 网页
1 = 网页是使用 AMP HTML 构建的
请求 ampformat rend integer AMP 格式规范指明了 AMPHTML 广告的要求和呈现行为:
1 = AMP 广告要求未知
2 = 不允许使用 AMP 广告
3 = 允许使用 AMP 广告或非 AMP 广告;不会提前呈现 AMP 广告
4 = 允许 AMP 广告或非 AMP 广告,但可以提前呈现 AMP 广告
5 = 必须提供 AMP 广告。非 AMP 广告可能会被发布商拒绝
500+ = 各广告交易平台专有的值;应事先告知出价方
响应 display curl string 在出价响应中,添加了 display.curl,以便能够通过网址提交广告素材,包括支持 AMPHTML 广告。
这是广告素材标记所在的网址。适用于广告素材类型,例如:AMP 广告、VAST、DAAST 和原生。通常情况下,指定广告中只有 adm 和 curl 之一有效。

Authorized Buyers 实时出价

Authorized Buyers 出价响应中的 BidResponse.Ad.amp_ad_url 字段接受指向 AMPHTML 广告内容的网址。该字段以扩展的形式存在于 Google 的 OpenRTB 实现内的 Bid 对象中。

// The URL to fetch an AMPHTML ad. Only one of the following should be set:
// html_snippet, video_url, amp_ad_url, native_ad.
optional string amp_ad_url = 23;

验证有效的 AMPHTML

若要提前呈现 AMPHTML 广告,广告交易平台需要对其进行验证和签名,以表明该广告是以 amp4ads <html amp4ads> 广告素材格式编写的。

有效 AMPHTML 的广告将可在 AMP 网页中提早呈现。未通过验证为有效 AMPHTML 的广告将与非 AMPHTML 广告以相同的速度呈现。

amp_ad_url 中应仅返回 AMPHTML 广告。

将来,如果发布商只需要 AMPHTML 广告,就不会呈现未以 AMPHTML 格式签名的广告。

使用 Authorized Buyers 时,如果出价方将非 AMPHTML 广告返回到需要 AMPHTML 广告的广告位,则仍需为其付费。

服务器端提取

若要提前呈现 AMPHTML 广告,必须呈现 AMPHTML 广告内容,而无需从客户端执行额外的跃点。这样做是为了避免因广告延迟和额外的客户端调用而导致用户体验不佳。

出价方赢得竞价后,广告交易平台将执行服务器到服务器请求,以检索位于 amp_ad_url 中提供的网址上的 AMPHTML 广告内容。广告素材服务器必须在 300 毫秒内做出响应并返回内容。

从广告素材服务器返回的 AMPHTML 广告将注入广告位,随后进行呈现。请注意,有效的 AMPHTML 广告不能包含 iframe 或其他 <amp-ad> 标记。如需了解详情,请参阅 AMPHTML 广告规范

仅限 Beta 版功能:如果您需要此功能,请与您的客户支持团队联系

在服务器到服务器检索 AMPHTML 广告(在 amp_ad_url 中指定)期间,Authorized Buyers 可能会将 HTTP 标头和 IP 从用户浏览器传递到广告素材服务器。这样可确保广告素材服务器收到的信息与通过标准客户端提取方式发送的信息类似。在某些情况下,IP 地址可能会仅截断为前 3 个字节 (IPv4) 或前 6 个字节 (IPv6)。如果您需要此功能,请与您的客户支持团队联系。以下是 HTTP 标头示例:

展示跟踪网址和 Click 宏

RTB 买方通常会将展示跟踪代码作为结构化字段添加到出价响应中(这是 Bid.burl,OpenRTB 2.5 中的“结算通知网址”)。

使用 Authorized Buyers 时,这些事件将在客户端触发;amp-pixel 会在广告素材呈现时触发跟踪网址。amp-analytics 可以处理呈现之外的更高级跟踪用例。

AMPHTML 广告必须在 AMPHTML 中包含有效的 Click 宏。具体形式如下:

<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 匹配像素。对于这种使用情形,AMPHTML 广告可以使用 amp-pixelamp-analytics 组件。如果您的用例无法通过使用 amp-analyticsamp-pixel 来适应,请提交 GitHub 问题以讨论替代方案。我们欢迎您提供可被众多不同公司广泛使用的新扩展程序。如需了解如何构建新扩展程序,请参阅详细指南技术指南

用于测试的 AMP 广告网址示例

您可以使用以下 AMPHTML 广告内容示例进行测试:

资源

AMP 项目和 Google 发布了许多资源,以帮助您顺利上手:

在 AMP 中制作广告
向 IAB / OpenRTB Group 群组提交实时出价 (RTB) 专用提案