Hi there, asking my first question bit abt the Rup...
# questions
g
Hi there, asking my first question bit abt the Rupifi platform we use to onboard user There is growth team in our company who generate login page url link which is sent to user by sms/whatsapp or manually and it ask for mobile no and otp is generated for login for the user when he logs in But login page url link which is sent to user already has system generated user_id which we always want to use for tracking the user Currently we call identify and ID merge is already enabled from Project settings After that only events function is created and pushed to mixpanel Code snippet
const initialiseMixPanel = useCallback(() => {
if (process.env.REACT_APP_MIXPANEL_PROJECT_TOKEN) {
mixpanel.init(process.env.REACT_APP_MIXPANEL_PROJECT_TOKEN, {
debug: process.env.REACT_APP_ENV === "prod" ? false : true,
});
const defaultAttrs = getDefaultAttrs();
if (defaultAttrs.userId) {
mixpanel.identify(defaultAttrs.userId.toString());
mixpanel.people.set("name", defaultAttrs.userName);
}
}
}, [getDefaultAttrs]);
--- EVENT call below
const sendMixPanelEvent = useCallback(
(eventkey, eventAttributes) => {
const defaultAttrs = getDefaultAttrs();
if (!defaultAttrs.userId) {
return;
}
if (!eventAttributes) {
mixpanel.track(eventkey, { ...defaultAttrs });
} else {
mixpanel.track(eventkey, { ...defaultAttrs, ...eventAttributes });
}
},
[getDefaultAttrs]
);
Issue is there are some users where we have multiple mixpanel defined distinct_id created because of mutiple devices used but the final distinct id is not getting updated as my user_id