Mixpanel supports five data types for properties: string, numeric, boolean, date and list.
The images represent how each data type will appear in the properties drop-down in Mixpanel reports so that you can distinguish the type of property you select:
String
Mixpanel will treat any value sent that doesn’t match any other data type as a string. In reports, Properties sent as strings will allow Events to be broken out by each unique value.
Example:
mixpanel.track('Account Created', {'Account Type': 'Paid'});
String properties have a field size character limit of 255 bytes.
Numeric
Mixpanel treats any value that is a number (whether integer or decimal) as a numeric Property. Reports can display numeric Properties as histograms.
Example:
mixpanel.track('Application Loaded', {'Load Time (seconds)': 1.231});
Boolean
Mixpanel treats Properties as booleans if the value is either the JSON constant true or false.
Example:
mixpanel.track('Played Video', {'Ad Included': true});
Date
To guarantee appropriate typecasting across all Mixpanel reports, use the date format YYYY-MM-DDTHH:MM:SS. Make sure you’re sending dates in this format by using the .toISOString method in JavaScript if possible, which will also ensure dates are sent to Mixpanel in UTC.
If you send a unix timestamp as a date, Mixpanel will treat it as an integer; however, in the Mixpanel UI, you can force it to be treated as a date (see Typecasting section below).
Note: A property value that is formatted as a date will be passed as a date type.
Example:
mixpanel.track('Account Created', {'Date First Seen': '2016-06-01T12:34:56'});
List
Send a list of values as a JSON array.
Example:
mixpanel.track(
'Order Successful',
{'Products': ['Jacket', 'Helmet', 'Gloves']}
);
List properties are subject to limits solely based on serialized size. For events, the total list size cannot exceed 8 KB for events. For profiles, the total list size cannot exceed 256 KB. Additionally, each item in the list cannot exceed 255 bytes.
See the List Type Operators section below to learn how list properties can be used to filter events or user profiles in reports. You can also visit our guide on List Property Support for more detailed information.
Typecasting
Mixpanel allows you to force Properties into another data type by using the "Data Type" option in the overflow menu for property filters and breakdowns.
Typecasting is helpful when one of your properties is a number but is sent to Mixpanel as a string and you want to see histogram data for that property. Or if one of your properties is a unix timestamp and got sent as a number, and you want it to be treated as a date Property instead.
Data Type Operators
Every data type has a different set of operators to choose from when you filter by a property of that data type. All filters are of the form:
Property Name (the event or user property you want to filter on) |
Operator (picked from the operators available for this property type) |
Operand (the value you want to match against) |
Each operator matches all events or user profiles for which the property value matches the operand. For example, if you’re looking for all users for whom the value of a string property, say “Account Type”, contains a specific word, say “Premium”, then you would use the following filter: “Account Type contains Premium”.
Use the tables below as a reference for how each data type and operator works:
String Type Operators
= (equals) | Determines if the property value is an exact match for the operand. Example: "foo" = "foo" |
≠ (does not equal) |
Opposite of = Example: "foo" ≠ "bar" |
∋ (contains) |
Determines if the property value is a partial match for the operand i.e. if the operand appears anywhere in the property value: Example: "the quick brown fox" ∋ "quick" Note that, in practice, “contains” is usually a better operator to use than “equals”. |
∌ (does not contain) |
Opposite of ∋ Example: "lorem ipsum" ∌ "quick" |
is set | Determines if the property exists for the event or user profile. |
is not set | Opposite of "is set" |
Number Type Operators
= (equals) |
Determines if the property value is equal to the operand. Example: 42 = 42 |
≠ (does not equal) | Opposite of = |
> (greater than) |
Determines if the property value is greater than the operand. Example: 456 > 352 |
≥ (greater than or equal) |
Determines if the property value is greater than or equal to the operand. Example: 456 ≥ 352, 42 ≥ 42 |
∋ (between) | Determines if the property value is within the given range. |
∌ (not between) | Opposite of ∋ |
< (less than) |
Determines if the property value is less than the operand. Example: 786 < 1416 |
≤ (less than or equal) |
Determines if the property value is less than or equal to the operand. Example: 786 ≤ 1416, 42 ≤ 42 |
Boolean Type Operators
is True |
Determines if the property value is truthy. See the Boolean data type section above for explanation. |
is False | Opposite of "is True" |
List Type Operators
List properties support two special operators: Any and All. These operators can be combined with the full range of string operators (shown above) to create filters that match individual elements in a list.
Any |
Determines if any one of the elements in a list property value match the specified string filter. For example, consider a list property "#hashtags", and suppose you want to match all events where any of the elements in the value of "#hashtags" contain the string "datadriven". You would use the following filter: |
All |
Determines if all of the elements in a list property value match the specified string filter. Continuing the above example, if you wanted to match events where all "#hashtags" contain the string "datadriven", the filter you would use would be: |
Please note that any elements in the list that are not strings, will be type-casted to strings. For more information on list properties, see our guide to List property support.
Date Type Operators
Operator |
Operates on |
"in the last"/"not in the last" "before the last" "in the next" |
Intervals in time increments of "hours", "days", "weeks", "months" |
"on"/"not on" "before" "since" |
Exact dates |
"between"/"not between" | Date ranges |
Comments
Article is closed for comments.