Skip to content

Quickstart

You need an app_id (public, goes into your APK) and, to read data, a platform key (dak_…, secret, never put it in an app). Both come with your early-access account. You can also create more apps with the REST API.

settings.gradle.kts
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven("https://pulsark.org/maven/")
}
}
app/build.gradle.kts
dependencies {
implementation("org.pulsark:analytics:0.1.0")
}

Requirements: minSdk 21+. The SDK adds the INTERNET and ACCESS_NETWORK_STATE permissions. Dependencies: OkHttp, AndroidX WorkManager and Lifecycle.

MyApp.kt
import org.pulsark.analytics.Profile
import org.pulsark.analytics.Pulsark
import org.pulsark.analytics.PulsarkConfig
class MyApp : Application() {
override fun onCreate() {
super.onCreate()
Pulsark.init(this, appId = "app_xxxxxxxxxxxx", config = PulsarkConfig(profile = Profile.GAME))
}
}
MyApp.java
Pulsark.init(this, "app_xxxxxxxxxxxx", new PulsarkConfig());

init takes < 5 ms and does all I/O on a background thread. Calls from secondary processes (for example an ad SDK’s process) are ignored automatically.

Until you call setConsent, only essential events are collected (first_open, session_start, app_foreground/app_background, ad_impression). After the user agrees:

Pulsark.setConsent(ConsentState.GRANTED)

See Privacy & data for what each state means.

Pulsark.track("level_end", mapOf("level_id" to "3", "result" to "win", "duration_ms" to 41250))

Sessions, foreground time and screens (page_view) are tracked for you. For ad revenue, see Ad revenue.

  • Set PulsarkConfig(debug = true) and watch Logcat with the tag Pulsark.
  • Call Pulsark.flush() to upload immediately instead of waiting for the next batch.
  • Metrics are aggregated hourly. Query today’s DAU:
Terminal window
curl -H "Authorization: Bearer $PULSARK_KEY" \
"https://api.pulsark.org/api/v1/metrics/dau?app_id=app_xxxxxxxxxxxx"

Or just ask your AI assistant after connecting MCP.