Track API in Kotlin SDK Alpha

Learn about the track API call in Kotlin SDK.

This guide explains how to use the track API in Kotlin SDK.

Overview

The Kotlin SDK provides a track API that lets you record the user’s actions along with any properties associated with them.

Method definition

The track method definition is as follows:

The below table describes the track method signature in detail:

FieldData typeDescription
nameStringName of the event.
propertiesPropertiesAdditional properties describing the event that you want to send.
optionsRudderOptionAdditional event options.

A sample track event sent from the Kotlin SDK is shown below:

analytics.track(
    name = "Product Added",
    options = RudderOption(
        customContext = buildJsonObject {
            put("currency", "USD")
        },
        integrations = buildJsonObject {
            put("Amplitude", true)
            put("INTERCOM", buildJsonObject {
                put("lookup", "phone")
            })
        },
        externalIds = listOf(
            ExternalId(type = "brazeExternalId", id = "1hKOmRA4GRlm"),
        ),
    ),
)

Questions? Contact us by email or on Slack