PTAnalyticsManager


@interface PTAnalyticsManager : NSObject <PTAnalyticsHandler>

The PTAnalyticsManager class dispatches analytics events to registered handlers conforming to the PTAnalyticsHandler protocol. Each event sent to an analytics manager is dispatched to all registered handlers capable of handling the event.

  • The default analytics manager.

    Declaration

    Objective-C

    @property (class, nonatomic, strong, readonly) PTAnalyticsManager *_Nonnull defaultManager;

    Swift

    class var `default`: PTAnalyticsManager { get }
  • The currently registered analytics handlers.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSArray<id<PTAnalyticsHandler>> *_Nonnull handlers;

    Swift

    var handlers: [any PTAnalyticsHandler] { get }
  • Registers an analytics handler with the manager.

    Declaration

    Objective-C

    - (void)addHandler:(nonnull id<PTAnalyticsHandler>)handler;

    Swift

    func addHandler(_ handler: any PTAnalyticsHandler)

    Parameters

    handler

    the analytics handler to register

  • Removes an analytics handler previously registered with the manager.

    Declaration

    Objective-C

    - (void)removeHandler:(nonnull id<PTAnalyticsHandler>)handler;

    Swift

    func removeHandler(_ handler: any PTAnalyticsHandler)

    Parameters

    handler

    the analytics handler to remove