Privacy-first analytics for Kotlin
Two calls add analytics to an Android app: configure once, then track events. No Advertising ID, no Android ID, no device fingerprints. Works with Jetpack Compose and Views.
Free for one app and 20,000 events a month, no card needed.
import io.github.respectlytics.Configuration
import io.github.respectlytics.Respectlytics
// 1. Configure once at app launch
Respectlytics.configure(
Configuration(apiKey = "your-api-key")
)
// 2. Track events anywhere
Respectlytics.track("purchase_completed")
Install
One dependency from Maven Central, in Kotlin DSL or Groovy.
dependencies {
implementation("io.github.respectlytics:respectlytics-kotlin:3.0.0")
}
dependencies {
implementation 'io.github.respectlytics:respectlytics-kotlin:3.0.0'
}
Then sync the project with its Gradle files. Maven Central is in the default repositories of a new Android project.
Configure once, track anywhere
Call configure() in your Application class, then track() from any composable or View.
import android.app.Application
import io.github.respectlytics.Configuration
import io.github.respectlytics.Respectlytics
class MyApp : Application() {
override fun onCreate() {
super.onCreate()
Respectlytics.configure(Configuration(apiKey = "your-api-key"))
}
}
Register the class in your manifest:
<application
android:name=".MyApp"
android:label="@string/app_name">
<!-- your activities -->
</application>
@Composable
fun HomeScreen() {
Button(onClick = { Respectlytics.track("signup_started") }) {
Text("Sign Up")
}
}
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
findViewById<Button>(R.id.purchaseButton).setOnClickListener {
Respectlytics.track("purchase_completed")
}
}
}
Hosting the server yourself? Pass its address in the configuration. The open source edition runs the same server.
Respectlytics.configure(Configuration(
apiKey = "your-api-key",
baseURL = "https://analytics.example.com/api/v1"
))
The whole API
Three methods. An event carries its name and nothing else.
configure(Configuration)- Starts the SDK. Call it once when the app starts.
track(eventName)- Records an event. There are no properties, by design.
flush()- Sends queued events now. Rarely needed: the SDK sends every 30 seconds or when 10 events are queued, and retries a failed send with backoff.
What leaves the app
Five fields per event, the same in every SDK. The API refuses unknown fields.
Stored for each event
event_name- the name you pass to track()
timestamp- when it happened
session_id- random, kept in memory, replaced every two hours and on each launch
platform- the operating system
country- looked up on the server from the IP address, which is then discarded
Never collected
- the IDFA, the Advertising ID or any other device identifier
- a fingerprint of the device
- user IDs, names or emails
- free-text properties on events (why)
- anything written to the device
Filling in the Google Play Data Safety form? The privacy disclosure guide walks through each question for the data Respectlytics handles.
Coming from Firebase Analytics
The calls map one to one. The parameters and the user IDs go away.
Replace each firebaseAnalytics.logEvent() with Respectlytics.track() and drop its parameters. Remove setUserId() and setUserProperty() calls: Respectlytics has no user IDs and no user properties.
Questions developers ask
What the SDK does, and what it leaves out on purpose.
Does the SDK read the Advertising ID or the Android ID?
No. It never reads the Google Advertising ID, the Android ID or any other device identifier, and it does not fingerprint the device. The only ID is a random session ID kept in memory, replaced every two hours and on each launch.
Does it work with Jetpack Compose?
Yes, and with View-based screens. Call configure() once in your Application class's onCreate(), then call Respectlytics.track() from any composable or View.
Which Android versions are supported?
Android 7.0 (API level 24) and later.
How do I fill in the Google Play Data Safety form?
The privacy disclosure guide walks through it for the data Respectlytics handles: no device or other IDs, approximate location (the country, from an IP address that is not stored) and app interactions. What your app declares as a whole depends on everything else it collects.
Why can't I attach any property I like to an event?
Because properties are where personal data slips into analytics: an email in a parameter, a name in a label. The API refuses unknown fields, and keeps a property only when it was declared for your app, with a value declared for it, on a paid plan, so free text cannot get in by accident. Put the detail you need in the event name instead, such as premium_plan_selected.
Other SDKs
The same five fields and the same three calls in each.
What sets the SDK apart
The choices behind it, and what each one means for your app.
What to track
Event plans for common funnels, with the calls in each SDK.
Try it on your own app
Free for one app and 20,000 events a month, no card needed. Unlimited apps on every paid plan.