Browser SDK

alias

Migrate events from one known ID to another known ID.

Signature#

FieldRequiredTypeDescription
newKnownIdtruestringThe new canonical known user ID.
oldKnownIdfalsestringThe previous known user ID. When omitted, the SDK uses the current anonymous or known identity as appropriate.
optionsfalseobjectCall options, including context, timestamp, integration controls, or a message ID.
callbackfalsefunctionRuns after dispatch processing. It may not execute if a device-mode library is blocked from loading.

Backend behavior#

Ferno reassigns all previous events associated with the old known ID to the new known ID. Alias is an identity migration or merge operation.

Most applications do not need to call alias; identify is sufficient for anonymous users, sign-in, session restoration, and account switching.

Use it for duplicate customer-record merges, legacy-to-canonical ID migration, account-model consolidation, database imports, or identity repair. It is not for routine logout, login, or account switching.

Do not use after authentication#

Do not call alias after routine login. Call identify instead. If users switch accounts on one browser, reset the previous browser identity as appropriate, then identify the newly authenticated account. Alias would incorrectly merge separate accounts.

For logout and account switching, track the boundary, call reset(), then identify the next account after login. See logout and reset.