Set User ID
1 min
you can associate a unique user identifier with appstorys to enable accurate user level tracking, personalization, and campaign targeting this is useful when the user id is not available at sdk initialization time and becomes available later (for example, after login or signup) import { appstorys } from '@appstorys/react web'; // set or update the user id after login/signup await appstorys setuserid('your user id'); import { appstorys } from '@appstorys/react web'; // set or update the user id after login/signup appstorys setuserid('your user id'); notes initial setup if the userid is already known when the app starts, pass it directly through appstorys initialize({ , userid 'user id' }) you can skip calling setuserid anonymous user merging if the sdk was initialized without a userid, calling setuserid automatically reconciles the anonymous session and merges previous interactions with the identified user profile user id overwriting calling setuserid again replaces the previously set user id this is useful when a different user logs in campaign & event updates after updating the user id, all future events, impressions, and campaign interactions are automatically associated with the new user active campaigns are also refreshed for the updated user