how to identify group property with user identify method?
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
To connect group information to a user profile in Mixpanel, you need to include the group key and group ID as a user profile property using the appropriate identify or set method depending on the SDK you're using.Here's how to do it across different Mixpanel SDKs:
JavaScript
// with group id "mixpanel" as value
mixpanel.people.set({"company":"mixpanel"})LBKS```LBKS[Mixpanel JavaScript SDK](https://docs.mixpanel.com/docs/tracking-methods/sdks/javascript#group-analytics)
React Native
mixpanel.identify('12345');
// set group key "company" as a user prop with group id "mixpanel" as value
mixpanel.getPeople().set('company', 'mixpanel');LBKS```LBKS[Mixpanel React Native SDK](https://docs.mixpanel.com/docs/tracking-methods/sdks/react-native#group-analytics)
Android
mixpanel.identify('12345', true);
// Sets group key "company" as a user prop with group id "mixpanel" as the value
mixpanel.getPeople().set('company', 'mixpanel');LBKS```LBKS[Mixpanel Android SDK](https://docs.mixpanel.com/docs/tracking-methods/sdks/android#group-analytics)
iOS (Swift)
Mixpanel.mainInstance().identify(distinctId: "12345")
// set group key "company" as a user prop with group id "mixpanel" as value
Mixpanel.mainInstance().people.set(properties: ["company":"mixpanel", "$email":"joe.doe@​[example.com](http://example.com)"])LBKS```LBKS[Mixpanel Swift SDK](https://docs.mixpanel.com/docs/tracking-methods/sdks/swift#group-analytics)
PHP
// import dependencies
require 'vendor/autoload.php';
// create an instance of the Mixpanel class
$mp = Mixpanel::getInstance("YOUR_PROJECT_TOKEN");
// set group key "company" as a user prop with group id "mixpanel" as value
$mp-> people-> set("USER_ID", array(
'company' => "mixpanel",
), $ip = 0); // set $ip to 0 to prevent profile geolocation update
?> LBKS```LBKS[Mixpanel PHP SDK](https://docs.mixpanel.com/docs/tracking-methods/sdks/php#group-analytics)LBKSRemember that you need to have the group key defined in your project settings first before implementing group analytics.
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.