Site Tools


paywall_invoker:javascript_events

Paywall Javascript events

These are the Javascript events that the Paperview Paywall fires on the global window object.

All events fired by the Paywall are prefixed with paperview::. This allows you to easily distinguish between Paywall events and events fired by other components in the web page.

Most – if not all – of these events provide an object containing relevant information that you can use in your custom event listeners. You can access this information like so:

window.addEventListener("paperview::<event you're listening for>", function(_event) {
  // you can do stuff here; the relevant information is provided as attributes in _event.detail
});

Or, if you're using jQuery:

jQuery(window).on("paperview::<event you're listening for>", function(_event) {
  // 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's Unique ID for use by Publishers. In order to protect the Reader's anonymity, this is different from the Reader's statistics ID that the Publisher gets when exporting list of article purchases, etc., from the Paperview backoffice.
  • publication: The unique ID of the publication.
  • article: The article's unique ID (in Paperview, not in your system).

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, the provided publication and article unique IDs may prove useful for cases in which such information is not easily available.

paperview::lib_loaded

Fired when the invoker library finishes loading (similar to the window's load event).

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

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 X's ID, allowing them to invoke the Paperview API and specify that same reader X.

paperview::reader_registered

Fired when the Reader finishes registering.

paperview::reader_logged_in

Fired when the Reader logs in.

paperview::reader_logged_out

Fired when the Reader logs out.

paperview::paywall_closed

Fired when the Paywall is manually closed by the Reader (logged in or otherwise).

paperview::content_replaced

Fired when the current page's gibberish content has been replaced with the real article content.

paperview::article_purchased

Fired when the Reader purchases the article.

paperview::article_read_free

Fired when the Reader chooses to read the article for free. Very similar to article_purchased, the difference being that the article was not actually purchased.

paperview::bundle_purchased

Fired when the Reader purchases a bundle.

The event object also contains the following attribute:

  • bundle: The bundle's unique ID (which can be used to identify the bundle using the Paperview API).

paperview::reader_subscribed

Fired when the Reader subscribes the publication.

The event object also contains the following attribute:

  • subscription: The subscription's unique ID (which can be used to identify the subscription using the Paperview API).
paywall_invoker/javascript_events.txt · Last modified: by 127.0.0.1