This “track” method is used to track the user’s standard events such as onClick, onLongClick and onFocusChange.

Method

@objc public func track(sender: Any, eventAction: EventAction, controller: UIViewController, characterKey: String = "", addGeo: Bool, viewName: String = "")

Parameters

sender	     - Action of the UI element.
eventAction	 - event ID based on the passing events which is defined in the SDK.
controller	 - The current view
characterKey - Character of the key pressed
addGeo	     - Flag used to decide whether to append the geo parameter(latitude and longitude) in the Payloads or Not.
viewName     - This would be name of click,long press or onfocus

Example

Tracker.shared.track(sender: sender, eventAction: .onClick, controller: self, addGeo: true, viewName: "clickButton")
Tracker.shared.track(sender: sender, eventAction: .onLongPress, controller: self, addGeo: true, viewName: "longPressButton")
Tracker.shared.track(sender: textField, eventAction: .onFocusChange, controller: self, addGeo: getGPSStatus(), viewName: "onFocusText")