Alias API in Kotlin SDK Alpha

Learn about the alias API call in Kotlin SDK.

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

Overview

The Kotlin SDK provides 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.

Method definition

The alias method definition is as follows:

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.

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

analytics.alias(
    newId = "1hKOmRA4GRlm",
    previousId = "156K7m214GR2X",
    options = RudderOption(),
)

Questions? Contact us by email or on Slack