paywall_invoker:javascript_events
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| paywall_invoker:javascript_events [2021/01/02 01:51] – joaosaraiva | paywall_invoker:javascript_events [2026/03/27 17:24] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Paywall Javascript events ====== | ||
| + | These are the Javascript events that the Paperview Paywall fires on the global '' | ||
| + | |||
| + | All events fired by the Paywall are prefixed with **paperview:: | ||
| + | |||
| + | Most -- if not all -- of these events provide an object containing relevant information that you can use in [[paywall_invoker: | ||
| + | <code javascript> | ||
| + | window.addEventListener(" | ||
| + | // you can do stuff here; the relevant information is provided as attributes in _event.detail | ||
| + | }); | ||
| + | </ | ||
| + | Or, if you're using jQuery: | ||
| + | <code javascript> | ||
| + | jQuery(window).on(" | ||
| + | // you can do stuff here; the relevant information is provided as attributes in _event.detail | ||
| + | }); | ||
| + | </ | ||
| + | |||
| + | Almost all of these events include the following attributes (when available in the current context of the Paywall): | ||
| + | * reader_id: The authenticated Reader' | ||
| + | * publication: | ||
| + | * article: The article' | ||
| + | For simplicity, each event will only mention attributes other than the ones mentioned now, unless the attributes are particularly relevant to the event itself.\\ | ||
| + | Note that, in most cases, some of this information can also be found simply by looking at the current page (i.e., you can look at the current URL or anything else that is specific to your system). Nevertheless, | ||
| + | |||
| + | ===== paperview:: | ||
| + | |||
| + | Fired when the invoker library finishes loading (similar to the window' | ||
| + | |||
| + | **The event object does not contain any attributes.** | ||
| + | |||
| + | Note that **this event is only fired when the loaded Javascript library supports the Paywall imperative invocation commands**. When using declarative invocation, the Paywall is immediately launched on window load, and so this event would be irrelevant. | ||
| + | |||
| + | ===== paperview:: | ||
| + | |||
| + | Fired when the Paperview Reader ID becomes available (usually when the reader logs in, or when the content is immediately replaced without showing the Paywall). This Reader ID can be freely used by Publishers, although it may change whenever Paperview deems it convenient.\\ | ||
| + | Developers can use this event to capture a reader '' | ||
| + | |||
| + | ===== paperview:: | ||
| + | |||
| + | Fired when the Reader finishes registering. | ||
| + | |||
| + | ===== paperview:: | ||
| + | |||
| + | Fired when the Reader logs in. | ||
| + | |||
| + | ===== paperview:: | ||
| + | |||
| + | Fired when the Reader logs out. | ||
| + | |||
| + | ===== paperview:: | ||
| + | |||
| + | Fired when the Paywall is **manually** closed by the Reader (logged in or otherwise). | ||
| + | |||
| + | ===== paperview:: | ||
| + | |||
| + | Fired when the current page's gibberish content has been replaced with the real article content. | ||
| + | |||
| + | ===== paperview:: | ||
| + | |||
| + | Fired when the Reader purchases the article. | ||
| + | |||
| + | ===== paperview:: | ||
| + | |||
| + | Fired when the Reader chooses to read the article for free. Very similar to '' | ||
| + | |||
| + | ===== paperview:: | ||
| + | |||
| + | Fired when the Reader purchases a bundle. | ||
| + | |||
| + | The event object also contains the following attribute: | ||
| + | * bundle: The bundle' | ||
| + | |||
| + | ===== paperview:: | ||
| + | |||
| + | Fired when the Reader subscribes the publication. | ||
| + | |||
| + | The event object also contains the following attribute: | ||
| + | * subscription: | ||
