In Mixpanel I have an user who have the automatic distinct_id 145dsfds-sdfsdf
(example). I want to create an alias for that user to 1234
My PHP code:
require ('mixpanel/mixpanel.php');
$original_id = '145dsfds-sdfsdf'; // Example original
$uid = 1234;
$token = '2j34j3j4j3j'; // Token of my project on Mixpanel
$_mp = new Mixpanel($token);
$_mp->createAlias($original_id, $uid);
$_mp->people->set($uid, array(
'uid' => $uid
));
After run, I go into Mixpanel and filter people with id 1234
and retrieve no result. But if we visualize the details of user 145dsfds-sdfsdf
, the property uid
have value 1234
.
I don't understand what's happening.
The root of the issue here is that Mixpanel's alias function is designed to remap the uid
to the original_id
but not the reverse.
Essentially, if an alias is successfully made, the distinct_id you see in live-view will be a original_id
, not the uid
.
The alias function allows you to tie pre-authentication events to post-authentication events without needing to edit the events already stored in Mixpanel (events are immutable once they are in a project).