Android
Setup
Jitsu supports Segment Analytics for Kotlin (Android) library to receive events from Android applications.
Please follow the Installation instruction to install the library.
tip
In all examples below, replace your-jitsu-domain.com with your Jitsu installation domain.
Jitsu Cloud users may find domain in the top-right corner of Site's Setup Instruction page or attach custom domain for a specific Site and use it instead.
Setting up the client
Jitsu requires additional settings to direct events to a correct Jitsu instance.
// Add required imports
import com.segment.analytics.kotlin.android.Analytics
import com.segment.analytics.kotlin.core.*
// Create an analytics client with the given application context and Segment write key.
// NOTE: in android, application context is required to pass as the second parameter.
Analytics("BROWSER_WRITE_KEY", applicationContext) {
apiHost = "your-jitsu-domain.com"
cdnHost = "your-jitsu-domain.com"
// Automatically track Lifecycle events
trackApplicationLifecycleEvents = true
flushAt = 3
flushInterval = 10
}
where:
| Description | |
|---|---|
apiHost | Jitsu server URL. E.g.: your-jitsu-domain.com |
cdnHost | CDN host for settings retrieval. Jitsu server URL. E.g.: your-jitsu-domain.com |
Event tracking
Please refer to the Analytics for Kotlin (Android) documentation for more details on how to track events with Jitsu.