Quick Start

This guide shows you how to integrate the Hackle SDK to run A/B Tests and collect events.

circle-info

You can find your SDK Key in the Hackle Dashboard under Settings > SDK Integration Info.

1

Install SDK

Add the dependency to build.gradle.

repositories {
    mavenCentral()
}

dependencies {
    implementation 'io.hackle:hackle-android-sdk:2+'
}
2

Initialize SDK

import io.hackle.android.Hackle
import io.hackle.android.initialize

Hackle.initialize(applicationContext, "YOUR_APP_SDK_KEY") {
    // SDK initialization complete
}
3

Variation Distribution

Pass the Experiment Key to determine the user's variation.

val hackleApp = Hackle.app()
val variation = hackleApp.variation(EXPERIMENT_KEY)

if (variation == Variation.A) {
    // Group A
} else if (variation == Variation.B) {
    // Group B
}
4

Event Tracking

Track user behavior events.

hackleApp.track("EVENT_KEY")

For detailed options at each step, refer to the Android SDK documentation.

Last updated