Alias API in Mobile SDKs

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

This guide explains how to use the alias API in Kotlin and Swift SDKs.

Overview

The RudderStack Kotlin and 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.

Kotlin

The alias method definition in the 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 Kotlin SDK is shown below:

Swift

The alias method definition in the 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 Swift SDK is shown below:


Questions? Contact us by email or on Slack