This library demonstrates how you could decouple analytics libraries from your business logic code, effectively allowing you to:
- Add & remove analytics services quickly
- Add & remove events quickly
- Change event names and parameters according to the required kit
Add library to your gradle module
Initiate analytics and send events
//init tracker
snitch(this) {
http {
url = BuildConfig.EVENT_STREAM
}
log {
enable = true
level = Log.VERBOSE
}
}
//custom event
snitch(this).track {
name("ProductPosDetails_view")
.put("item_id", 424242L)
.put("item_name", "")
.put("price", "")
.put("percentage", 10.0)
.put("time_spent", Calendar.getInstance())
}
//screen event
snitch(this).screen {
screenName(MainActivity::class.java.simpleName.snakeCase())
}
- Implementation of common tracker like Firebase, Facebook, Mixpanel, ComScore and such
- Room for Database and removing SqliteOpenHelper
- WorkManager for background deferrable jobs and removing Alarms
- Coroutines for Async Code and removing executors service
- Koin/Dagger as DI instead of service locator/factory