#Events
Most actions completed by a visitor will trigger custom events for which you will be able to assign a listener.
#Usage
.on*(once: Bool = false, _ event: @escaping (Event?) -> Void.off(_ event: String) -> Void#Available events
#onIdentityAvailable
- Arguments: { identityEvent: { userId: String, contextName: String, contextType: String, contextValue: String, groupSlug: String, scenarioName: String, widget: String, actionName: String, trigger: String, triggerType: String, triggerValue: 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, trigger: String, triggerType: String, triggerValue: String } }
Triggered when the paywall is fully loaded and displayed inside the page.
#onPaywallSeen
- Arguments: { widgetEvent: { widget: String, actionName: String, trigger: String, triggerType: String, triggerValue: String } }
Triggered when the paywall has been seen by the user (when it has entered the device's viewport).
#onRelease
- Arguments: { widgetEvent: { widget: String, actionName: String, trigger: String, triggerType: String, triggerValue: String } }
Triggered when the paywall unlocks the current content.
#onRegister
- Arguments: { registerEvent: { email: String, newsletterId: String, passId: 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.
#onSubscribeTapped
- Arguments: { clickEvent: { widget: String, actionName: String, button: String, url: String } }
Triggered when a user has tapped a subscribe button/link inside the paywall.
#onLoginTapped
- Arguments: { clickEvent: { widget: String, actionName: String, button: String, url: String } }
Triggered when a user has clicked a signin button/link inside the paywall.
#onDiscoveryLinkTapped
- 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.
#onAlternativeTapEvent
- 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: Error, forceRelease: () -> Void }
Triggered if an unknown/unexpected error has appeared when loading the paywall.
#onFormSubmit
- Arguments: { formEvent: { name: String, fields: { [fieldKey]: Any, ... }, valid: { [fieldKey]: Bool, ... } } }
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 after an answer is chosen in the survey widget.
#onCustomButtonTapped
- Arguments: { customButtonClickEvent: { url: String, buttonId: String } }
Triggered after a click on a button component, used in an advanced appearance or a form.