3rd Party Analytics

Tracking Events

Superwall automatically tracks analytical events to do with the paywall for you. You can view the list of events here. We encourage you to also track them in your own analytics by implementing trackAnalyticsEvent(withName:params:) in your PaywallDelegate:

extension PaywallService: PaywallDelegate {
  func trackAnalyticsEvent(
    withName name: String,
    params: [String: Any]
  ) {
    MyAnalyticsService.shared.track(name, params)
  }
}
- (void)trackAnalyticsEventWithName:(NSString *)name params:(NSDictionary<NSString *,id> *)params
{
    NSLog(@"Analytics event: %@", name);
}

If you'd like to override our naming convention, you can do so as follows:

func trackAnalyticsEvent(
  withName name: String,
  params: [String: Any]
) {
  guard let event = Paywall.EventName(rawValue: name) else {
    return
  } 
  switch event {
  case .firstSeen:
    // track your custom event
  case .appOpen:
    // track your custom event
  case .appLaunch:
    // track your custom event
  case .appClose:
    // track your custom event
  case .sessionStart:
    // track your custom event
  case .paywallOpen:
    // track your custom event
  case .paywallClose:
    // track your custom event
  case .transactionStart:
    // track your custom event
  case .transactionFail:
    // track your custom event
  case .transactionAbandon:
    // track your custom event
  case .transactionComplete:
    // track your custom event
  case .subscriptionStart:
    // track your custom event
  case .freeTrialStart:
    // track your custom event
  case .transactionRestore:
    // track your custom event
  case .nonRecurringProductPurchase:
    // track your custom event
  case .paywallResponseLoadStart:
    // track your custom event
  case .paywallResponseLoadFail:
    // track your custom event
  case .paywallResponseLoadComplete:
    // track your custom event
  case .paywallWebviewLoadStart:
    // track your custom event
  case .paywallWebviewLoadFail:
    // track your custom event
  case .paywallWebviewLoadComplete:
    // track your custom event
  }
}

What’s Next
Did this page help you?