在 AMP 網頁中顯示 One Tap

如要在 Accelerated Mobile Pages 中新增 One Tap,

  1. 將 One Tap 加入由您的網站代管的中繼 iframe。

  2. 使用 <amp-onetap-google> 元件,將中繼 iframe (而非 One Tap) 嵌入 AMP 網頁。

將下列程式碼片段放入您希望 Google One Tap 顯示的所有 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。