-
Notifications
You must be signed in to change notification settings - Fork 57
Description
The goal is to change the user traits when the user logout from his account (for example user1
) and login into another account (for example user2
) when this happend the same traits of the previous user is used, the only way to reset it is to close and reopen the app
How i identify the user
When the app boots or after a successful login I execute this code
userTraits = UserTraits(
name: user.name,
phone: user.phone,
);
segment.identify(
userId: user.id.toString(),
userTraits: userTraits,
);
this code works fine but once, when something changes related to the user (logout and login with different account), re-excuting this not affecting the traits, the only way is to close and reopen the app to be able to set the traits to the new data, how to change the user traits when needed?
What I have tried to achieve this
I have tried all of these in my logout method but failed
-
use
segment.reset();
-
re-identify the user with null user traits values,
segment.identify(
userId: user.id.toString(),
userTraits: null,
);
- re-identify the user with user traits with null values,
userTraits = UserTraits(
name: null,
phone: null,
);
segment.identify(
userId: user.id.toString(),
userTraits: userTraits,
);
as mentioned before, recalling this code with the new user data not affecting his traits
userTraits = UserTraits(
name: user.name,
phone: user.phone,
);
segment.identify(
userId: user.id.toString(),
userTraits: userTraits,
);