Mixpanel Community Icon

Creating Cohorts in Mixpanel Using Group Properties like Plan

·
·

i use mixpanel group analytics feature. I make group calls immediately after my identify call right after user login. however, when creating cohort, i cannot filter users by group property. how can create a cohort of users by filtering users on group property such as plan

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

    Hi Moon L., 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

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

    To create a cohort of users by filtering on a group property like 'plan' in Mixpanel, you need to ensure that the group property is also added to the user's profile. Based on the information provided in the knowledge sources, here's how you can achieve this: 1. Add the group identifier to the user's profile: After making your identify call and group call, you should also set the group property as a user profile property. This step is crucial for connecting group information to a user profile.Here's an example of how to do this using the JavaScript SDK: LBKS// Identify the user mixpanel.identify('user_id');LBKS// Set the group mixpanel.set_group('company', 'mixpanel');LBKS// Add the group identifier to the user's profile mixpanel.people.set({"company":"mixpanel"});LBKS2. Set the group profile property: Ensure that you've set the 'plan' property for the group profile. For example: LBKSmixpanel.groups.set('company', 'mixpanel', { 'plan': 'Premium' });LBKSBy following these steps, you should be able to create cohorts based on group properties. The key is to add the group identifier to the user's profile, which allows you to use group properties when analyzing by Users in reports and when creating user cohorts.For more detailed information on implementing Group Analytics, you can refer to the Group Analytics documentation.If you're still unable to filter users by group property when creating a cohort after following these steps, it may be worth contacting Mixpanel support for further assistance, as the knowledge sources don't provide information about any potential limitations or issues with this specific use case.

    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.

  • Avatar of Moon L.
    Moon L.
    ·
    ·

    kapa.ai i use segment to route event to mixpanel and do not use mixpanel SDK directly. how can i still send group properties correctly so it can be used to filter users? for example, this is my group call: window.analytics.group(groupId, properties, { integrations: CUSTOM_INTEGRATIONS }); and identify call: window.analytics.identify(userId, userTraits, segmentOpts);

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

    Let me check the knowledge base for you again. One moment! đź“š

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

    Based on the information provided in the knowledge sources, I can guide you on how to correctly send group properties through Segment to Mixpanel so that they can be used to filter users. Here's how you can achieve this: 1. Group Call: Your group call looks correct. When using Segment, the group call will create or update a Group Profile in Mixpanel. According to the Segment documentation, the group call in Segment maps to the "Identify Group" action in Mixpanel.2. Identify Call: To ensure that the group property can be used to filter users, you need to add the group identifier to the user's profile. You can do this by including the group key and group ID in the userTraits of your identify call. Here's how you should modify your identify call: LBKSwindow.analytics.identify(userId, { ...userTraits, company: groupId // Assuming 'company' is your group key }, segmentOpts);LBKSBy adding the group identifier (in this case, 'company') to the user traits, Segment will send this information to Mixpanel, where it will be set as a user profile property. This step is crucial for connecting group information to a user profile in Mixpanel.3. Tracking Events: When tracking events, make sure to include the group key and group ID as properties. This ensures that events are attributed to the correct group in Mixpanel. For example: LBKSwindow.analytics.track('Event Name', { ...eventProperties, company: groupId // Assuming 'company' is your group key });LBKSBy following these steps, you should be able to use group properties to filter users in Mixpanel, even when using Segment as your data source.For more detailed information on the integration between Segment and Mixpanel, you can refer to the Segment integration documentation for Mixpanel.Remember to ensure that you have set up the Mixpanel destination correctly in your Segment account and that the group key is defined in your Mixpanel project settings.

    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.