kapa.ai Suppose I set USER_ROLE at the user profile level on first login. I imagine that we call people.set() to define a user and we would include this data as a property. Now imagine on the second login, the user's USER_ROLE changed to something else, would this overwrite the existing property on the first profile or would it create a new user profile?
If you use people.set() (or its equivalent in your SDK) to set the USER_ROLE property on a user profile, and then call people.set() again for the same user (same distinct_id) with a new value for USER_ROLE, the existing property will be overwritten with the new value. It will not create a new user profile; the update will apply to the existing profile for that user.This behavior is consistent across Mixpanel SDKs, including JavaScript, Node.js, Python, Go, Swift, Android, iOS, Flutter, Unity, Ruby, and PHP. The documentation states: > If a profile property already exists, it will be overwritten with the latest value provided in the method. If a profile property does not exist, it will be added to the profile. Mixpanel SDKs: Javascript, Mixpanel SDKs: Node.js, Mixpanel SDKs: Python, Mixpanel SDKs: Go, Mixpanel SDKs: Swift, Mixpanel SDKs: Android, Mixpanel SDKs: iOS (Objective-C), Mixpanel SDKs: Flutter, Mixpanel SDKs: Unity, Mixpanel SDKs: Ruby, Mixpanel SDKs: PHPSo, on the second login, if the user's USER_ROLE changes and you call people.set() with the new value, the USER_ROLE property on the existing user profile will be updated to the new value.
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
Let me check the knowledge base for you again. One moment! 📚
Yes, it makes sense to call people.set() on the second login if you want to update the user's profile properties, such as if their USER_ROLE has changed. According to the documentation, calling people.set() will overwrite the existing value of a profile property with the new value provided. This is the intended way to keep user profile information up to date in Mixpanel. It will not create a new user profile, but will update the existing one associated with the same distinct_id Docs: Javascript SDK - Storing User Profiles Docs: Node.js SDK - Storing User Profiles.So, if the user's role or any other profile property changes, you should call people.set() again to reflect the latest information on their profile.
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
Let me check the knowledge base for you again. One moment! 📚
Yes, it is appropriate to call people.set() on each login if you want to ensure that the user's profile properties in Mixpanel are always up to date. The documentation confirms that calling people.set() will update existing properties with new values or add new properties if they do not exist. This will not create a new user profile, but will update the existing profile for that user (identified by their distinct_id) with the latest information you provide, such as changes to USER_ROLE or other attributes Docs: Javascript SDK - Storing User Profiles Docs: Node.js SDK - Storing User Profiles.This approach is recommended for keeping user data accurate, especially if profile properties may change between logins.
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
Let me check the knowledge base for you again. One moment! 📚
In Mixpanel, the distinct_id is the unique identifier used to track a user across events and profile updates. When you call people.set() to update a user profile, you must specify the distinct_id of the user whose profile you want to update. This ensures that the profile properties (like USER_ROLE) are associated with the correct user.- If you call people.set() with the same distinct_id on each login, Mixpanel will update the existing user profile for that user, not create a new one.
- If you use a different distinct_id, Mixpanel will treat it as a different user and create a new profile.The distinct_id should be consistent and unique for each user. On the client side, Mixpanel SDKs automatically generate a random distinct_id for anonymous users, but once a user logs in or registers, you should assign a known, stable ID (like a database user ID) as the distinct_id by calling identify() Identity Management Overview FAQ: What is a distinct_id?.Summary:
- distinct_id links events and profile updates to the same user.
- Always use the same distinct_id for a given user to ensure their profile is updated correctly.
- Calling people.set() with the same distinct_id will update the existing profile, not create a new one.If you want to keep user profiles accurate, ensure you are always using the correct distinct_id when calling people.set() User Profile: Demographic attributes for your users.
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
Let me check the knowledge base for you again. One moment! 📚
You cannot force Mixpanel to always use your user UUID as the canonical distinct_id. When you identify a user (e.g., by calling .identify(user_id)), Mixpanel creates an identity cluster that includes both the anonymous device ID and your user ID. Mixpanel then programmatically selects the canonical distinct_id from the IDs in the cluster, and this selection is not user-configurable. The canonical distinct_id could be your user UUID or the device ID, depending on Mixpanel’s internal merging logic. However, you can always use your user UUID as a user property for querying and troubleshooting purposes Canonical Distinct ID FAQ: Why is my user’s distinct_id set to the anonymous device ID even after I identify them using my own user ID?.Recommendation:
Track your user UUID as a separate user property (e.g., via .people.set() or as a super property) to ensure you can always query and reference your own identifier, regardless of which ID Mixpanel selects as the canonical distinct_id.
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
