Mixpanel Community Icon

kapa.ai how to create a new property in user profile in mixpanel

·
·

kapa.ai how to create a new property in user profile in mixpanel

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    Please stand by Aditya G. as I search the knowledge base. I normally take about 15 seconds or so. đź‘‹

    Feel free to ask a follow-up question once I've answered by mentioning me with @kapa.ai

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    To create a new property in a user profile in Mixpanel, you need to use the appropriate method for your SDK. Here's how to do it across different platforms:

    JavaScript

    mixpanel.identify('12345');LBKS// Set a new property on the user profile mixpanel.people.set({ plan: 'Premium' });LBKS// You can set multiple properties at once mixpanel.people.set({ plan: 'Enterprise', company: 'mixpanel' });LBKS```LBKS[Mixpanel JavaScript SDK](https://docs.mixpanel.com/docs/tracking-methods/sdks/javascript#storing-user-profiles)

    React Native

    mixpanel.identify('12345');LBKS// Set a single property mixpanel.getPeople().set('plan', 'Premium');LBKS// Or set multiple properties at once let properties = {'plan':'Premium','company':'mixpanel'}; mixpanel.getPeople().set(properties);LBKS```LBKS[Mixpanel React Native SDK](https://docs.mixpanel.com/docs/tracking-methods/sdks/react-native#storing-user-profiles)

    Swift (iOS)

    Mixpanel.mainInstance().identify(distinctId: "12345")LBKS// Set properties Mixpanel.mainInstance().people.set(properties: ["plan":"Premium", "$email":"joe.doe@​[example.com](http://example.com)"])LBKS```LBKS[Mixpanel Swift SDK](https://docs.mixpanel.com/docs/tracking-methods/sdks/swift#storing-user-profiles)

    Node.js

    const Mixpanel = require('mixpanel'); const mp = Mixpanel.init('YOUR_PROJECT_TOKEN');LBKS// Create a user profile with properties mp.people.set('sample_distinct_id', { name: 'sam', plan: 'premium', ip: '0' // do not update geolocation });LBKS```LBKS[Mixpanel Node.js SDK](https://docs.mixpanel.com/docs/tracking-methods/sdks/nodejs#storing-user-profiles)

    Important Notes:

    1. You must call identify() before setting profile properties (for client-side SDKs) 2. If a profile property already exists, it will be overwritten with the new value 3. If a profile property does not exist, it will be added to the profile 4. For server-side SDKs (Node.js, PHP, Ruby, Go), consider setting IP to 0 to prevent geolocation updates from your server's locationThe exact method name varies slightly between SDKs (e.g., people.set() in JavaScript, getPeople().set() in React Native), so refer to the documentation for your specific platform.

    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.