Distinct ID Creation (JavaScript, iOS, Android)

This article reflects the behavior of an older version of Mixpanel's identity management system without Identity Merge enabled. You can check if your organization is using Identity Merge or request access to it using the steps outlined here.

By default, our JavaScript, iOS, and Android libraries manage identities for you.

User identification in Mixpanel is handled through a property called "distinct_id". Distinct_id is sent with each event to determine which customer sent the event. All the unique reports in Mixpanel (funnels, retention, uniques in insights), depend on distinct_id to follow a single customer. There are some consequences to using our library-issued distinct_ids, and we recommend managing your own user tracking with a system that closely maps to your particular authentication system.


The JS library will automatically issue a distinct_id to each user that loads the library. The JS distinct_id is a random, unique, 54-60 character hash, and is stored in a cookie. The cookie is specific to the domain, browser, computer and instance of Mixpanel (project). If you do not choose to manage distinct_id yourself, each time a user shows up in a new browser, on a new machine, or clears their cookies, they will appear to be a new unique user.

Example ID: 13bbf7943e584-0885c2531-5c793977-3e8000-13bbf7943e64cf


Beginning with Objective-C version v3.6.2 and Swift version v2.7.7, Mixpanel no longer uses the IFA(ID for Advertisers) but uses a randomly generated UUID as the default distinct ID instead. 

If you want to use IFV(identifierForVendor) as the distinct_id, you can set MIXPANEL_UNIQUE_DISTINCT_ID=1 in build settings Active Compilation Conditions for swift or Preprocessor Macros for Objective-C on the Mixpanel framework target. The IFV remains constant until a user removes and then re-installs the app, the IFV will change with each installation.

UUID & IFV Example ID: 3688B790-D3C6-45E1-A92A-0F09D346B6C7


The Android library automatically creates a random unique UUID (variant 2, version 4 from RFC 4122) value for distinct_id.

Since the Android library uses a native object to store the distinct_id value, it will persist across sessions and app updates. Post version 3.0, when a user removes and then re-installs the app, they will get a new distinct_id value.

Example ID: f47ac10b-58cc-4372-a567-0e02b2c3d479


Did this answer your question?



Article is closed for comments.