Skip to content

Latest commit

 

History

History
 
 

trikot-analytics

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Trikot.analytics

Elegant implementation of Multiplatform Analytics in ReactiveStreams.

Usage

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
}

Firebase

iOS - swift extensions Android - firebase-ktx

Mixpanel

iOS - swift extensions Android - firebase-ktx

Add more service

Implement AnalyticsService

Common

Import dependencies

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"