Last active
January 3, 2021 20:09
-
-
Save amsterdatech/caf653067dca10660e0b4c095872df79 to your computer and use it in GitHub Desktop.
Koin Analytics Module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const val TRACKER_SAMPLE = "sample_tracker" | |
val analyticsModule = module { | |
single<Tracker>(named(TRACKER_SAMPLE)) { SampleTracker(androidApplication()) } | |
single<Analytics> { AnalyticsImpl(androidApplication(), mutableListOf(get(named(TRACKER_SAMPLE)))) } | |
} | |
// Code on your base fragment or base activity | |
val analytics: Analytics by inject() | |
//And now you are able to just | |
analytics.track { name = EVENT.PAGE_VIEW | |
put(EVENT.PAGE_NAME, DISPLAY.YOUR_SCREEN)} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment