Docs
Quickstart
Identify Users

Identify Users

Overview

This step introduces the identify method, which allows you to see which users triggered each event in Mixpanel.

It also introduces the people.set method, which allows you to define the attributes of each user.

Code

Replace USER_ID with a unique identifier, preferably the user ID from your database.

Including the user's email is also suggested, along with any additional User Properties such as name, avatar, created date, etc.

mixpanel.identify('USER_ID')
 
mixpanel.people.set({ '$name': 'Jane Doe',
                      '$email': 'jane.doe@example.com',
                      'plan' : 'Premium'
                      // Add anything else about the user here
                      });

🎉 Congratulations, you've tracked your first user! You can see them in Mixpanel via the Users page (opens in a new tab).







Next: Track Events

Once you've implemented identify, it's time to track what your users are doing in your product.




FAQ

How do I connect events from logged-out to logged-in users?

If tracking client-side, just call .identify(<user_id>) when a user logs in and .reset() when they log out. Mixpanel will automatically stitch the user journey across logged out and logged in.

If tracking server-side, check out our server-side best practices guide. For more information, read our comprehensive guide on Identifying Users.

What does Mixpanel track automatically?

Mixpanel's Data Ingestion APIs and Client-Side SDKs automatically collect certain properties on every event or user profile update. Examples include: location, operating system, device, etc. Mixpanel calls this auto-generated data "Default Properties".

Learn More About Default Properties

How can I track in a privacy compliant way?

If a user opts out of tracking, you can call the .optOutTracking() method on any of our client-side SDKs; this prevents any subsequent data being tracked from that user's device. Learn more here.

For iOS specifically: Mixpanel does not use IDFA, so it does not require user permission through the AppTrackingTransparency(ATT) framework. For more details, refer to our Apple App Developer Privacy Guidance (opens in a new tab).

Was this page useful?