// Alias event with newId
analytics.alias(newId="<newId>")// Alias event with newId and previousId
analytics.alias(newId="<newId>",previousId="<previousId>")// Alias event with newId and options
analytics.alias(newId="<newId>",options=RudderOption(customContext=buildJsonObject{put("key","value")},integrations=buildJsonObject{put("Amplitude",true)put("INTERCOM",buildJsonObject{put("lookup","phone")})},externalIds=listOf(ExternalId(type="<id_type>",id="<value>"))))
Method signature
The below table describes the alias method signature in detail:
Field
Data type
Description
newId
String
New user identifier (userId) associated with the user.
previousId
String
The old user identifier.
Note: If not provided explicitly, the SDK automatically populates this field with the current userId or anonymousId.
options
RudderOption
Additional event options.
Example
A sample alias event sent from the Kotlin SDK is shown below:
RSSOptionBuilder is an Objective-C–only helper class. It uses the builder pattern to create an RSSOption instance and lets you set custom context, configure integrations, and attach external IDs in a structured way.
// Alias event with newIdanalytics.alias(newId:"Alias ID 1")// Alias event with newId and previousIdanalytics.alias(newId:"Alias ID 1",previousId:"Explicit Previous User ID 1")// Alias event with newId and optionsanalytics.alias(newId:"Alias ID 1",options:RudderOption(integrations:["Amplitude":true,"INTERCOM":["lookup":"phone"]],customContext:["key-1":"value-1"],externalIds:[ExternalId(type:"brazeExternalId",id:"value1234")]))
The corresponding Objective-C snippet is shown below:
// Alias event with newId
[analyticsalias:@"Alias ID 1"];// Alias event with newId and previousId
[analyticsalias:@"Alias ID 1"previousId:@"Explicit Previous User ID 1"];// Alias event with newId and options
RSSOptionBuilder*optionBuilder=[[RSSOptionBuilderalloc]init];[optionBuildersetCustomContext:@{@"key-1":@"value-1"}];[optionBuildersetIntegrations:@{@"Amplitude":@YES,@"INTERCOM":@{@"lookup":@"phone"}}];[optionBuildersetExternalIds:@[[[RSSExternalIdalloc]initWithType:@"brazeExternalId"id:@"value1234"]]];[analyticsalias:@"Alias ID 1"options:[optionBuilderbuild]];
Method signature
The below table describes the alias method signature in detail:
Field
Data type
Description
newId
String
New user identifier (userId) associated with the user.
previousId
String
The old user identifier.
Note: If not provided explicitly, the SDK automatically populates this field with the current userId or anonymousId.
options
RudderOption
Additional event options.
Example
A sample alias event sent from the Swift SDK is shown below:
analytics.alias(newId:"Alias ID 1",previousId:"Explicit Previous User ID 1",options:RudderOption(integrations:["Amplitude":true,"INTERCOM":["lookup":"phone"]],customContext:["key-1":"value-1"],externalIds:[ExternalId(type:"brazeExternalId",id:"value1234")]))
RSSOptionBuilder*optionBuilder=[[RSSOptionBuilderalloc]init];[optionBuildersetCustomContext:@{@"key-1":@"value-1"}];[optionBuildersetIntegrations:@{@"Amplitude":@YES,@"INTERCOM":@{@"lookup":@"phone"}}];[optionBuildersetExternalIds:@[[[RSSExternalIdalloc]initWithType:@"brazeExternalId"id:@"value1234"]]];[analyticsalias:@"Alias ID 1"previousId:@"Explicit Previous User ID 1"options:[optionBuilderbuild]];
This site uses cookies to improve your experience while you navigate through the website. Out of
these
cookies, the cookies that are categorized as necessary are stored on your browser as they are as
essential
for the working of basic functionalities of the website. We also use third-party cookies that
help
us
analyze and understand how you use this website. These cookies will be stored in your browser
only
with
your
consent. You also have the option to opt-out of these cookies. But opting out of some of these
cookies
may
have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This
category only includes cookies that ensures basic functionalities and security
features of the website. These cookies do not store any personal information.
This site uses cookies to improve your experience. If you want to
learn more about cookies and why we use them, visit our cookie
policy. We'll assume you're ok with this, but you can opt-out if you wish Cookie Settings.