在 AMP 网页中显示一键显示功能

将“一键式”按钮添加到您的 Accelerated Mobile Pages (AMP) 网页:

  1. 将 One Tap 添加到由您自己网站托管的中间 iframe 中。

  2. 使用 <amp-onetap-google> 组件将中间 iframe(而不是一键快捷功能)嵌入到 AMP 网页中。

将以下代码段添加到您希望 Google One 点按显示的任何 AMP 网页中:

<script custom-element="amp-onetap-google" src="https://cdn.ampproject.org/v0/amp-onetap-google-0.1.js" async></script>
<amp-onetap-google
  layout="nodisplay"
  data-src="https://example.com/onetap_iframe.html">
</amp-onetap-google>

data-src 属性设置为中间 iframe 的 URI。