Superwall

3rd Party Analytics

Hooking up Superwall events to 3rd party tools

SuperwallKit automatically tracks some internal events. You can view the list of events here. We encourage you to also track them in your own analytics by implementing the Superwall delegate. Using the handleSuperwallEvent(withInfo:) function, you can forward events to your analytics service:

@override
void handleSuperwallEvent(SuperwallEventInfo eventInfo) async {
  print("handleSuperwallEvent: $eventInfo");

  // Example usage...
  switch (eventInfo.event.type) {
    case EventType.appOpen:
      print("appOpen event");
    case EventType.deviceAttributes:
      print("deviceAttributes event: ${eventInfo.event.deviceAttributes} ");
    case EventType.paywallOpen:
      final paywallInfo = eventInfo.event.paywallInfo;
      print("paywallOpen event: ${paywallInfo} ");

      if (paywallInfo != null) {
        final identifier =  await paywallInfo.identifier;
        print("paywallInfo.identifier: ${identifier} ");

        final productIds =  await paywallInfo.productIds;
        print("paywallInfo.productIds: ${productIds} ");
      }
    default:
      break;
  }
}

You might also want to set user attribute to allow for Cohorting in 3rd Party Tools

Alternatively, if you want typed versions of all these events with associated values, you can access them via eventInfo.event:

@override
void handleSuperwallEvent(SuperwallEventInfo eventInfo) async {
  // Example usage...
  switch (eventInfo.event.type) {
    case PlacementType.appOpen:
      print("appOpen event");
    case PlacementType.deviceAttributes:
      print("deviceAttributes event: ${eventInfo.event.deviceAttributes} ");
    case PlacementType.paywallOpen:
      final paywallInfo = eventInfo.event.paywallInfo;
      print("paywallOpen event: ${paywallInfo} ");

      if (paywallInfo != null) {
        final identifier =  await paywallInfo.identifier;
        print("paywallInfo.identifier: ${identifier} ");

        final productIds =  await paywallInfo.productIds;
        print("paywallInfo.productIds: ${productIds} ");
      }
    default:
      break;
  }
}

Wanting to use events to see which product was purchased on a paywall? Check out this doc.

How is this guide?

On this page