StanwoodAnalytics
open class StanwoodAnalytics
The base class for Analytics
-
Keys for user parameters.
Declaration
Swift
public struct Keys
-
The event types used for tracking.
Declaration
Swift
public enum TrackingEvent : String
-
Init method using the Builder pattern.
Declaration
Swift
public init(builder: Builder)
Parameters
builder
The builder pattern is used here to configure the analytics instance.
-
The Builder for this class.
Declaration
Swift
open static func builder() -> Builder
-
Track data using TrackingParameters struct. It iterates over all the trackers and calls track on each.
The parameters that are tracked depends on how each tracker is configured.
Declaration
Swift
open func track(trackingParameters: TrackingParameters)
Parameters
trackingParameters
TrackingParameters struct
-
Tracking Enabled. This is the value used for the next application start.
Declaration
Swift
open static func trackingEnabled() -> Bool
Return Value
Bool value that is stored in UserDefaults.
-
Set this value to false to stop the tracking, and on the next start it will be fully disabled. It is on by default.
If tracking is off, enabling it will call start in all the trackers.
This functionality is intended to be compatible with the EU directive on GDPR, and allows users to disable tracking in all frameworks.
As tracking is not disabled immediately an alert (localised in English and German) is displayed informing the user of this. To display the alert the framework assumes that the root view controller is either a UIViewController or a UINavigationController. If this is not the case the alert will fail to show. An optional parameter is provided to support injecting a view controller so that the present method can be called on it and display the alert that way.
Declaration
Swift
open func setTracking(enabled: Bool, on viewController: UIViewController? = nil)
Parameters
enabled
Bool. Will display an alert when disabled.
viewController
UIViewController. An optional parameter for a viewController to display the alert controller when disabling tracking.
-
Track custom keys. The implementation depends on the mapping in the custom trackers.
Declaration
Swift
open func track(trackerKeys: TrackerKeys)
Parameters
trackerKeys
TrackerKeys struct
-
Track NSError. Each tracker has a custom implementation for this method.
Declaration
Swift
open func track(error: NSError)
Parameters
error
NSError
-
Track Screen: Helper function to track the screen name along with the class name.
Declaration
Swift
open func trackScreen(name: String, className: String? = nil)
Parameters
name
String
className
String
-
The builder for this class.
See moreDeclaration
Swift
open class Builder