identity management in projects that have been in the market

  • 11 January 2021
  • 4 replies

Badge +1


what is the best way to manage identity for a project that is already in production, has time and thousands of users and wants to implement mixpanel? We are starting with the implementation with the php libraries for the backend and js for the front, but we have the following doubts:

1. in the live view the column "distinctive id" is being placed my email currently attached capture

but I see the tutorial and he recommend handling it with the distinct id that automatically generates the js library the login event I have it as follows
$ mixPanel-> createAlias ​​($ current_distinct_id, $ user-> email);
       $ mixPanel-> identify ($ user-> email);

The identify with the email as recommended by the tutorial but then I read this and here it recommends $ mixPanel-> identify ($ current_distinct_id) so what is the best option? I want to track events before and after authentication

2. Since there are users already registered in my project, I think that I have to put the properties people set, create alias, etc. in the Login event also no? because if I put it only in the account creation (like the tutorial) my users never will be registered in the mixpanel right?

I’ll appreciate your help


4 replies

Userlevel 3
Badge +3

Hello @pixsolution,

You are talking about PHP. Are you only doing tracking on the server-side? 

On the server-side, you need to manually set your distinct_id for everyone. 

On the client side, by default, there is a random ID generated before the identify to track user. 

Alias became useless with the introduction of Id Management last year. You can simply send an identify that will do the alias if needed. 


On pre-existing customers, you might lose what they did before the identify because they didn’t go through the whole signup process with Mixpanel.


You can put a mixpanel.people.set whenever you like after an identify has been set.


Email are not recommended because they change. Do you have access to the user_id stored in DB?


Badge +1

Hi! thanks for your reply! yes in user table I have user_id why?

Yes I prefer distinct id generated by the js library since it is automatic, it brings other interesting props by default and also because I need to track events before authentication. And for users who are already registered I will place the people set after identify in login as you indicated so that I can include them in the explore users of mixpanel

what you say about the alias that is no longer used applies to the php library too?

Userlevel 3
Badge +3

Are you doing PHP for an API or you have a website with a mix of PHP / JS / HTML on the same side?

Badge +1

I’m using PHP / JS / HTML on the same side