ParseAnalytics

public struct ParseAnalytics : ParseType, Hashable

ParseAnalytics provides an interface to Parse’s logging and analytics backend.

Warning

For iOS 14.0, macOS 11.0, macCatalyst 14.0, tvOS 14.0, you will need to request tracking authorization for ParseAnalytics to work. See Apple’s documentation for more for details.
  • The name of the custom event to report to Parse as having happened.

    Declaration

    Swift

    public let name: String
  • at

    Explicitly set the time associated with a given event. If not provided the server time will be used.

    Declaration

    Swift

    public var at: Date?
  • The dictionary of information by which to segment this event.

    Declaration

    Swift

    public var dimensions: [String : String]?
  • Create an instance of ParseAnalytics for tracking.

    Declaration

    Swift

    public init (name: String,
                 dimensions: [String: String]? = nil,
                 at: Date? = nil)

    Parameters

    name

    The name of the custom event to report to Parse as having happened.

    dimensions

    The dictionary of information by which to segment this event. Defaults to nil.

    at

    Explicitly set the time associated with a given event. If not provided the server time will be used. Defaults to nil.

  • Tracks asynchronously this application being launched. If this happened as the result of the user opening a push notification, this method sends along information to correlate this open with that push.

  • Tracks asynchronously this application being launched with additional dimensions.

    Declaration

    Swift

    static public func trackAppOpened(dimensions: [String: String]? = nil,
                                      at date: Date? = nil,
                                      options: API.Options = [],
                                      callbackQueue: DispatchQueue = .main,
                                      completion: @escaping (Result<Void, ParseError>) -> Void)

    Parameters

    dimensions

    The dictionary of information by which to segment this event and can be empty or nil.

    at

    Explicitly set the time associated with a given event. If not provided the server time will be used.

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    A block that will be called when file deletes or fails. It should have the following argument signature: (Result<Void, ParseError>)

  • Tracks asynchronously the occurrence of a custom event.

    Declaration

    Swift

    public func track(options: API.Options = [],
                      callbackQueue: DispatchQueue = .main,
                      completion: @escaping (Result<Void, ParseError>) -> Void)

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    A block that will be called when file deletes or fails. It should have the following argument signature: (Result<Void, ParseError>)

  • Tracks asynchronously the occurrence of a custom event with additional dimensions.

    Declaration

    Swift

    public mutating func track(dimensions: [String: String]?,
                               at date: Date? = nil,
                               options: API.Options = [],
                               callbackQueue: DispatchQueue = .main,
                               completion: @escaping (Result<Void, ParseError>) -> Void)

    Parameters

    dimensions

    The dictionary of information by which to segment this event and can be empty or nil.

    at

    Explicitly set the time associated with a given event. If not provided the server time will be used.

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    A block that will be called when file deletes or fails. It should have the following argument signature: (Result<Void, ParseError>)

Combine

  • Tracks asynchronously this application being launched. If this happened as the result of the user opening a push notification, this method sends along information to correlate this open with that push. Publishes when complete.

  • Tracks asynchronously this application being launched. If this happened as the result of the user opening a push notification, this method sends along information to correlate this open with that push. Publishes when complete.

    Declaration

    Swift

    static func trackAppOpenedPublisher(dimensions: [String: String]? = nil,
                                        at date: Date? = nil,
                                        options: API.Options = []) -> Future<Void, ParseError>

    Parameters

    dimensions

    The dictionary of information by which to segment this event and can be empty or nil.

    at

    Explicitly set the time associated with a given event. If not provided the server time will be used.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

  • Tracks asynchronously the occurrence of a custom event. Publishes when complete.

    Declaration

    Swift

    func trackPublisher(options: API.Options = []) -> Future<Void, ParseError>

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

  • Tracks asynchronously the occurrence of a custom event with additional dimensions. Publishes when complete.

    Warning

    This method makes a copy of the current ParseAnalytics and then mutates it. You will not have access to the mutated analytic after calling this method.

    Declaration

    Swift

    func trackPublisher(dimensions: [String: String]?,
                        at date: Date? = nil,
                        options: API.Options = []) -> Future<Void, ParseError>

    Parameters

    dimensions

    The dictionary of information by which to segment this event and can be empty or nil.

    at

    Explicitly set the time associated with a given event. If not provided the server time will be used.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.