Mixpanel Community Icon

Custom Queries for Distinct User IDs or Emails in Cohorts

·
·

Is it possible to write a custom query to search for a list of distinct id or user id or emails from a list? Or Create a cohort of user from a list of distinct id or user id or email without doing it manually?

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

    Yes, it is possible to create a cohort of users from a list of distinct IDs, user IDs, or emails in Mixpanel without doing it manually. There are a couple of approaches you can take:1. Using the Cohort Builder: You can create a cohort using the Cohort Builder by uploading a list of user identifiers. As mentioned in the Mixpanel documentation on cohorts, you can: - Add a unique property to the CSV file that sorts the profiles into a cohort (e.g., "Cohort = Android Users") - Upload this CSV to Mixpanel - Create a cohort by filtering for user profiles with that propertyThis method allows you to create a static cohort based on your list of identifiers.2. Using the Query API: For a more programmatic approach, you can use Mixpanel's Query API to create a custom query. The Query API documentation shows that you can use the /engage endpoint to query profiles. You could potentially use this to create a cohort based on a list of distinct IDs, user IDs, or emails.Here's an example of how you might structure such a query::LBKSLBKS```LBKS{ "distinct_ids":: ["id1", "id2", "id3"], "output_properties": ["last_name", "$first_name"] }```This query would return the specified properties for the users with the given distinct IDs.3. Exporting and Importing: If you have a large list of identifiers, you might consider exporting your cohort and then re-importing it with your desired list of users. This could be more efficient for large datasets.Remember that when creating cohorts this way, they will remain static and won't update automatically over time like dynamically defined cohorts would.For the most up-to-date and detailed information on these methods, I recommend checking the latest Mixpanel documentation or contacting Mixpanel support directly, as features and capabilities may have been updated since the time these knowledge sources were created.

    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.