Overview
This step introduces theidentify 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
ReplaceUSER_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.
- JavaScript
- Python
- PHP
- Node.js
- Go
- Ruby
- Java
- React Native
- Flutter
- iOS Objective-C
- iOS Swift
- Android
- Unity
Next Steps
Once you’ve implementedidentify, it’s time to track what your users are doing in your product.
Capture Events
Learn how to track user actions and behaviors
FAQ
How do I connect events from logged-out to logged-in users?
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?
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?
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.