Docs

Kotlin: Analytics and performance

Log events and screen views for active users, funnels and retention, and report app start, screen and network timings with the Kotlin SDK.

Updated Oct 26, 2026

Log events and screen views for active users, funnels and retention, and report app start, screen and network timings. Every call runs as the client's signed-in user, so your project's policies and row-level security apply. Types and members are listed in source order; each one links to its HTTP endpoint where it maps to one.

#Types and members

SovariaAnalytics

Product analytics: sovaria.analytics.track("purchase", mapOf("amount" to 20)), screen, identify, and setEnabled (false when the user opts out: the server then drops their events on every device). Events are batched (every 10 s or 20 events), kept in the offline store while offline; the signed-in user comes from the request's token on the server, never from the event.

class SovariaAnalytics internal constructor(private val client: Sovaria)

SovariaAnalytics.appVersion

A property.

var appVersion: String?

SovariaAnalytics.platform

A property.

var platform: String

SovariaAnalytics.batchSize

A property.

var batchSize: Int

SovariaAnalytics.flushIntervalMs

A property.

var flushIntervalMs: Long

SovariaAnalytics.anonId

The device id sent as anon_id.

val anonId: String get()

SovariaAnalytics.configure

Persist the queue, device id and opt-out across launches.

suspend fun configure(store: OfflineStore?, appVersion: String? = null, platform: String? = null)

SovariaAnalytics.track

fun track(name: String, props: Map<String, Any?> = emptyMap()): Boolean

SovariaAnalytics.screen

fun screen(name: String, props: Map<String, Any?> = emptyMap()): Boolean

SovariaAnalytics.identify

fun identify(userProps: Map<String, Any?>): Boolean

SovariaAnalytics.trackExposure

One $exposure per experiment and session (remote config calls this when you read an experiment's value).

fun trackExposure(experiment: String, variant: String)

SovariaAnalytics.flush

Send what is queued now.

suspend fun flush()

Network errors and throttling keep the events; a refused batch is dropped.

SovariaAnalytics.setEnabled

Analytics consent (DPDP / GDPR).

suspend fun setEnabled(on: Boolean, erase: Boolean = false)

Off clears the queue and tells the server; erase also deletes what was stored.

SovariaAnalytics.isEnabled

A property.

val isEnabled: Boolean get()

SovariaAnalytics.pending

A property.

val pending: Int get()

SovariaRemoteConfig

Remote config and feature flags: setDefaults, fetchAndActivate, getBoolean/getString/getNumber/getJson and onUpdate (live after a publish when the plan has realtime config). Only this user's evaluated values come back (never the rules); unchanged config costs a 304; activated values persist for offline starts.

class SovariaRemoteConfig internal constructor(private val client: Sovaria)

SovariaRemoteConfig.minimumFetchIntervalMs

A property.

var minimumFetchIntervalMs: Long

SovariaRemoteConfig.attributes

A property.

var attributes: Map<String, Any?>

SovariaRemoteConfig.appVersion

A property.

var appVersion: String?

SovariaRemoteConfig.platform

A property.

var platform: String

SovariaRemoteConfig.language

A property.

var language: String?

SovariaRemoteConfig.setDefaults

fun setDefaults(values: Map<String, Any?>)

SovariaRemoteConfig.configure

Restore the last activated values (call early with a durable store).

suspend fun configure(store: OfflineStore?)

SovariaRemoteConfig.fetchAndActivate

Fetch (respecting minimumFetchIntervalMs unless force) and activate.

suspend fun fetchAndActivate(force: Boolean = false): Boolean

True when values changed.

SovariaRemoteConfig.onUpdate

Called with the changed keys whenever new values are activated.

fun onUpdate(cb: (List<String>) -> Unit): Int

Returns an id for removeUpdateListener.

SovariaRemoteConfig.removeUpdateListener

fun removeUpdateListener(id: Int)

SovariaRemoteConfig.getBoolean

fun getBoolean(key: String, default: Boolean = false): Boolean

SovariaRemoteConfig.getString

fun getString(key: String, default: String = ""): String

SovariaRemoteConfig.getNumber

fun getNumber(key: String, default: Double = 0.0): Double

SovariaRemoteConfig.getJson

fun getJson(key: String): Any?

SovariaRemoteConfig.version

A property.

val version: Int get()

SovariaPerf

Client performance monitoring (Observability › Performance in the console): - App start — process start to markAppReady (call it from your first Activity's onResume / reportFullyDrawn, or let installAndroid do it at the first activity resume). - Screens — val t = sov.perf.screen("Checkout") … t.end(). - Network — every request the SDK makes (method, route, status, duration) with the traceparent it sent, so a slow call opens the server trace for the same request. - Custom traces — sov.perf.trace("sync") { … }. Batched every 10 s (at most 100 per request); counts against obs.perf_events_month.

class SovariaPerf internal constructor(private val client: Sovaria)

SovariaPerf.installed

A property.

@Volatile var installed

SovariaPerf.install

fun install(release: String? = null, environment: String? = null, sampleRate: Double = 1.0, network: Boolean = true)

SovariaPerf.installAndroid

Android: install, and the cold start is recorded at the first activity resume.

fun installAndroid(application: Any, release: String? = null, environment: String? = null, sampleRate: Double = 1.0)

application is an android.app.Application.

SovariaPerf.uninstall

fun uninstall()

SovariaPerf.markAppReady

The app is ready (first screen drawn): records the cold start once per launch.

fun markAppReady()

SovariaPerf.screen

fun screen(name: String): PerfTrace

SovariaPerf.trace

suspend fun <T> trace(name: String, attributes: Map<String, Any?> = emptyMap(), block: suspend () -> T): T

SovariaPerf.record

Queue one measurement; false when not installed or not sampled.

fun record(kind: String, name: String, value: Double, route: String? = null, traceId: String? = null,
           attributes: Map<String, Any?> = emptyMap()): Boolean

SovariaPerf.flush

Send queued measurements now.

suspend fun flush()

PerfTrace

A running screen or custom trace; end records it once.

class PerfTrace internal constructor(private val perf: SovariaPerf, private val kind: String, private val name: String,
                                     private val attributes: Map<String, Any?> = emptyMap())

PerfTrace.end

fun end()