EventKT - Track it all
About EventKT
An innovative In-house SDK designed to seamlessly integrate with your Android application and provide comprehensive tracking capabilities right out of the box.
Why use EventKT?
Efficient Event Tracking by grouping events and making API call at specified intervals.
High Customization of grouping intervals, defining custom event thresholds, or configuring network-related settings.
Event Caching Mechanism to ensure the reliability of your data by incorporating in memory and disk caching.
Fully Kotlin and User-Friendly ensuring that integrating analytics into your app is a straightforward process.
Integration with Third-Party Trackers that allows you to use both in-house analytics and other popular trackers simultaneously.
Networking Flexibility by providing the option for clients to opt out of automatic networking and instead get callbacks with list of events.
High level design
ITracker — Interface containing track methods. Implemented by EventKtTracker (Main core class of EventKT library), FirebaseTracker, MixpanelTracker, AmplitudeTracker.
EventTracker — Core class interacting with the client. Manages all trackers and delegates calls to specific trackers. Adds base parameters to each event before delegating the tracking call to individual trackers.
EventKtTracker — The central class of the library, serving as the starting point for the entire framework. Initiates and creates all dependencies required by the library. Has access to EventManager.
EventManager — Manages events, handles grouping logic, network state, and interactions with caching and networking classes. Manages the state of each event, providing a transactional approach to safeguard against crashes.
IGroupEventListener — Interface containing onEventGrouped method which gets invoked every time a group of events are ready for network call.
NetworkCallManager — Library makes the POST API call with help of API URL and API key passed by client.
ClientCallbackProvider — Library invokes the lambda function and client can make the network call itself.
ICacheScheme — Interface containing various methods related to storage of events in memory and disk.
InMemoryCacheManager — Responsible for keeping the list of events in the memory.
FileCacheManager — Responsible for keeping the list of events in the disk to safeguard from crashes. It keep itself in sync with memory.
Usage
//Add dependency with latest version
implementation 'com.github.khushpanchal.EventKT:eventkt:0.1.0'
//Initialize on Application onCreate()
class MainApplication : Application() {
lateinit var eventTracker: EventTracker
override fun onCreate() {
super.onCreate()
eventTracker = EventTracker.Builder().addTracker(
EventKtTracker.init(
context = this,
apiUrl = "your API URL",
apiKey = "your API Key"
)
).build()
}
}
//To use
val parameters = hashMapOf<String, Any>()
parameters["eventSpecificKey1"] = "eventSpecificValue1"
parameters["eventSpecificKey2"] = "eventSpecificValue2"
eventTracker.track("appOpen", parameters)
Extensions
EventKT extends its functionality by providing integration with third-party analytics trackers, allowing clients to leverage the unique capabilities of Firebase, Mixpanel, and Amplitude. Clients can easily add these extensions to the library to include additional tracking methods along with it’s own in house sdk.
- Firebase
//Add dependency with latest version
implementation 'com.github.khushpanchal.EventKT:eventkt-firebase:0.1.0'
- Add firebase to your project. Add firebase project
val firebaseTracker = FirebaseTracker.init(this) // initialize the firebase
val eventTracker = EventTracker.Builder().addTracker(firebaseTracker).build() // add firebase tracker while creating EventTracker in application onCreate()
2. Mixpanel
//Add dependency with latest version
implementation 'com.github.khushpanchal.EventKT:eventkt-mixpanel:0.1.0'
- Get a unique token from mixpanel. Get token from mixpanel
val mixpanelTracker = MixpanelTracker.init(this, "your unique token")
val eventTracker = EventTracker.Builder().addTracker(mixpanelTracker).build() // add mixpanel tracker while creating EventTracker in application onCreate()
3. Amplitude
//Add dependency with latest version
implementation 'com.github.khushpanchal.EventKT:eventkt-amplitude:0.1.0'
- Get a unique API key from amplitude. Get API Key from amplitude
val amplitudeTracker = AmplitudeTracker.init(this, "your unique API key")
val eventTracker = EventTracker.Builder().addTracker(amplitudeTracker).build() // add amplitude tracker while creating EventTracker in application onCreate()
EventKT provides lot more features with plenty of customization options, check out the below links for more information:
Github Project: https://github.com/khushpanchal/EventKT
Full API reference: https://khushpanchal.github.io/EventKT/
Contact Me
Linkedin: https://www.linkedin.com/in/khush-panchal-241098170/
Subscribe to my newsletter
Read articles from Khush Panchal directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Khush Panchal
Khush Panchal
Currently working as an Android Engineer at ALLEN Digital, previously worked at MX Player (Acquired by Amazon), a popular video streaming platform with over 1 billion downloads, where I was involved in developing features for the SVOD, Ad Tech and Smart TV domains. I have hands-on experience in all stages of the development cycle, from planning and design to deployment, using Java, Kotlin, Android, XML, Compose, KMP, Exoplayer, MVVM, Flow, and Coroutines. I graduated from IIT Kharagpur, and received the Institute Silver Medal award for the best performance among all the students of the department. I also received the Prof. Sudhir Ranjan Sengupta Memorial Prize for excellence in academics. In addition to my professional work, I actively create open-source projects, with over 600 stars across various repositories, including EventKT (A highly customisable android tracking library) and Ketch (An android file downloader library). I also write technical blogs explaining complex topics with simplicity. I am passionate about learning new technologies, solving challenging problems, and collaborating with diverse teams. I am always interested in exciting projects and potential opportunities to contribute.