Privacy-First Kotlin Analytics
Jetpack Compose-ready analytics that respects your users. No GAID, no Android ID, no device fingerprintsβjust the insights you need without the privacy baggage.
import com.respectlytics.sdk.Respectlytics
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Configure once on app start
Respectlytics.configure(this, "YOUR_API_KEY")
setContent {
MyApp()
}
}
}
// Track from anywhere
Respectlytics.track("button_clicked")
Self-hosting? Point to your own server: Respectlytics.configure(apiKey = "key", baseUrl = "https://your-server.com") Β· Learn more
Installation
Add the SDK to your Android project via Gradle
π¦ build.gradle.kts (Kotlin DSL)
Add JitPack repository and dependency:
// settings.gradle.kts
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
// app/build.gradle.kts
dependencies {
implementation("io.github.respectlytics:respectlytics-kotlin:3.0.0")
}
π¦ build.gradle (Groovy DSL)
Traditional Groovy syntax:
// settings.gradle
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
// app/build.gradle
dependencies {
implementation 'io.github.respectlytics:respectlytics-kotlin:3.0.0'
}
π‘ Tip: After adding the dependency, sync your project with Gradle files (File β Sync Project with Gradle Files in Android Studio)
Firebase Analytics vs Respectlytics
Privacy-first analytics for Android developers who care about their users
| Feature | Firebase Analytics | Respectlytics |
|---|---|---|
| GAID Collection | β Collects by default | β Never collected |
| Android ID | β Can collect | β Never collected |
| IP Storage | β Stored by default | β Never stored |
| Session IDs | Persistent | β RAM-only, 2hr rotation |
| Data Fields Stored | 25+ fields | β 5 fields only |
| Integration Lines | 10+ lines + plugin | β 2 lines |
| Custom Properties | β οΈ Can leak PII | β Rejected by API |
| Data Safety Form | β Complex disclosures | β Minimal disclosures |
Quick Start
Choose your Android UI framework
π¨ Jetpack Compose
Modern declarative UI with Compose:
class MyApp : Application() {
override fun onCreate() {
super.onCreate()
// Configure once on app launch
Respectlytics.configure(this, "YOUR_API_KEY")
}
}
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MyAppTheme {
HomeScreen()
}
}
}
}
@Composable
fun HomeScreen() {
Button(onClick = {
Respectlytics.track("home_button_clicked")
}) {
Text("Click Me")
}
}
π± Traditional Views
Classic XML layouts with View binding:
class MyApp : Application() {
override fun onCreate() {
super.onCreate()
// Configure once on app launch
Respectlytics.configure(this, "YOUR_API_KEY")
}
}
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
findViewById<Button>(R.id.myButton)
.setOnClickListener {
Respectlytics.track("button_clicked")
}
}
}
π Don't forget AndroidManifest.xml
Register your Application class:
<application
android:name=".MyApp"
android:label="@string/app_name"
...>
<!-- Your activities -->
</application>
API Reference
Simple, intentional APIβjust 3 methods
configure(context, apiKey)
Initialize the SDK with your API key. Call once in your Application class.
Respectlytics.configure(this, "key")
track(eventName)
Track a named event. Events are batched and sent automatically.
Respectlytics.track("purchase")
flush()
Force send queued events immediately. Useful before app termination.
Respectlytics.flush()
No identify() method.
No reset() method.
By design.
Complete Jetpack Compose Example
Full working example with Material 3
package com.example.myapp
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.*
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.respectlytics.sdk.Respectlytics
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Configure once (or in Application class)
Respectlytics.configure(this, "YOUR_API_KEY")
setContent {
MaterialTheme {
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
AnalyticsDemo()
}
}
}
}
}
@Composable
fun AnalyticsDemo() {
var clickCount by remember { mutableStateOf(0) }
Column(
modifier = Modifier
.fillMaxSize()
.padding(24.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Text(
text = "Clicked: $clickCount times",
style = MaterialTheme.typography.headlineMedium
)
Spacer(modifier = Modifier.height(24.dp))
Button(
onClick = {
clickCount++
// Track button click
Respectlytics.track("demo_button_clicked")
},
colors = ButtonDefaults.buttonColors(
containerColor = MaterialTheme.colorScheme.primary
)
) {
Text("Track Event")
}
Spacer(modifier = Modifier.height(16.dp))
OutlinedButton(
onClick = {
// Track different event
Respectlytics.track("demo_secondary_action")
}
) {
Text("Secondary Action")
}
}
}
Automatic Behaviors
The SDK handles these automaticallyβno configuration needed
Session Rotation
IDs rotate every 2 hours and on app restart. Stored in RAM only.
Event Batching
Events are queued and sent efficiently to minimize network calls.
RAM-Only Queue
Events held in memory only. Lost on force-quit by designβzero device storage.
Retry Logic
Failed requests retry with exponential backoff. Events re-queued in memory.
Google Play Data Safety Form
How to accurately fill out Google Play's Data Safety section
β What We Collect
- β’ Approximate Location - Country only (derived from IP geo-lookup, IP not stored)
- β’ App Interactions - Event names and timestamps only
β What We DON'T Collect
- β’ Device or other IDs - No GAID, no Android ID
- β’ Personal info - No names, emails, or user IDs
- β’ Precise location - No GPS or fine-grained location
- β’ Financial info - No payment or purchase data
Data Safety Form Answers
Privacy Architecture
Return of Avoidance (ROA): The best way to protect data is to never collect it
5 Fields Stored (Total)
Never Collected
Frequently Asked Questions
Does the Kotlin SDK collect GAID (Google Advertising ID)?
Does the SDK work with Jetpack Compose?
onCreate(), then call Respectlytics.track() from any composable or View.
What Android versions are supported?
How do I fill out the Google Play Data Safety form?
Can I track custom properties with events?
premium_plan_selected rather than plan_selected with a plan: "premium" property.
Ready to Add Privacy-First Analytics?
Start tracking in under 5 minutes. 14-day free trial, no credit card required.
β’In-depth guides for Kotlin (Android)
Per-property guides for the Kotlin SDK β no AAID, no AD_ID permission, RAM-only event queue, EU data residency, and more.
- How to add Kotlin (Android) analytics with no AAID collection Add analytics to a Kotlin (Android) app without collecting Google's AAID. No AD_ID permission. Privacy-by-architecture.
- How to add Kotlin (Android) analytics with no third-party trackers Add analytics to a Kotlin (Android) app without any third-party tracker dependencies in your supply chain.
- How to add Kotlin (Android) analytics with zero device storage Add analytics to a Kotlin (Android) app without writing a single byte to disk. RAM-only event queue.
- How Kotlin (Android) analytics works with a RAM-only event queue Kotlin (Android) analytics events are held in memory only β flushed every 30 seconds, lost on force-quit by design.
- How to add Kotlin (Android) analytics with a 5-field event schema Add analytics to a Kotlin (Android) app where every event stores only 5 fields. Extra fields are rejected at the API.
- How Kotlin (Android) analytics handles geolocation (country only) Kotlin (Android) analytics with country-level geolocation only. IPs are processed transiently for country lookup, then β¦
- How Kotlin (Android) analytics rotates session IDs every 2 hours Kotlin (Android) analytics rotates session IDs automatically every two hours and on app restart. No persistent user ID.
- How Kotlin (Android) analytics avoids device fingerprinting Kotlin (Android) analytics that doesn't fingerprint devices. No model+OS+screen +locale combinations stored as identifiβ¦
β’How to track common events in Kotlin (Android)
Privacy-first tracking patterns for the events that matter most in Android apps.
- How to track paywall conversion in Kotlin (Android) without personal data A privacy-first pattern for tracking paywall conversion in Kotlin (Android) apps with Respectlytics. No IDFA, no AAID, β¦
- How to track onboarding completion in Kotlin (Android) without personal data Track onboarding completion in Kotlin (Android) using Respectlytics's 5-field event schema. Helps developers avoid collβ¦
- How to track sign-up events in Kotlin (Android) without personal data Track account creation in Kotlin (Android) apps with Respectlytics. No user_id, no email, no signup method as metadata.β¦
- How to track push notification opt-in in Kotlin (Android) without personal data Track when Kotlin (Android) users grant push notification permission. Privacy-first pattern with Respectlytics β no devβ¦
- How to track paywall views in Kotlin (Android) without personal data Track paywall impressions in Kotlin (Android) apps with Respectlytics. Session-scoped reach, no per-user attribution, nβ¦
- How to track trial-start events in Kotlin (Android) without personal data Track trial activation in Kotlin (Android) apps with Respectlytics. No user_id, no email, no payment-method metadata. Sβ¦
- How to track trial-to-paid conversion in Kotlin (Android) without personal data Track trial-to-paid conversion in Kotlin (Android) apps with Respectlytics. Session-scoped event, no transaction IDs, nβ¦
- How to track subscription renewals in Kotlin (Android) without personal data Track subscription renewals in Kotlin (Android) apps with Respectlytics. Session-scoped retention signal, no MRR mixingβ¦