AMP

重要事項:此文件不適用於您目前選取的格式 email

amp-access-poool

說明

顯示 Poool 付費牆。

 

必要指令碼

<script async custom-element="amp-access-poool" src="https://cdn.ampproject.org/v0/amp-access-poool-0.1.js"></script>
<script async custom-element="amp-access-poool" src="https://cdn.ampproject.org/v0/amp-access-poool-0.1.js"></script>

用法

amp-access-poool 元件以 amp-access 為基礎,使用您 Poool 儀表板設定中的 bundleID 載入並顯示付費牆。

如需更多詳細資訊,請參閱 poool.techamp-access-pooolamp-access 為基礎,且需要此元件。

如果您熟悉 Poool 在 AMP 以外的運作方式,就會知道您無法在此處使用 excerpthide 模式。這是由於 AMP 的特定行為所致。您將可以使用 amp-access 提供的 access 變數來鎖定或解鎖您的內容。請查看下方的 poool-widget 區段。

amp-access-poool 元件不需要授權或回呼設定,因為它已預先設定為可與 Poool 搭配運作。

如需更多關於模式的資訊,請查看我們的 SDK 文件

組態

您必須在 AMP 內以 camelCase 設定組態屬性,而不是 Poool 傳統上使用的底線 (" _ ") 符號。

例如:使用 customSegment="amp-custom-segment" 來達成 poool("config", "custom_segment", "amp-custom-segment");

HTML 區段

設定 poool-widget 區段,其中包含在未授予存取權時顯示的 poool 付費牆。

amp-access-poool 元件需要 3 個不同的區段

  • 文章預覽,在尚未授予存取權時顯示 (使用 amp-access="NOT access"),並由 Poool 使用 poool-access-preview 屬性識別
  • 文章內容,在已授予存取權時顯示 (使用 amp-access="access"),在授予存取權之前由 amp-access-hide 屬性隱藏,並由 Poool 使用 poool-access-content 屬性識別
  • Poool 的付費牆容器,在尚未授予存取權時顯示 (使用 amp-access="NOT error AND NOT access"),並由 Poool 使用 poool ID 識別
<section poool-access-preview amp-access="NOT access">
  <p>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur
    ullamcorper turpis vel commodo scelerisque.
  </p>
</section>

<section poool-access-content amp-access="access" amp-access-hide>
  <p>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur
    ullamcorper turpis vel commodo scelerisque.
  </p>
  <p>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur
    ullamcorper turpis vel commodo scelerisque.
  </p>
  <p>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur
    ullamcorper turpis vel commodo scelerisque.
  </p>
</section>

<section amp-access="NOT error AND NOT access" id="poool"></section>

amp-access 指令碼 - poool 設定

範例:基本付費牆組態 (使用預設值)

組態與 AMP Access 類似,但不需要授權、回呼或登入網址。

<script id="amp-access" type="application/json">
  {
    "vendor": "poool",
    "poool": {
      "bundleID": "Your app id provided by poool",
      "pageType": "premium",
      "itemID": "amp-example-article"
    }
  }
</script>

範例:為自訂群組/區隔中名為「amp-custom-segment」的使用者顯示付費牆

<script id="amp-access" type="application/json">
  {
    "vendor": "poool",
    "poool": {
      "bundleID": "Your app id provided by poool",
      "pageType": "premium",
      "debug": "true",
      "cookiesEnabled": "true",
      "itemID": "amp-example-article",
      "customSegment": "amp-custom-segment"
    }
  }
</script>

如需更多關於組態變數的資訊,請查看我們的 SDK 文件

屬性

bundleID (必要)

您的應用程式 ID (您可以在儀表板上找到它)。

itemID (必要)

您的唯一文章 ID。

pageType (必要)

用於告知 Poool 目前使用者已造訪過頁面。如需更多資訊,請參閱 文件

debug

啟用/停用偵錯模式。如需更多資訊,請參閱 文件

forceWidget

覆寫使用者的目前小工具。如需更多資訊,請參閱 文件

loginButtonEnabled

啟用/停用付費牆「登入」按鈕。如需更多資訊,請參閱 文件

signatureEnabled

啟用/停用付費牆簽名,在文章解鎖時顯示於文章內容下方。如需更多資訊,請參閱 文件

videoClient

設定影片小工具的預設影片用戶端 (vast, googima)。如需更多資訊,請參閱 文件

customSegment

使用自訂群組/區隔 slug 覆寫原生區隔。如需更多資訊,請參閱 文件

cookiesEnabled

根據最新的 GDPR 規範,我們決定預設停用付費牆內的 Cookie。您必須明確設定此屬性以反映使用者的同意。如需更多資訊,請參閱 文件

locale

設定付費牆內所有文字的預設地區設定。如需更多資訊,請參閱 文件

context

使用自訂內容值覆寫預設或原生內容。如需更多資訊,請參閱 文件

驗證

請參閱 AMP 驗證器規格中的 amp-access-poool 規則

需要更多協助嗎?

您已將本文檔閱讀了數十次,但它仍然沒有真正涵蓋您的所有問題嗎?也許其他人也有同樣的感覺:請在 Stack Overflow 上聯繫他們。

前往 Stack Overflow
發現錯誤或缺少功能嗎?

AMP 專案強烈鼓勵您的參與和貢獻!我們希望您能成為我們開放原始碼社群的長期參與者,但我們也歡迎您針對您特別熱衷的問題做出一次性的貢獻。

前往 GitHub