Track API in Mobile SDKs

Learn about the track API call in Kotlin and Swift SDKs.

This guide explains how to use the track API in the mobile (Kotlin and Swift) SDKs.

Overview

The RudderStack Kotlin and Swift SDKs provide a track API that lets you record the user’s actions along with any properties associated with them.

Kotlin

The track method definition in the Kotlin SDK is as follows:

Method signature

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.

Note: The properties type in Java is Map<String, Object>.
optionsRudderOptionAdditional event options.

Example

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

Swift

The track method definition in the Swift SDK is as follows:

Method signature

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.

Example

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


Questions? Contact us by email or on Slack