Hello, What is the correct way to merge users bef...
# ask-questions
g
Hello, What is the correct way to merge users before login and after, so that experiment variation will not change for the user after he logs in, in our use case, users might use the app before signing in. we set the ID in our frontend like this while using Growthbooks DeviceID
Copy code
gb. setAttributes ({
id: currentUser?._id ?? deviceld,
deviceld: deviceId,
utmSource: Cookie.get ('utm_source'),
utmMedium: Cookie.get ( 'utm_medium'),
utmCampaign: Cookie.get ('utm_campaign'),
utmContent: Cookie-get ('utm_content'),
}) ;
}, [currentUser, isInitializedl);
f
Hi Invai
The correct way is to use the anonymous user id for both logged in and anon - it should not change after they log in