import AnalyticsKit
AnalyticsKit Overview
AnalyticsKit is a Framework built on top of PostHog SDK to streamline the analytics process.
It is deeply integrated with other frameworks, but also allows the developer to easily use it wherever necessary.
We created the convenience function Analytics.caputure()
that can be called from anywhere in the app to capture an event.
The functions takes in a couple of parameters, to easily identify the event in the PostHog dashboard.
public class Analytics {
static public func capture(_ eventType: EventType,
id: String,
longDescription: String? = nil,
source: EventSource,
fromView: String? = nil,
relevancy: EventRelevancy? = nil)
}
eventType
- Type of event..error
or.info
onToggle
- A closure that is called when the checkmark is tapped.longDescription
- (Optional) Human readable, longer description of the event.source
- The source of the event..auth
,.db
,.iap
,.notif
,.aikit
, or.analytics
.fromView
- (Optional) To identify from which view the event was captured.relevancy
- (Optional) To identify the relevancy of the event..low
,.medium
or.high
. (Default:.medium
for.info
events and.high
for.error
events)
Additionally, AnalyticsKit comes with ViewModifiers that can be used to track UI interactions.