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")
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("com.github.respectlytics:respectlytics-kotlin:2.1.0")
}
π¦ build.gradle (Groovy DSL)
Traditional Groovy syntax:
// settings.gradle
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
// app/build.gradle
dependencies {
implementation 'com.github.respectlytics:respectlytics-kotlin:2.1.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.
Offline Queuing
Events queue when offline and send automatically when connected.
Retry Logic
Failed requests retry with exponential backoff. No events lost.
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.