paywall_invoker:imperative
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| paywall_invoker:imperative [2023/11/24 02:07] – joaosaraiva | paywall_invoker:imperative [2026/03/27 17:24] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Paywall imperative invocation ====== | ||
| + | In addition to the [[paywall_invoker: | ||
| + | |||
| + | The Paywall can be used in imperative mode simply by [[paywall_invoker: | ||
| + | <code javascript> | ||
| + | Paperview | ||
| + | .set('< | ||
| + | .do('< | ||
| + | </ | ||
| + | |||
| + | Of course, the '' | ||
| + | You can address this by [[paywall_invoker: | ||
| + | <code javascript> | ||
| + | function(r){if(!r.Paperview){var t=r.document, | ||
| + | Paperview | ||
| + | .set('< | ||
| + | .do('< | ||
| + | </ | ||
| + | Note that this snippet also ends up setting the DOM element that is the parent to the '' | ||
| + | |||
| + | A complete example with the bare minimum to invoke the Paywall could be: | ||
| + | <code html> | ||
| + | < | ||
| + | function(r){if(!r.Paperview){var t=r.document, | ||
| + | |||
| + | Paperview | ||
| + | .set(' | ||
| + | .set(' | ||
| + | .do() | ||
| + | </ | ||
| + | <script src=" | ||
| + | </ | ||
| + | Note that the '' | ||
| + | |||
| + | ===== Paywall commands ===== | ||
| + | |||
| + | The Paywall script supports a set of commands that are detailed in this page. | ||
| + | |||
| + | Be aware that commands are not cumulative, i.e. any call to a certain command will **overwrite** previous calls to that same command: | ||
| + | <code javascript> | ||
| + | Paperview | ||
| + | .set(' | ||
| + | .set(' | ||
| + | .set(' | ||
| + | .do() | ||
| + | </ | ||
| + | In this example, the Paywall will open for acquiring the article '' | ||
| + | ==== Paperview.set(' | ||
| + | |||
| + | **Argument type: string**\\ | ||
| + | The Publication ID for the Publication which provides the desired article, bundles, or subscriptions. This is always mandatory, except when the app workflow is '' | ||
| + | |||
| + | ==== Paperview.set(' | ||
| + | |||
| + | **Argument type: string**\\ | ||
| + | The Article ID for the desired article.\\ | ||
| + | If this is provided, the Paywall will show the article acquisition screen, along with the possibility to acquire any bundles in which the article is included. Otherwise, only the Publication' | ||
| + | |||
| + | ==== Paperview.set(' | ||
| + | |||
| + | **Argument type: one or more string or DOM elements**\\ | ||
| + | A string (with a CSS selector) or a DOM element into which the article' | ||
| + | Of course, this can also be an ordered Array of such elements, for cases in which the article has multiple content pieces.\\ | ||
| + | If you call this multiple times, the new value(s) will be // | ||
| + | By default, this will be initialized with the DOM element that is the parent to the '' | ||
| + | |||
| + | ==== Paperview.set(' | ||
| + | |||
| + | **Argument type: string**\\ | ||
| + | A [[reading_token_provider: | ||
| + | |||
| + | ==== Paperview.set(' | ||
| + | |||
| + | **Argument type: string**\\ | ||
| + | A ROAuth token to automatically login the Reader. This can be used to enable single sign-on (SSO) scenarios. | ||
| + | |||
| + | ==== Paperview.set(' | ||
| + | |||
| + | **Argument type: string**\\ | ||
| + | The ID of the Reader that referred the current Reader to this article (and Paywall).\\ | ||
| + | In most cases, this command will not be used, and the referrer will be determined from the current URL instead. | ||
| + | |||
| + | ==== Paperview.set(' | ||
| + | |||
| + | **Argument type: string**\\ | ||
| + | The ID of the Reseller that is " | ||
| + | |||
| + | ==== Paperview.set(' | ||
| + | |||
| + | **Argument type: boolean**\\ | ||
| + | Whether **anonymous** Readers should **not** view the initial text explaining that they need a Paperview account in order to acquire an article, bundle, or subscription. Authenticated Readers will not view that message.\\ | ||
| + | Any " | ||
| + | |||
| + | ==== Paperview.set(' | ||
| + | |||
| + | **Argument type: boolean**\\ | ||
| + | Whether the Paywall should go back to the previous page if it is manually closed by the Reader. The default is '' | ||
| + | |||
| + | ==== Paperview.set(' | ||
| + | |||
| + | **Argument type: one or more strings**\\ | ||
| + | A list of Paywall screens that should be hidden from the Reader. The screens available are '' | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | An example for a Paywall that should **only** display the article acquisition screen would be: '' | ||
| + | If you call this multiple times, the new value(s) will be // | ||
| + | |||
| + | ==== Paperview.set(' | ||
| + | |||
| + | **Argument type: string**\\ | ||
| + | A Publisher-specific token that should be associated with any transaction that is performed during this paywall interaction. Can be used by the Publisher to associate purchases (such as subscriptions) with other information that has previously been collected by the Publisher. | ||
| + | |||
| + | ==== Paperview.set(' | ||
| + | |||
| + | **Argument type: string**\\ | ||
| + | What part of the target HTML DOM element should be replaced by the article content. Can be one of '' | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | ==== Paperview.do([< | ||
| + | |||
| + | **Argument type: string or none**\\ | ||
| + | Perform the specified workflow, displaying the Paywall if necessary. | ||
| + | |||
| + | The Paywall workflow to be used can be specified by an argument to the command, a string with one of '' | ||
| + | If no argument is provided, and if the [[# | ||
| + | |||
| + | ==== Paperview.set(' | ||
| + | |||
| + | Clears the stored set of commands. This command receives no arguments. | ||
