Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for EventKT - Track it all
Khush Panchal
Khush Panchal

Posted on • Originally published atMedium

EventKT - Track it all

An Android tracking library that efficiently group events and implements disk caching to safeguard against crashes, providing insightful analytics for app performance and user behaviour.

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

Image description

  • 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 versionimplementation 'com.github.khushpanchal.EventKT:eventkt:0.1.0'
Enter fullscreen modeExit fullscreen mode
//Initialize on Application onCreate()classMainApplication:Application(){lateinitvareventTracker:EventTrackeroverridefunonCreate(){super.onCreate()eventTracker=EventTracker.Builder().addTracker(EventKtTracker.init(context=this,apiUrl="your API URL",apiKey="your API Key")).build()}}
Enter fullscreen modeExit fullscreen mode
//To usevalparameters=hashMapOf<String,Any>()parameters["eventSpecificKey1"]="eventSpecificValue1"parameters["eventSpecificKey2"]="eventSpecificValue2"eventTracker.track("appOpen",parameters)
Enter fullscreen modeExit fullscreen mode

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 versionimplementation 'com.github.khushpanchal.EventKT:eventkt-firebase:0.1.0'
Enter fullscreen modeExit fullscreen mode

Add firebase to your project.Add firebase project

valfirebaseTracker=FirebaseTracker.init(this)// initialize the firebasevaleventTracker=EventTracker.Builder().addTracker(firebaseTracker).build()// add firebase tracker while creating EventTracker in application onCreate()
Enter fullscreen modeExit fullscreen mode
  • Mixpanel
//Add dependency with latest versionimplementation 'com.github.khushpanchal.EventKT:eventkt-mixpanel:0.1.0'
Enter fullscreen modeExit fullscreen mode

Get a unique token from mixpanel.Get token from mixpanel

valmixpanelTracker=MixpanelTracker.init(this,"your unique token")valeventTracker=EventTracker.Builder().addTracker(mixpanelTracker).build()// add mixpanel tracker while creating EventTracker in application onCreate()
Enter fullscreen modeExit fullscreen mode
  • Amplitude
//Add dependency with latest versionimplementation 'com.github.khushpanchal.EventKT:eventkt-amplitude:0.1.0'
Enter fullscreen modeExit fullscreen mode

Get a unique API key from amplitude.Get API Key from amplitude

valamplitudeTracker=AmplitudeTracker.init(this,"your unique API key")valeventTracker=EventTracker.Builder().addTracker(amplitudeTracker).build()// add amplitude tracker while creating EventTracker in application onCreate()
Enter fullscreen modeExit fullscreen mode

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/

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Android Engineer @ ALLEN Digital | IIT Kharagpur (Silver Medalist 🥈) | Ex - Amazon MX Player | 700+ stars @ GitHub | Kotlin | Open Source
  • Location
    Bengaluru, India
  • Joined

More fromKhush Panchal

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp