The developer should initialize the “Tracker” class in the App delegate and pass the App Key, Workspace ID along with a couple of other parameters as below. The Tracker class provides a versatile implementation allowing developers a number of configuration options. During the init method call, the user’s session will be automatically created inside the SDK.
Method
@objc public func initialize(_ appKey: String, showLog: Bool = false, addGeo: Bool = false, sendBatch: TimeInterval = 60, waitForResponse: TimeInterval = 3, workSpaceId: String)
Parameters
appKey - Generated from the Datagran dashboard
showLog - Enable the debug logs
addGeo - Flag used to decide whether to append the geo parameter(latitude and longitude) in the Payloads or Not.
sendBatch - To send the events to the backend batch wise as per the specified interval. By default, it is 60seconds.
waitResponse - To set the API connection timeout. By default, it is 3 seconds.
workspaceId - Generated from the Datagran dashboard
Example
Tracker.shared.initialize("5ea161d978a221ed22861639", showLog: true, addGeo: getGPSStatus(), sendBatch: 20, waitForResponse: 30,workSpaceId: "5e8a03edda47df95e42a0165")