Solved

Identify vs Merge

  • 11 August 2022
  • 1 reply
  • 28 views

I’m building my own server-based Mixpanel implementation (using the REST API instead of any of the pre-built SDKs) in order to build in custom functionality and meet specific user privacy requirements. 

I assign anonymous uuid4 IDs to logged-out users, and logged-in users have distinct uuid4 IDs as well which are stored in our users database.

I’m confused about whether I should use $merge or $identify once a user logs in. The documentation for the two methods appears very similar; the only differences I can discern are:

  1. $identify can be used with the /track endpoint (and $merge can only be used with /import)
  2. $merge can merge two groups of user IDs together, whereas $identify can only add a single new identity to a group.
  3. $identify requires that the anonymous ID is in a uuid4 format, while $merge is flexible to any “anonymous UID” format

Are these points all correct? Are there any reasons I would want to choose one method over the other?

icon

Best answer by naitik.soni 11 August 2022, 10:37

View original

1 reply

Userlevel 3
Badge +1

Hi @lukedeentaylor ,

I see some good points on difference between Identify and $merge. Since you are using REST APIs, and UUIDv4 for anonymous as well as signed-up users, I would recommend going ahead with $identify for every time you want to add an anonymous ID to the cluster of a user’s profile. 

The reason for having the $merge API is if at all due to implementation gap, there are duplicate profiles created in a project, the $merge API allows you to merge one profile into another and hide the other profile completely. The $merge has additional functionality like deciding which profile properties to retain from the 2 profiles which would not be the case when a user is logging in since you will only be adding another identifier and its event to the user profile.

Having said that, incase you are dealing with having to add non-UUIDv4 IDs, you can always go with $create_alias

 

Hope this helps

Reply