how to use group property? Which group properties method can I use? Can I use the same method for adding a user properties?
Hi hanjuuu, 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
Using Group Properties in Mixpanel
Group properties in Mixpanel allow you to create and manage profiles for groups (like companies or organizations) similar to how you manage user profiles. Here's how to use them:
Setting Group Properties
To set group properties, you first need to: 1. Assign a user to a group using setGroup()
2. Get the group using getGroup()
3. Set properties using the group's set()
methodLBKS// Assign user to a group mixpanel.set_group('company', 'mixpanel');LBKS// Set group properties mixpanel.get_group('company', 'mixpanel').set({ name: 'Mixpanel', features: ['reports', 'alerts', 'cohorts'], employee_count: 100 });LBKS
Available Group Property Methods
Mixpanel offers several methods for managing group properties across all SDKs: 1. set() - Sets or updates group properties 2. setOnce() - Sets properties only if they don't already exist 3. unset() - Removes specific properties from a group profile 4. union() - Adds values to a list property without duplicates 5. remove() - Removes specific values from a list propertyJavaScript SDK documentation provides examples of these methods.
Differences from User Properties
While group properties work similarly to user properties, they require different methods. You cannot use the same methods for both: - For users: mixpanel.people.set()
- For groups: mixpanel.get_group().set()
Each SDK has its own implementation, but the concept remains the same across platforms. For example, in Android you'd use mixpanel.getGroup().set()
and in iOS Swift Mixpanel.mainInstance().getGroup().set()
.The methods are conceptually similar (set, setOnce, union, etc.) but they're implemented differently for groups versus users.Would you like examples for a specific SDK or programming language?
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! 📚
Based on the knowledge sources provided, I can explain the .add()
method in Mixpanel for incrementing numerical properties.The .add()
method is specifically designed for incrementing numerical properties in user profiles, not group profiles. It's part of Mixpanel's profile operations and is used to maintain running counts or totals.According to the Ingestion API documentation, this method: > "Takes a JSON object containing keys and numerical values. $add will increment the value of a user profile property. When processed, the property values are added to the existing values of the properties on the profile. If the property is not present on the profile, the value will be added to 0. It is possible to decrement by calling "$add" with negative values."Ingestion API - User ProfilesThis is particularly useful for maintaining counters like "Number of Logins" or "Files Uploaded" on user profiles.Unlike the group methods we discussed earlier (set, setOnce, union, remove), the .add()
method is specifically for numerical operations on user profiles, not group profiles. The group profile methods we covered in our previous conversation (set, setOnce, union, unset, remove) are the primary methods available for group property management.If you're looking to increment numerical values in group properties, you would typically use the standard .set()
method after retrieving the current value and incrementing it manually.Would you like more specific information about implementing numerical increments for either user or group profiles in a particular SDK?
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.