Custom Paywall Actions

Custom Paywall.js Events

SuperwallKit automatically recognizes elements on the paywall tagged with data tags. For example, elements tagged with data-pw-restore, data-pw-close and data-pw-purchase are recognised as restore, close, and purchase buttons respectively. The SDK links taps on these elements to corresponding logic in either the SDK or the delegate.

However, the SDK also lets you add your own custom identifiers to buttons, allowing you to tie any button tap in your paywall to real hard-coded application scoped logic.

For example, simply adding data-pw-custom="help_center" to a button in your HTML paywall gives you the opportunity to present a help center whenever that button is pressed. To set this up, implement handleCustomPaywallAction(withName:) in your SuperwallDelegate:

extension SuperwallService: SuperwallDelegate {
  func handleCustomPaywallAction(withName name: String) {
    if name == "help_center" {
// Inside PaywallService.m

- (void)handleCustomPaywallActionWithName:(NSString *)name
    NSLog(@"Custom button: %@", name);