You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you don't already have an Application class, create one. Then, initialize the Aptabase object inside your application class:
privateconstvalAPTABASE_KEY="YOUR_APP_KEY"// Put the app key provided by Aptabase as the value of APTABASE_KEY// It is a unique identifier for you applicationclassMyApplication : Application() {
overridefunonCreate() {
super.onCreate()
// Initialize Aptabase objectAptabase.instance.initialize(applicationContext, APTABASE_KEY)
// OPTIONAL: Track app launch on startupAptabase.instance.trackEvent("app_started")
}
}
To get your App Key, you can find it inside Instructions tab from the left side menu of the Aptabase website.
Usage
You are in charge of what information is sent! Therefore, no events are tracked automatically and you must register trackers manually. To do so, simply use the trackEvent function provided by the Aptabase object:
// Event with no propertiesAptabase.instance.trackEvent("event_name")
// Event with a custom propertyAptabase.instance.trackEvent("screen_view",
mapOf<String, Any>(
"name" to "Settings"// Only <String> and <Int> values are allowed for custom properties
)
)
About
Kotlin SDK for Aptabase: Open Source, Privacy-First and Simple Analytics for Mobile, Desktop and Web Apps