WLAnalyticsSwift

public class WLAnalyticsSwift : NSObject, IBMMobileFirstPlatformFoundation.WLDelegate, WLDelegateSwift

Contains WLAnalyticsSwift methods that manage analytics logs.

  • Undocumented

    Declaration

    Swift

    public static var shared: WLAnalyticsSwift?
  • Creates a shared instance to the WLAnalyticsSwift class.

    Declaration

    Swift

    public static func sharedInstance() -> WLAnalyticsSwift

    Return Value

    WLAnalyticsSwift object

  • This method adds a DeviceEvent for Analytics to collect.

    Declaration

    Swift

    public func addDeviceEventListener(deviceEvent: DeviceEvent)

    Parameters

    deviceEvent

    the DeviceEvent to collect

  • Disable analytics from collecting the specified DeviceEvent.

    Declaration

    Swift

    public func removeDeviceEventListener(deviceEvent: DeviceEvent)

    Parameters

    deviceEvent

    the DeviceEvent to remove

  • This method enables capturing of analytics log data.

    Declaration

    Swift

    public func enbale()
  • This method disables capturing of analytics log data.

    Declaration

    Swift

    public func disable()
  • This method sends the log file when the log buffer exists and is not empty.

    Declaration

    Swift

    public func send()
  • This method is the same as send, with the addition of a delegate that is notified when the send request succeeds or fails.

    Declaration

    Swift

    public func send(withDelegate: WLDelegateSwift)

    Parameters

    withDelegate

    WLDelegateSwift that handles the result of the send request with the onSuccess and onFailure methods.

  • This method logs analytics data Some data is already captured by the framework. To avoid collisions, the following keys will be excluded if logged in the metadata: appID appLabel appVersion appVersionCode appName appVersion deviceBrand deviceOSversion deviceOS deviceModel deviceID timezone timestamp.

    Declaration

    Swift

    public func log(message: String, withMetadata: [AnyHashable : Any])

    Parameters

    message

    Message to be logged.

    withMetadata

    Dictionary containing metadata to append to the log outpu

  • Specify current application user. If you want user-based analytics, you must use this method call. For example, use it when the user logs in, and call the unsetUserContext method when the user logs out. Or if your application supports user profiles, call this method when the user profile changes.

    Declaration

    Swift

    public func setUserContext(userContext: String)

    Parameters

    userContext

    the user name of the current user.

  • Unset any user context previously set. Use this when user explicitly logs out or is no longer active.

    Declaration

    Swift

    public func unsetUserContext()