EventKT - Track it all

Khush PanchalKhush Panchal
3 min read

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.

  1. Firebase
//Add dependency with latest version
implementation 'com.github.khushpanchal.EventKT:eventkt-firebase:0.1.0'
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'
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'
  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()

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/

0
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, making the learning journey smoother and more engaging for millions of students. Previously, I worked at Amazon MX Player, a popular video streaming platform with over 1 billion downloads, where I contributed to features across SVOD, Ad Tech, and Smart TV domains. I have hands-on experience across the entire Android development lifecycle — from planning and design to deployment — using modern tools and technologies like Kotlin, Jetpack Compose, KMP, CMP, ExoPlayer, Flow, and Coroutines. I graduated from IIT Kharagpur and was awarded the Institute Silver Medal for the best academic performance in my department, along with the Prof. Sudhir Ranjan Sengupta Memorial Prize for academic excellence. Beyond work, I’m an active open-source contributor with over 700 stars across various repositories, including EventKT (a highly customizable Android tracking library) and Ketch (an Android file downloader library with over 500 stars). I also write technical blogs that simplify complex topics for developers. I’m passionate about learning new technologies, solving challenging problems, and collaborating with diverse teams. Always open to exciting projects and opportunities to contribute.