AMP

Important: this documentation is not applicable to your currently selected format stories!

amp-access-poool

Description

Displays a Poool paywall.

 

Required Scripts

<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>

Usage

The amp-access-poool component, based on amp-access, loads and shows a paywall using your bundleID from Poool's Dashboard configuration.

See poool.tech for more details. amp-access-poool is based on, and requires, amp-access.

As you'll know if you're familiar with how Poool works outside of AMP, you cannot use excerpt and hide modes here. This is due to AMP's specific behavior. You will be able to lock or unlock your content with the access variable which is provided by amp-access. Check out the poool-widget section just below.

The amp-access-poool component does not require an authorization or pingback configuration because it is pre-configured to work with Poool.

For more information about modes, check out our SDK documentation.

Configurations

You have to set configuration attributes within AMP in camelCase instead of the underscore (" _ ") symbol traditionally used by Poool.

For example : use customSegment="amp-custom-segment" to achieve poool("config", "custom_segment", "amp-custom-segment");.

HTML sections

Set poool-widget section, which contain poool paywall when access isn't granted.

The amp-access-poool component requires 3 different sections:

  • The article preview, shown when access hasn't been granted yet (with amp-access="NOT access") and identified by Poool using the poool-access-preview attribute
  • The article content, shown when access has been granted (with amp-access="access"), hidden by the amp-access-hide attribute until access has been granted, and identified by Poool using the poool-access-content attribute
  • Poool's Paywall container, shown when access hasn't been granted yet (with amp-access="NOT error AND NOT access"), identified by Poool using the 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 script - poool config

Example: Basic paywall configuration (with default values)

Configuration is similar to AMP Access, except no authorization, pingback or login url is required.

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

Example: Show a paywall for a user in a custom group/segment called "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>

For more information about configuration variables, check out our SDK documentation.

Attributes

bundleID (required)

Your App ID (you can find it on your Dashboard).

itemID (required)

Your unique article ID.

pageType (required)

Used to tell Poool that a page has been visited by the current user. See documentation for more information.

debug

Enable/disable debug mode. See documentation for more information.

forceWidget

Override current widget for user. See documentation for more information.

loginButtonEnabled

Enable/disable paywall "login" button. See documentation for more information.

signatureEnabled

Enable/disable paywall signature, shown under article content when the article has been unlocked. See documentation for more information.

videoClient

Set default video client (vast, googima) for video widget. See documentation for more information.

customSegment

Override native segments with a custom group/segment slug. See documentation for more information.

cookiesEnabled

Following latest GDPR requirements, we decided to disable cookies by default inside our paywall. You will have to explicitly set this attribute to reflect the user's consent. See documentation for more information.

locale

Set default locale for all texts inside the paywall. See documentation for more information.

context

Override default or native contexts with a custom context value. See documentation for more information.

Validation

See amp-access-poool rules in the AMP validator specification.

Bạn cần được trợ giúp thêm?

Bạn đã đọc tài liệu này hàng chục lần, nhưng nó không thật sự trả lời mọi thắc mắc của bạn? Có lẽ những người khác cũng cảm thấy như vậy: hãy liên hệ với họ trên Stack Overflow.

Truy cập Stack Overflow
Bạn tìm thấy một lỗi hoặc cần bổ sung một tính năng?

Dự án AMP đặc biệt khuyến khích sự tham gia và đóng góp của bạn! Chúng tôi hi vọng bạn sẽ trở thành một người tham gia tích cực trong cộng đồng mã nguồn mở của chúng tôi, nhưng chúng tôi cũng chào mừng các đóng góp đơn lẻ về vấn đề mà bạn đặc biệt quan tâm.

Truy cập GitHub