#Events

Most actions completed by a visitor will trigger custom events for which you will be able to assign a listener.

#Usage

fun on*(listener: (Event?) -> Unit): Access

fun off(event: PaywallEvents): Access

#Available events

#onIdentityAvailable

  • Arguments: { identityEvent: { userId: String, contextName: String, contextType: String, contextValue: String, groupSlug: String, scenarioName: String, widget: String, actionName: String } }
Triggered after the first paywall initialization, when the user ID is available.

#onLock

Triggered when the paywall locks the current article.

#onReady

  • Arguments: { widgetEvent: { widget: String, actionName: String }
Triggered when the paywall is ready to be displayed.

#onPaywallSeen

  • Arguments: { widgetEvent: { widget: String, actionName: String } }
Triggered when the paywall is fully loaded and displayed inside the page.

#onRelease

  • Arguments: { widgetEvent: { widget: String, actionName: String } }
Triggered when the paywall unlocks the current content.

#onRegister

  • Arguments: { registerEvent: { email: String, passId: String?, newsletterId: String? } }
Triggered when a user registers to your newsletter using the newsletter widget or the pass widget.
For example, thanks to this event, you'll be able to save a user's email address using tools such as Mailchimp and Sendgrid.

#onSubscribeClick

  • Arguments: { clickEvent: { widget: String, actionName: String, button: String, url: String } }
Triggered when a user has tapped a subscribe button/link inside the paywall.

#onLoginClick

  • Arguments: { clickEvent: { widget: String, actionName: String, button: String, url: String } }
Triggered when a user has tapped a login button/link inside the paywall.

#onDiscoveryLinkClick

  • Arguments: { clickEvent: { widget: String, actionName: String, button: String, url: String } }
Triggered when a user has clicked the Link Discovery widget's button inside the paywall.

#onAlternativeClick

  • Arguments: { alternativeClickEvent: { widget: String, actionName: String, button: String } }
Triggered when a user has clicked the 'No thanks' link in the widget. Initialy loaded action will be replaced by an alternative one, set up in the dashboard in journey / actions configurations.

#onError

  • Arguments: { errorEvent: Exception }
Triggered when an error occurs during the paywall initialization.

#onFormSubmit

  • Arguments: { formEvent: { fields: Map<String, Any>, widget: String, actionName: String } }
Triggered when a user registers through a form using the Form widget.
For example, thanks to this event, you'll be able to save a user's provided informations using tools such as a DMP.

#onAnswer

  • Arguments: { answerEvent: { questionId: String, answer: String } }
Triggered when a user answers a question using the Survey widget.

#onCustomButtonClick

  • Arguments: { clickEvent: { widget: String, actionName: String, name: String, url: String, buttonId: String } }
Triggered after a click on a button component, used in an advanced appearance or a form. The name property is for when the button is in "event" mode, url is for when the button is in "link" mode.

#onDestroy

Triggered when the paywall is destroyed.

#onDismissButtonSheet

Triggered when the user dismisses the bottom sheet paywall.