Add Sprig device-mode
support to your application with this destination
The Sprig Segment destination is distributed via Maven Central.
- Add
mavenCentral()
to your project's rootbuild.gradle
repositories
block - In your application module's
build.gradle
file, add the dependency:
dependencies {
implementation "com.userleap:segment-analytics-kotlin-destination:$version"
}
Note the Sprig library itself will be installed as an additional dependency.
Select your Android Source from My Sources
dashboard on segment, and get the value for Write Key
from Settings -> API Keys
Add the Sprig destination where Segment is configured. Either in your Application class:
analytics = Analytics(BuildConfig.SEGMENT_WRITE_KEY, this) {
// Automatically track Lifecycle events
trackApplicationLifecycleEvents = true
flushAt = 3
flushInterval = 10
}.add(SprigDestination(application = this))
or in an Activity class:
analytics = Analytics(BuildConfig.SEGMENT_WRITE_KEY, this) {
// Automatically track Lifecycle events
trackApplicationLifecycleEvents = true
flushAt = 3
flushInterval = 10
}.add(SprigDestination(application = applicationContext))
Your events will now begin to flow to Sprig in device mode.
When you track an event and receive a survey, the survey will show on the top activity.
To record attributes, you can make use of the traits parameter when you call the identify function. Download an example app for reference.
Please use Github issues, Pull Requests, or feel free to reach out to our support team.