Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When do I call mixpanel.people.identify

Tags:

mixpanel

How do I tell mixpanel the userID of my logged on user?

Do I need to call mixpanel.people.identify() everytime my user logs in, or only the first time that I'm creating them on mixpanel?

If only the first time, how does mixpanel know who to associate events to?

Also, once I have identified the person, will all events be tracable to that person, or do I need to call people.set() explicitly to track a generic event separately from a user-specific event?

like image 979
fortuneRice Avatar asked Oct 05 '22 21:10

fortuneRice


1 Answers

You should call mixpanel.people.identify() every time a user logs in. You can even call it every time a page loads in a logged in state if you want.

identify sets some data in a cookie about what distinct_id the library should use when sending people data.

If you have called mixpanel.identify with the same distinct_id as mixpanel.people.identify, events that you send (with mixpanel.track) will show up under the user's profile on the Customers tab. In order for the user to show up at all, though, you will need to call mixpanel.people.set (or .add) at least once.

EDIT: mixpanel.people.identify is no longer necessary; you can just call mixpanel.identify and it will set both.

like image 64
raylu Avatar answered Oct 10 '22 02:10

raylu