I have built a React application. The application requires users to login/signup first using Auth0. I have also implemented Mixpanel into my application to track the events (e.g. mixpanel.track('Click event A')
). However, I would like to track the actions/events for each different individual user.
For example: 'mary@gmail.com' has clicked on event A for 3 times; 'eric@gmail.com' has clicked on event A for 2 times..etc
Can anyone give me specific steps or directions for how to approach to this purpose ?
P.S: I have read https://help.mixpanel.com/hc/en-us/articles/115004497803-Identity-Management-Best-Practices, it states to use mixpanel.alias(id)
when users signup and mixpanel.identify(id)
when users login. However, since I am using Auth0, I am not sure where should I include the mixpanel.alias(id)
.
Given that you only track events after the user has logged in (as per your comment) I don't see any reason for you to use mixpanel.alias
.
When Auth0 successfully authorizes a user call mixpanel.identify
. Following this the logged in user will be associated with all events that you track.
webAuth.popup.authorize({
redirectUri: 'https://YOUR_APP/popup_response_handler.html'
//Any additional options can go here
}, function(err, authResult) {
if(!err){
mixpanel.identify('USER_ID_HERE');
mixpanel.track('Successful Login');
}
});