MoEngageAnalyticsHandler

extension MoEngageAnalyticsHandler
  • Tracks an event originating from a rich push notification.

    Declaration

    Swift

    public func trackEventForRichNotification(
        name: String, properties: MoEngageProperties? = nil,
        forInstance sdkInstance: isolated MoEngageSDKInstance = #isolation,
        completionBlock: (@Sendable () -> Void)? = nil
    )

    Parameters

    name

    The event name to record.

    properties

    Optional custom attributes to attach to the event.

    sdkInstance

    The SDK instance to record the event against.

    completionBlock

    Called after the event has been added to the current batch.

  • handleOpenURL(_:) Asynchronous

    Processes a deep-link or universal-link URL across all active SDK instances.

    For each instance the URL is dispatched as a .didOpen module event so that analytics can update the session source. Live Activity and Campaigns managers receive the URL separately for their own handling.

    Must be called from @MoEngageGlobalActor context (or awaited from any task).

    Declaration

    Swift

    @MoEngageGlobalActor
    public func handleOpenURL(_ url: URL) async

    Parameters

    url

    The URL that was opened.

Static API Convenience

  • Set boolean user attribute

    Declaration

    Swift

    public static func setUserAttributeBool(
        _ value: Bool, withAttributeName attributeName: String, forAppID appID: String? = nil,
        isolation `actor`: isolated (any Actor)? = #isolation,
        file: StaticString = #fileID,
        line: UInt = #line,
        column: UInt = #column
    )

    Parameters

    value

    Boolean value i.e True/False

    attributeName

    attribute name

    appID

    MoEngage Account Identifier

  • Set boolean user attribute

    Declaration

    Swift

    @objc
    public static func setUserAttributeBool(
        _ value: Bool, withAttributeName attributeName: String, forAppID appID: String? = nil
    )

    Parameters

    value

    Boolean value i.e True/False

    attributeName

    attribute name

    appID

    MoEngage Account Identifier

  • Update provisional push opt-in device attribute status.

    Declaration

    Swift

    public static func pushProvisionalStatusUpdated(
        to status: Bool, forInstance sdkInstance: isolated MoEngageSDKInstance = #isolation
    )
  • Fetch the user unique Id

    Declaration

    Swift

    public static func getUserUniqueId(forInstance sdkInstance: isolated MoEngageSDKInstance = #isolation) -> String?
  • Fetch the user identities.

    Declaration

    Swift

    public static func getUserIdentities(
        forInstance sdkInstance: isolated MoEngageSDKInstance = #isolation
    ) -> [String: String]
  • Flush current batch.

    Declaration

    Swift

    public static func flush(
        forInstance sdkInstance: isolated MoEngageSDKInstance = #isolation, allowEmptyFlush: Bool
    )
  • Fetch the current session ID

    Declaration

    Swift

    public static func getCurrentSessionId(
        forInstance sdkInstance: isolated MoEngageSDKInstance = #isolation
    ) -> String?
  • Returns whether url is a recognised MoEngage source URL for the given instance.

    Declaration

    Swift

    public static func isValidSource(
        forInstance sdkInstance: isolated MoEngageSDKInstance = #isolation, withURL url: URL
    ) -> Bool
  • Declaration

    Swift

    public func pushProvisionalStatusUpdated(
        to status: Bool, forSdkInstance sdkInstance: MoEngageSDKInstance
    )
  • Declaration

    Swift

    public func getUserUniqueId(for sdkInstance: MoEngageSDKInstance) -> String?
  • Declaration

    Swift

    public func getUserIdentities(for sdkInstance: MoEngageSDKInstance) -> [String : String]
  • Declaration

    Swift

    public func flush(for sdkInstance: MoEngageSDKInstance, allowEmptyFlush: Bool)
  • Declaration

    Swift

    public func getCurrentSessionId(for sdkInstance: MoEngageSDKInstance) -> String?
  • Declaration

    Swift

    public func isValidSource(for sdkInstance: MoEngageSDKInstance, withURL url: URL) -> Bool
  • Declaration

    Swift

    public func getInSessionAttributes(sdkInstance: MoEngageSDKInstance) -> [String : Any]
  • Tracks an event originating from a rich push notification.

    Must be called on sdkInstance.sdkQueue.

    Declaration

    Swift

    @available(*, deprecated, message: "Use trackEventForRichNotification(name:properties:forInstance:completionBlock:﹚ instead")
    public func trackEventForRichNotification(
        name: String, properties: MoEngageProperties? = nil,
        sdkInstance: MoEngageSDKInstance, completionBlock: (@Sendable () -> Void)? = nil
    )
  • Declaration

    Swift

    public static func pushProvisionalStatusUpdated(to status: Bool, forSdkInstance sdkInstance: MoEngageSDKInstance)
  • Declaration

    Swift

    public static func getUserUniqueId(for sdkInstance: MoEngageSDKInstance) -> String?
  • Declaration

    Swift

    public static func getUserIdentities(for sdkInstance: MoEngageSDKInstance) -> [String : String]
  • Declaration

    Swift

    public static func flush(for sdkInstance: MoEngageSDKInstance, allowEmptyFlush: Bool)
  • Declaration

    Swift

    public static func getCurrentSessionId(for sdkInstance: MoEngageSDKInstance) -> String?
  • Declaration

    Swift

    public static func isValidSource(for sdkInstance: MoEngageSDKInstance, withURL url: URL) -> Bool