AMP

amp-access-poool

DescriptionDisplays a Poool paywall
. See poool.fr and demo.poool.fr for more details.. amp-access-poool is based on, and requires AMP Access.
Required ScriptsNotice that you need scripts for "amp-access-poool", "amp-access" and "amp-analytics".
<script async custom-element="amp-access" src="https://cdn.ampproject.org/v0/amp-access-0.1.js"></script>
<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
<script async custom-element="amp-access-poool" src="https://cdn.ampproject.org/v0/amp-access-poool-0.1.js"></script>

Behavior

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

If you are unfortunately familiar with Poool's behavior outside AMP, you cannot use excerpt and hidden modes here, due to AMP's particular behavior. You will be able to lock or unlock your content with the access variable which is provided by amp environment. Check poool-widget section just bellow.

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

For more informations about modes, check our documentation.

Configurations

HTML sections

Set poool-widget section, which contain poool paywall when access isn't granted. Set the poool-widget section bellow both shown and hidden content like the following example. First section is the article preview, always shown to readers. Second section need an access (amp-access="access" attribute) to be displayed. Moreover, this section require an id poool-access. Third section is poool, called when access isn't granted (amp-access="NOT access" attribute).

<section>
  <p>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    Curabitur ullamcorper turpis vel commodo scelerisque.
  </p>
</section>

<section id="poool-access" amp-access="access" amp-access-hide class="article-body" itemprop="articleBody">
  <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">
    <div id="poool-widget"></div>
</section>

amp-access script - poool config

Example: Basic paywall config (with default values)

Configuration is similar to AMP Access, but no authorization, pingback and login links are 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",
      "mode": "custom",
      "cookiesEnabled": "true",
      "itemID": "amp-example-article",
      "customSegment": "amp-custom-segment"
    }
  }
</script>

For more informations about config variables, check our documentation.

Notice

You have to set poool config attributes within AMP, in camelCase, instead of the underline (" _ ") symbol traditionally used by Poool.

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

Attributes

bundleID (required)

Your App ID (key given by Poool).

itemID (required)

Your article ID.

pageType (required)

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

mode

For AMP environment, you'll have to set mode attribute to "custom". See documentation for more informations.

debug

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

forceWidget

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

loginButtonEnabled

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

signatureEnabled

Enable/disable paywall signature, shown under post content when the post has been unlocked by user. See documentation for more informations.

videoClient

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

customSegment

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

cookiesEnabled

Following latest GDPR requirements, we decided to disable cookies by default inside our paywall. Set this attribute to enable them when you asked user about his/her consent. See documentation for more informations.

Validation

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

Perlu bantuan lainnya?

You've read this document a dozen times but it doesn't really cover all of your questions? Maybe other people felt the same: reach out to them on Stack Overflow.

Go to Stack Overflow
Found a bug or missing a feature?

The AMP project strongly encourages your participation and contributions! We hope you'll become an ongoing participant in our open source community but we also welcome one-off contributions for the issues you're particularly passionate about.

Go to GitHub