SAPcpmsUsage

open class SAPcpmsUsage

A convenience wrapper class above Usage. Use this class to report any event which later needs to be uploaded to SAPcpms.

  • The UsageReporter to be used.

    Declaration

    Swift

    open class var reporter: UsageReporter { get }
  • Reports a sessionStart event with informations based on the given parameters.

    The report will contain:

    • new session identifier in UUID format
    • application identifier
    • application version if there is any
    • device identifier
    • deviceModel (such as iPhone)
    • system name, such as iOS
    • system version

    If the reporter is disabled this method does nothing.

    Declaration

    Swift

    open class func sessionStart(applicationIdentifier: String, applicationVersion: String? = nil)
  • Reports a sessionEnd event.

    Declaration

    Swift

    open class func sessionEnd()
  • Reports an event. All the fields have default values associated with them.

    Declaration

    Swift

    open class func event(type: String? = nil, key: String = "Other", date: Date = Date(), duration: Double? = nil, screen: String? = nil, view: String? = nil, element: String? = nil, action: String? = nil, behaviour: String? = nil, case: String? = nil, category: String? = nil, result: String? = nil, unit: String? = nil, measurement: String? = nil, value: String? = nil, others: Any? = nil)

    Parameters

    type

    type of the record

    key

    key of the record, default is ‘Other’

    date

    date (time) of the record, default is ‘Date()’

    duration

    duration of the event

    screen

    screen parameter

    view

    view parameter

    element

    element parameter

    action

    action parameter

    behaviour

    behaviour parameter

    case

    case parameter

    category

    category parameter

    result

    result parameter

    unit

    unit parameter

    measurement

    measurement parameter

    value

    value parameter

    others

    others parameter

  • Reports an eventStart. All the fields have default values associated with them.

    Declaration

    Swift

    open class func eventStart(type: String? = nil, key: String = "Other", date: Date = Date(), duration: Double? = nil, screen: String? = nil, view: String? = nil, element: String? = nil, action: String? = nil, behaviour: String? = nil, case: String? = nil, category: String? = nil, result: String? = nil, unit: String? = nil, measurement: String? = nil, value: String? = nil, others: Any? = nil)

    Parameters

    type

    type of the record

    key

    key of the record, default is ‘Other’

    date

    date (time) of the record, default is ‘Date()’

    duration

    duration of the event

    screen

    screen parameter

    view

    view parameter

    element

    element parameter

    action

    action parameter

    behaviour

    behaviour parameter

    case

    case parameter

    category

    category parameter

    result

    result parameter

    unit

    unit parameter

    measurement

    measurement parameter

    value

    value parameter

    others

    others parameter

  • Reports an eventEnd. All the fields have default values associated with them.

    Declaration

    Swift

    open class func eventEnd(type: String? = nil, key: String = "Other", date: Date = Date(), duration: Double? = nil, screen: String? = nil, view: String? = nil, element: String? = nil, action: String? = nil, behaviour: String? = nil, case: String? = nil, category: String? = nil, result: String? = nil, unit: String? = nil, measurement: String? = nil, value: String? = nil, others: Any? = nil)

    Parameters

    type

    type of the record

    key

    key of the record, default is ‘Other’

    date

    date (time) of the record, default is ‘Date()’

    duration

    duration of the event

    screen

    screen parameter

    view

    view parameter

    element

    element parameter

    action

    action parameter

    behaviour

    behaviour parameter

    case

    case parameter

    category

    category parameter

    result

    result parameter

    unit

    unit parameter

    measurement

    measurement parameter

    value

    value parameter

    others

    others parameter

  • Enum of possible events describing app usage.

    See more

    Declaration

    Swift

    public enum BehaviorEvent : String
  • Reports a behavior event representing a user’s app usage.

    Declaration

    Swift

    public class func logBehaviorEvent(behaviorEvent: BehaviorEvent, viewIdentifier: String, elementIdentifier: String? = nil, action: String? = nil, value: String? = nil)

    Parameters

    behaviorEvent

    The type of event (e.g., a view appearing, or user interacting with UI element)

    viewIdentifier

    Human-readable name of the current view controller

    elementIdentifier

    UI entity or control that the user interacted with (e.g., a TableView, button, slider, checkbox)

    action

    Action performed by user, such as selecting a row in a table, or performing a gesture

    value

    Value relevant to the interaction, if applicable (e.g., product name or ID of a row selected in a table of products)