I need to set plan with user. Plan column should change when user change plan
Hi Anjali N., Please stand by as I search the Mixpanel knowledge base for an AI-powered answer. I normally take about 15 seconds or so. In case AI cannot answer your question, feel free to reach out to Mixpanel support at mixpanel.com/get-support. If you have follow-up questions for this thread, please tag me again with your question: @kapa.ai <follow-up question> 👋
Feel free to ask a follow-up question once I've answered by mentioning me with @kapa.ai
To store a user’s plan in Mixpanel and have it update when the user changes plan, you should: 1. Identify the user with a stable ID.
2. Set a profile property (for example plan) on their user profile.
3. Call the same “set” method again whenever the plan changes; Mixpanel will overwrite the previous value.Here are examples in several SDKs.
JavaScript (web)
js
// Once per session (or after login)
mixpanel.identify('USER_ID');LBKS// Set or update plan
mixpanel.people.set({
plan: 'Premium'
});LBKS// Later, when user changes plan:
mixpanel.people.set({
plan: 'Enterprise' // overwrites previous value
});LBKS```LBKSLBKS[[JS profiles](https://docs.mixpanel.com/docs/tracking-methods/sdks/javascript#storing-user-profiles)]
React Native
js
mixpanel.identify('USER_ID');LBKS// Initial plan
mixpanel.getPeople().set('plan', 'Premium');LBKS// On plan change
mixpanel.getPeople().set('plan', 'Enterprise');LBKS```LBKSLBKS[[React Native profiles](https://docs.mixpanel.com/docs/tracking-methods/sdks/react-native#storing-user-profiles)]
Go (backend)
mp := mixpanel.NewApiClient("YOUR_PROJECT_TOKEN")LBKS// Initial plan
user := mixpanel.NewPeopleProperties("USER_ID", map[string]any{
"plan": "Premium",
"$ip": 0,
})
_ = mp.PeopleSet(ctx, []**mixpanel.PeopleProperties{user})LBKS// On plan change
userUpdate := mixpanel.NewPeopleProperties("USER_ID", map[string]any{
"plan": "Enterprise", // overwrites
"$ip": 0,
})
_ = mp.PeopleSet(ctx, []**mixpanel.PeopleProperties{userUpdate})LBKS```LBKSLBKS[[Go profiles](https://docs.mixpanel.com/docs/tracking-methods/sdks/go#storing-user-profiles)]
General rule
- Use the profile “set” method for your SDK (people.set, PeopleSet, Mixpanel.People.Set, etc.).
- Use the same distinct_id / user ID each time.
- Whenever the user changes plan in your app, call the same method again with the new plan value; Mixpanel will automatically update the “plan” column on that user’s profile. [Identify 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.
