<SuperwallProvider />.
Function Signature
Parameters
This hook does not accept any parameters.Return Value
An object containing user-related state and functions:Identifies the current user with Superwall. This is typically called when a user logs in.Parameters:
userId: string- The unique identifier for the useroptions?: IdentifyOptions- Optional parameters:restorePaywallAssignments?: boolean- If true, attempts to restore paywall assignments from a previous session for this user (defaults to false)
update
(attributes: Record<string, any> | ((old: Record<string, any>) => Record<string, any>)) => Promise<void>
Updates the current user’s attributes. Accepts either an object of attributes or a function that takes the old attributes and returns the new attributes.Parameters:
attributes: Record<string, any>- Object of attributes to set/update- OR
attributes: (old: Record<string, any>) => Record<string, any>- Function that receives old attributes and returns new attributes
Resets the user’s identity, effectively signing them out from Superwall. This clears all user-specific data from the SDK.
Manually refreshes the user’s attributes and subscription status from the Superwall servers. Returns a promise that resolves with the refreshed user attributes.
Sets attributes for third-party integrations (e.g., attribution providers, analytics platforms). Used to link user IDs from services like Adjust, Amplitude, AppsFlyer, Mixpanel, etc.Available integration attributes:
adjustIdamplitudeDeviceId,amplitudeUserIdappsflyerIdbrazeAliasName,brazeAliasLabelonesignalIdfbAnonIdfirebaseAppInstanceIditerableUserId,iterableCampaignId,iterableTemplateIdmixpanelDistinctIdmparticleIdclevertapIdairshipChannelIdkochavaDeviceIdtenjinIdposthogUserIdcustomerioId
Gets the currently set integration attributes.
Retrieves the user’s entitlements from Superwall’s servers. Returns both active and inactive entitlements.Returns:
EntitlementsInfoactive: Entitlement[]- Active entitlementsinactive: Entitlement[]- Inactive entitlements
Entitlement contains:id: string- The entitlement identifiertype: EntitlementType- The type (typically “SERVICE_LEVEL”)
Manually sets the subscription status of the user. This is typically called after a purchase or restore operation.Parameters:
status: SubscriptionStatus- The subscription status:{ status: "UNKNOWN" }- Status unknown or unavailable{ status: "INACTIVE" }- No active subscription{ status: "ACTIVE", entitlements: Entitlement[] }- Active with entitlements
The current subscription status of the user.Possible values:
{ status: "UNKNOWN" }- Initial state before fetched{ status: "INACTIVE" }- User does not have an active subscription{ status: "ACTIVE", entitlements: Entitlement[] }- User has active subscription with entitlements
An object containing the current user’s attributes.
null if no user is identified or after signOut. undefined initially before any user data is fetched or set.UserAttributes:aliasId: string- The user’s alias ID, if setappUserId: string- The user’s application-specific user IDapplicationInstalledAt: string- ISO 8601 date string of app installationseed: number- Seed value for consistent variant assignments in experiments[key: string]: any- Custom attributes set viaupdate
Usage Examples
Basic user identification
Update user attributes
Display subscription status
Restore paywall assignments
Sync entitlements with subscription status
Set integration attributes
Refresh user data
Best Practices
- Call
identifyon login: Always identify users when they log in to ensure proper tracking and paywall targeting - Call
signOuton logout: Clear user data when users log out to prevent data leakage - Use the function form of
update: When updating based on previous values, use the function form to avoid race conditions - Sync subscription status: After purchase or restore operations, update the subscription status using
setSubscriptionStatus - Set integration attributes early: Link third-party IDs as soon as they’re available for accurate attribution
Related Hooks
- useSuperwall - Core SDK access hook
- usePlacement - Paywall presentation hook
- useSuperwallEvents - Event subscription hook
Related Types
UserAttributes(useSuperwall.ts:19)IdentifyOptions(useSuperwall.ts:37)SubscriptionStatus(SuperwallExpoModule.types.ts:205)IntegrationAttributes(SuperwallExpoModule.types.ts:121)EntitlementsInfo(SuperwallExpoModule.types.ts:130)Entitlement(SuperwallExpoModule.types.ts:64)