Using API for Identity Management

  • 16 September 2020
  • 2 replies


When a user signs up for an account in my app, I would like to create an alias for that user via HTTP. I understand the $create_alias event requires including the distinct_id parameter (as described here: and here How do I get the distinct_id parameter for the user via HTTP?


2 replies

Userlevel 1
Badge +1

Hi @mkerp,

Are you by chance setting up a Hybrid Server/Client implementation as described in this help article

If yes, you can rely on the Mixpanel JavaScript library to store a distinct_id locally on the device. You can pass it to your server via a form (as shown in the code snippet below) or parse the cookie directly. 

var myForm = $("#myForm");
//track the page load
mixpanel.track("Page load", {"Page": "Signup Form"});

Listen to the form being submitted;
before it sends the request, the current distinct ID will be added

var hiddenInput = myForm.find("input[name='distinct_id']");
hiddenInput[0].value = mixpanel.get_distinct_id();


If you have ID Merge enabled, you can identify users at both signup and login, and skip creating aliases. 


Hope this helps!

Thanks Cassie! The last point regarding ID Merge was exactly what I needed to hear. I had missed that point in the documentation.