Elegant implementation of Multiplatform Analytics in ReactiveStreams.
See platform declaration on how to configure which service is used.
Declare your events
enum class AnalyticsEvents : AnalyticsEvent {
myAppEvent,
myClickEvent
}
Identify user
AnalyticsService.identifyUser(userId, mapOf("userProperty" to value))
Track an event
AnalyticsService.trackEvent(AnalyticsEvents.myAppEvent, mapOf("eventProperty" to value))
Track tap action
val button = MutableMetaButton()
button.onTap = TrackableMetaAction(AnalyticsEvents.myClickEvent) {
// Code to execute on tap
}
iOS - swift extensions Android - firebase-ktx
iOS - swift extensions Android - firebase-ktx
Implement AnalyticsService
Use the code bellow to import the core module of trikot analytics.
dependencies {
maven { url("https://s3.amazonaws.com/mirego-maven/public") }
}
ios() {
binaries {
framework {
export "com.mirego.trikot:analytics:$trikot_version"
}
}
}
sourceSets {
commonMain {
dependencies {
implementation "com.mirego.trikot:analytics:$trikot_version"
}
}
}
If you wish to use the trikot.viewmodel
integration, you have to import it from a separate module.
implementation "com.mirego.trikot:analytics-viewmodel:$trikot_version"