Merging Events and SDK Methods
The merging of identifiers in Mixpanel can be accomplished with three special events, $identify, $create_alias, and $merge. When ingested, all of these events have the same power to merge distinct_id’s together but each has a different set of checks in place that must be passed before the merging can happen. This section of the HTTP spec has full detail on the different merging events and their merge criteria.
While you can track these events as any other Mixpanel event to merge distinct_ids, it is often easiest to make use of Mixpanel's built-in SDK methods when available. Mixpanel's client-side SDKs have built-in identify() and alias() methods that will track $identify and $create_alias events when appropriate. Mixpanel's server-side SDKs only have the alias() method available (the Java library is the exception - neither SDK method is available).
The $merge event does not have an SDK method associated with it and has the additional caveat of needing to be sent to our import endpoint for it to merge distinct_ids successfully. This effectively limits its usage to server-side implementations. However, if you wanted to merge things from your server the $merge event is usually the simplest way as it has the fewest guardrails to work around.