identify()
A function that creates an account with Superwall by linking a userId to the automatically generated alias.
Call this as soon as you have a user ID, typically after login or when the user's identity becomes available.
Purpose
Links a user ID to Superwall's automatically generated alias, creating an account for analytics and personalization.
Signature
Parameters
Name | Type | Description |
---|---|---|
userId | String | Your user's unique identifier, as defined by your backend system. |
options | IdentityOptions? | Optional configuration for identity behavior. Set restorePaywallAssignments to true to wait for paywall assignments from the server. Use only in advanced cases where users frequently switch accounts. Defaults to null . |
Returns / State
This function returns Unit
. After calling, isLoggedIn
will return true
and userId
will return the provided user ID.
Usage
Basic identification:
With options for account switching scenarios:
Call as soon as you have a user ID:
Java usage:
How is this guide?