how can I create a custom property to check if a user id == some_id
Hi Elena M., 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 create a custom property in Mixpanel that checks if a user’s ID equals a specific value (e.g., some_id), you can use the formula language in the custom properties feature. The comparison operator you’ll use is ==, which is case-insensitive for strings.Here’s how you can define this custom property in the formula bar: LBKS$user_id == "some_id"LBKSThis formula will return true if the user’s ID matches "some_id", and false otherwise. You can use this custom property in your reports to filter or segment users accordingly. If you want to use a different user property (e.g., email), just replace $user_id with the appropriate property name.For more on custom property formulas and operators, see the official documentation: Custom Properties: Functions & Comparison Operators and Comparison Operators.
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! 📚
I'm sorry you're having trouble filtering by user ID in a custom property. According to the knowledge sources, when creating a custom property, you should use the property name exactly as it appears in your data. For the Simplified ID Merge API, the recommended property for user identification is $user_id, which should be a unique, unchanging string (such as a database ID) Identifying Users (Simplified).If filtering by $user_id == "some_id" or $user_id == some_id (as a string or number) does not work, here are some things to check: 1. Ensure $user_id is being set and ingested: The $user_id property must be present in your events. If you are not seeing results, it may be that the property is not being set or is named differently in your data. You can verify this by inspecting your raw event data in Mixpanel.2. Check the data type: Mixpanel treats property values as strings unless they are clearly numeric, boolean, date, or list types. If your user IDs are numbers, try using them as strings in your formula (e.g., $user_id == "12345"). If they are stored as numbers, use the numeric comparison (e.g., $user_id == 12345). However, user IDs are typically strings Supported Properties Data Type.3. Use the correct property: If you are using the default distinct_id instead of $user_id, try referencing distinct_id in your formula: distinct_id == "some_id".4. Case sensitivity: The == operator is case-insensitive for strings, so you do not need to worry about letter casing Comparison Operators.5. User Profile vs. Event Property: If you are creating a custom event property, both event and user profile properties are available. If you are creating a custom profile property, only user profile properties are available Custom Properties.If after checking these points it still does not work, it's possible that the property is not being set as expected in your data, or there may be a delay in data processing. The knowledge sources do not provide more specific troubleshooting steps for this scenario.If you continue to experience issues, I recommend verifying your event schema in Mixpanel to ensure the property exists and is populated as expected, and reviewing your implementation for any discrepancies.
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.
I'm sorry you're having trouble filtering by user id in a custom property. According to the knowledge sources, when creating a custom property, you should use the property name exactly as it appears in your data. For user properties, the property is typically called $user_id, but it may also be stored as a different property depending on your implementation.A few important points from the documentation: - The comparison operator == is case-insensitive for strings, and you can use it in custom property formulas:
```LBKS or, if your user ID is numeric:
```LBKS $user_id == 12345
```LBKS [Custom Properties: Comparison Operators](https://docs.mixpanel.com/docs/features/custom-properties#comparison-operators)LBKS- If you are using the Simplified ID Merge API, the canonical distinct_id is always set to the $user_id after identification. However, user profile properties are set on $distinct_id, not directly on $user_id. This means you may need to reference distinct_id in some contexts, not $user_id.
[Canonical Distinct ID](https://docs.mixpanel.com/docs/tracking-methods/id-management/identifying-users-simplified#canonical-distinct-id)LBKS- When referencing user properties in segmentation expressions or custom properties, ensure you are using the correct property path. For example, in segmentation expressions, you would use:
```LBKS user["$user_id"] == "some_id"
```LBKS [Segmentation Expressions](https://github.com/mixpanel/docs/blob/main/reference/Mixpanel%20APIs/segmentation-expressions.md)LBKSIf filtering by $user_id does not work, try filtering by distinct_id or check the exact property name in your data. Also, ensure that the user ID is being set and tracked correctly in your implementation.LBKSIf you continue to experience issues, the knowledge sources do not provide more specific troubleshooting steps for this scenario. It may be helpful to review your data schema in Mixpanel to confirm the property names and types being used.
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! 📚
