Identify API in Mobile SDKs

Learn about the identify API call in the Android (Kotlin) and iOS (Swift) SDKs.

This guide explains how to use the identify API in the RudderStack Android (Kotlin) and iOS (Swift) SDKs.

Overview

The RudderStack Android (Kotlin) and iOS (Swift) SDKs provide an identify API that lets you identify a user and associate them to their actions. It also lets you record any traits about them like their name, email, etc.

info
Once you make the identify call, the SDK persists the user information and passes it to the subsequent calls.

Android (Kotlin)

The identify method definition in the Android (Kotlin) SDK is as follows:

Method signature

The below table describes the identify method signature in detail:

FieldData typeDescription
userIdStringUnique user identifier. When provided, RudderStack prefers this field over anonymousId while sending data to the destinations.
traitsTraitsContains the user traits or the properties associated with userId such as email, address, etc. See Identify traits for more information.

Note that:

  • RudderStack stores the traits as context.traits in the final event object.
  • The traits type in Java is Map<String, Object>.
optionsRudderOptionAdditional event options.

Example

A sample identify event sent from the Android (Kotlin) SDK is shown below:

iOS (Swift)

The identify method definition in the iOS (Swift) SDK is as follows:

Method signature

The below table describes the identify method signature in detail:

FieldData typeDescription
userIdStringUnique user identifier. When provided, RudderStack prefers this field over anonymousId while sending data to the destinations.
traitsPropertiesContains the user traits or the properties associated with userId such as email, address, etc. See Identify traits for more information.
optionsRudderOptionAdditional event options.

Example

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


Questions? Contact us by Email or on Slack