Intempt Docs
Developer DocsSDK

Android SDK

Kotlin SDK for tracking user events, managing identities, and handling consent in Android applications.

Android SDK

The Intempt Android SDK is a Kotlin library for tracking user events, managing user identification, and handling consent in Android applications.

Installation

Add the dependency to your build.gradle:

dependencies {
    implementation 'com.intempt:android-sdk:latest'
}

Configuration

Create an intempt-config.json file in your assets/ folder:

{
  "organization": "your-org",
  "project": "your-project",
  "sourceId": "your-source-id",
  "apiKey": "your-api-key",
  "isLoggingEnabled": false,
  "isTouchEnabled": true,
  "isTextCaptureEnabled": true,
  "queueEnabled": true,
  "itemsInQueue": 5,
  "timeBuffer": 5
}
FieldTypeDescription
organizationstringOrganization identifier
projectstringProject identifier
sourceIdstringSource ID for data transmission
apiKeystringAPI key
isLoggingEnabledbooleanEnable debug logging
isTouchEnabledbooleanEnable touch event auto-capture
isTextCaptureEnabledbooleanEnable text capture in events
queueEnabledbooleanEnable event batching
itemsInQueueintBatch size threshold
timeBufferintSeconds between batch sends

Initialization

Call initialize() in your Application class onCreate() method:

class MyApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        Intempt.initialize(this)
    }
}

User Tracking Control

Tracking.start()

Enables event tracking for the current user.

Intempt.Tracking.start()

Tracking.stop()

Disables event tracking for the current user.

Intempt.Tracking.stop()

Tracking.isTrackingEnabled()

Returns Boolean — whether tracking is currently active.

if (Intempt.Tracking.isTrackingEnabled()) {
    Intempt.track("Button Click", mapOf("button" to "signup"))
}

User Identification

identify()

Associates user actions with a specific user ID.

ParameterTypeRequiredDescription
userIdStringYesUnique user identifier
eventTitleStringNoCustom event name (default: "Identify")
userAttributesMap<String, Any>NoUser properties
dataMap<String, Any>NoSupplementary event data
Intempt.identify(
    userId = "user123",
    eventTitle = "User Registration",
    userAttributes = mapOf(
        "email" to "user@example.com",
        "name" to "John Doe",
        "plan" to "premium"
    ),
    data = mapOf(
        "registrationSource" to "app",
        "referrer" to "google"
    )
)

alias()

Links two distinct user identifiers together.

ParameterTypeRequiredDescription
userIdStringYesPrimary user identifier
anotherUserIdStringYesSecondary identifier to alias
Intempt.alias(
    userId = "anonymous_123",
    anotherUserId = "authenticated_user456"
)

Group / Account

group()

Connects a user with a group or business account.

ParameterTypeRequiredDescription
accountIdStringYesAccount/group identifier
eventTitleStringNoCustom event label
accountAttributesMap<String, Any>NoAccount properties
Intempt.group(
    accountId = "company_abc",
    eventTitle = "Account Created",
    accountAttributes = mapOf(
        "name" to "Acme Corp",
        "plan" to "enterprise",
        "employees" to 500
    )
)

Event Tracking

track()

Records a custom event with associated data.

ParameterTypeRequiredDescription
eventTitleStringYesEvent name
dataMap<String, Any>YesEvent data
Intempt.track(
    eventTitle = "Purchase Completed",
    data = mapOf(
        "orderId" to "order_123",
        "amount" to 99.99,
        "currency" to "USD"
    )
)

record()

Captures an event with optional user and account context.

ParameterTypeRequiredDescription
eventTitleStringYesEvent name
userIdStringNoUser identifier
accountIdStringNoAccount identifier
userAttributesMap<String, Any>NoUser properties
accountAttributesMap<String, Any>NoAccount properties
dataMap<String, Any>NoSupplementary event data
Intempt.record(
    eventTitle = "Feature Used",
    userId = "user123",
    accountId = "account456",
    data = mapOf("feature" to "dashboard", "duration" to 300),
    userAttributes = mapOf("role" to "admin"),
    accountAttributes = mapOf("plan" to "enterprise")
)

Registers user consent preferences.

ParameterTypeRequiredDescription
actionStringYes"accept" or "reject"
validUntilLongYesExpiration timestamp (Unix)
emailStringNoUser email
messageStringNoConsent statement
categoryStringNoConsent classification
Intempt.consent(
    action = "accept",
    validUntil = System.currentTimeMillis() + (365L * 24 * 60 * 60 * 1000),
    email = "user@example.com",
    category = "analytics"
)

Product Tracking

productAdd()

Logs when a product is added to the cart.

Intempt.productAdd(productId = "prod_123", quantity = 2)

productOrdered()

Records products purchased at checkout.

Intempt.productOrdered(listOf(
    mapOf("productId" to "prod_123", "quantity" to 2),
    mapOf("productId" to "prod_456", "quantity" to 1)
))

productView()

Captures when a product screen is viewed.

Intempt.productView(productId = "prod_123")

Session Management

logOut()

Clears session data while preserving the profile ID.

Intempt.logOut()

Recommendations

recommendation()

Fetches personalized product recommendations. Must be called from a coroutine.

ParameterTypeRequiredDescription
idIntYesFeed identifier
quantityIntYesNumber of recommendations
fieldsList<String>YesFields to return
lifecycleScope.launch {
    val result = Intempt.recommendation(
        id = 123,
        quantity = 10,
        fields = listOf("productId", "name", "price", "image")
    )
    result?.let { recommendations ->
        // handle recommendations
    }
}

Privacy — Protecting Sensitive Views

Use doNotCaptureText() to exclude views containing sensitive information from text capture:

val sensitiveView = findViewById<EditText>(R.id.password_field)
Intempt.doNotCaptureText(sensitiveView)

Experiments & Personalization

// Fetch experiment variation
val experiment = Intempt.experiment.choose("experiment-name")

// Fetch personalization
val personalization = Intempt.personalization.choose("personalization-name")

Forbidden Event Titles

These titles are reserved and will throw an error:

auto-track · view page · leave page · change on · click on · submit on · identify · consent

All tracking methods silently return without executing when the user has opted out of tracking.

On this page