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() -
event(type:key:date:duration:screen:view:element:action:behaviour:case:category:result:unit:measurement:value:others:)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
typetype of the record
keykey of the record, default is ‘Other’
datedate (time) of the record, default is ‘Date()’
durationduration of the event
screenscreen parameter
viewview parameter
elementelement parameter
actionaction parameter
behaviourbehaviour parameter
casecase parameter
categorycategory parameter
resultresult parameter
unitunit parameter
measurementmeasurement parameter
valuevalue parameter
othersothers parameter
-
eventStart(type:key:date:duration:screen:view:element:action:behaviour:case:category:result:unit:measurement:value:others:)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
typetype of the record
keykey of the record, default is ‘Other’
datedate (time) of the record, default is ‘Date()’
durationduration of the event
screenscreen parameter
viewview parameter
elementelement parameter
actionaction parameter
behaviourbehaviour parameter
casecase parameter
categorycategory parameter
resultresult parameter
unitunit parameter
measurementmeasurement parameter
valuevalue parameter
othersothers parameter
-
eventEnd(type:key:date:duration:screen:view:element:action:behaviour:case:category:result:unit:measurement:value:others:)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
typetype of the record
keykey of the record, default is ‘Other’
datedate (time) of the record, default is ‘Date()’
durationduration of the event
screenscreen parameter
viewview parameter
elementelement parameter
actionaction parameter
behaviourbehaviour parameter
casecase parameter
categorycategory parameter
resultresult parameter
unitunit parameter
measurementmeasurement parameter
valuevalue parameter
othersothers parameter
-
Enum of possible events describing app usage.
See moreDeclaration
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
behaviorEventThe type of event (e.g., a view appearing, or user interacting with UI element)
viewIdentifierHuman-readable name of the current view controller
elementIdentifierUI entity or control that the user interacted with (e.g., a TableView, button, slider, checkbox)
actionAction performed by user, such as selecting a row in a table, or performing a gesture
valueValue relevant to the interaction, if applicable (e.g., product name or ID of a row selected in a table of products)