Alias API in Mobile SDKs

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

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

Overview

The RudderStack Android (Kotlin) and iOS (Swift) SDKs provide an alias API that lets you merge different identities of a known user.

Note that:

  • You can use the alias event only for merging user identities. It does not update the user’s traits or other common properties.
  • RudderStack supports sending alias events only to certain downstream destinations. See the destination-specific documentation for more details.

Android (Kotlin)

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

Method signature

The below table describes the alias method signature in detail:

FieldData typeDescription
newIdStringNew user identifier (userId) associated with the user.
previousIdStringThe old user identifier.

Note: If not provided explicitly, the SDK automatically populates this field with the current userId or anonymousId.
optionsRudderOptionAdditional event options.

Example

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

iOS (Swift)

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

Method signature

The below table describes the alias method signature in detail:

FieldData typeDescription
newIdStringNew user identifier (userId) associated with the user.
previousIdStringThe old user identifier.

Note: If not provided explicitly, the SDK automatically populates this field with the current userId or anonymousId.
optionsRudderOptionAdditional event options.

Example

A sample alias event sent from the iOS (Swift) SDK is shown below:


Questions? Contact us by Email or on Slack