Skip to main content

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.

Why Identify Users?

Identifying users allows you to:
  • Track user journeys across sessions and devices
  • Analyze behavior by user cohorts
  • View individual user profiles
  • Send targeted messages based on user properties

Code Examples

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': '[email protected]',
  'plan': 'Premium'
  // Add anything else about the user here
});

Next Steps

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

Capture Events

Learn how to track user actions and behaviors

FAQ

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.
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
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.

Build docs developers (and LLMs) love