Users with the Consumer role cannot create new custom properties, but they can use custom properties created by other users.
Create custom properties in Insights and Funnels to combine different properties or to restrict the property to specific values. Using a combination of properties, functions, numeric operators, and comparison operators described below, you can create a new property based on your existing properties and customize it to your exact specifications.
Create a Custom Property
Take existing properties (event properties or user profile properties) and use Excel-like formulas to transform those properties to create new properties.
Example use-cases include:
- Create custom buckets to group your property values into
- Merge property values to fix implementation issues
- Create new properties based on the values of different properties
- Round numeric property values
- Extract terms from a URL using regex
Click Create event/user profile property to open the property builder. If you select this option under EVENT PROPERTIES you will only be able to select event properties to build your custom property from. If you select this option under USER PROFILE PROPERTIES you will only be able to select user profile properties.
Enter a name for the custom property. Select one or more properties to combine and transform. Each property you select is given a letter code beside it, which you can use in the Formula field to create a formula to customize the property.
When writing your formula, click Ctrl + Space to see a list of all the available functions and their descriptions.
Click the Insert Example drop down to view a list of example formulas and insert them into the Formula field.
Custom properties are temporary for the current report by default if you click Create. To save the custom property permanently for use in other reports and to make it usable by other project members, click Save Permanently. Clicking Save Permanently will take you to an additional window where you can set the Visibility and Editing controls.
Use the following functions in the Formula field to modify your custom property:
|Function Name||Definition||Syntax & Example|
|if||Evaluates if an expression is true or false.||
if(condition, value if true, value if false)
if(A==”Facebook” or A==”Twitter”, “Social”, A)
|ifs||Runs multiple checks and returns a value corresponding to the first true result. If no conditions are true, undefined is returned.||
ifs(condition1, value1, condition2, value2, …)
ifs( A<60,”Less than 1 hour”,
A<120, “More than 1 hour but less than 2 hours”,
A>=120, “More than 2 hours”)
|not||Returns values that are not true.||
|and||Returns true if both conditions are met. Else, returns false.||
x and y
if(A==”San Francisco” and
B==”Chrome”, ”Valid user”, ”Invalid User”)
|or||Returns true if either condition is met. Else, returns false.||
x or y
if(A==”San Francisco” or B==”Chrome”, ”Valid user”, ”Invalid User”)
|in||Returns true if the first condition is contained in the second condition.||
x in condition
if(“Facebook” in A, “Facebook Corporation”, A)
|boolean||Casts the argument to a boolean.||
boolean(value)->false, boolean(alternate value)-> true
|number||Casts the argument to a number.||
number(value to cast)
|string||Casts the argument to a string.||
string(value to cast)
|defined||Determines if a value exists. If a property is not defined on a parent event or profile, this will return false, otherwise this will return true.||
defined(variable to check for existence)
|has_prefix||Determines whether a string starts with another string. This comparison is case-insensitive.||
has_prefix(string to check, prefix)
|has_suffix||Determines whether a string ends with another string. This comparison is case-insensitive.||
has_suffix(string to check, suffix)
|min||Determines the minimum value between two numbers.||
|max||Determines the maximum value between two numbers.||
|floor||Returns the largest integer that is smaller than or equal to the input (ie: rounds down to the nearest integer).||
Returns the smallest integer value greater than or equal to the input (ie: rounds up to the nearest integer).
|round||Returns the nearest integer value of the input value.||
|upper||Cast string property values to uppercase.||
upper(A); upper(“hello”) -> “HELLO”
|lower||Cast string property values to lowercase.||
lower(A); lower(“FacEBook”) -> “facebook”
If haystack is a string and pattern matches at least one substring, extracts the result from the first pattern match in haystack. The result is a string equal to the entire regex match, or if capture group is specified, only that portion of the match.
regex_extract(haystack, pattern, <optional capture group #>)
Returns true if the pattern matches any part of the string.
regex_match(“zzhaystackzz”, “ha(..)ack”) -> true
Returns the date/time difference between two date/time values. Users have the option of getting the time difference in one of these units:
D: number of days between start_date and end_date.
W: number of weeks between start_date and end_date.
M: number of months between start_date and end_date.
MD: number of days between start_date and end_date after subtracting whole months.
YM: number of whole months between start_date and end_date after subtracting whole years.
YD: number of days between start_date and end_date, assuming start_date and end_date were no more than one year apart.
Please also note, that in order to get the current date, users can use TODAY().
datedif(registrationdate,TODAY(), “M”) -> 5
Returns the length of the string or the list.
len (string) or len (list)
len(“Canada”) -> 6
Use the following numeric operators in the Formula field to modify your custom property using:
- + : Addition
- - : Subtraction
- * : Multiplication
- / : Division
- % : Modulo
Use the following comparison operators in the Formula field to modify your custom property:
- < : The first number is strictly less than the second number.
- > : The first number is strictly greater than the second number.
- >= : The first number is greater than or equal to the second number.
- <= : The first number is less than or equal to the second number.
- == : The first argument is equal to the second argument. If both arguments are strings, the comparison is case-insensitive.
- != : The first argument is not equal to the second argument. If both arguments are strings, the comparison is case-insensitive.
- False : Represents the literal value of boolean false.
- True : Represents the literal value of boolean true.
- Undefined : Represents the literal value of cases that aren’t defined.
Use custom properties to create arbitrary ranges of your numerical properties. This is applicable when you want to create age groups from age, income classes from salary, and other numeric property transformations relevant to your business.
If you have a property for “Days since registration” and you want to bucket the users into “Months since registration” (0-1 months: X users, 1-6 months: Y users, 6+ months: Z users), you can use custom properties.
Take the property of “Days since registration” and create a new property called “Months since registration" with this transformation:
Ifs( A/30 <= 1, "0-1 months", A/30 <=6, "1-6 months", A/30 >6, "More than 6 months" )
Merge Values to Fix Implementation Issues
Use custom properties to combine multiple property values into one. This is helpful when customers want to take multiple variations of a property value (e.g. facebook, fb, fbsocial) and then combine them into one property value (e.g. facebook).
If you send values into Mixpanel with variations (even though they may have been minor) and you want to correct this issue by grouping those values together.
A marketing manager wants to understand what portion of the user base is coming through a social traffic acquisition path. They want to group all social channel values into a single value, and keep the rest of the channels as-is.
They can create a custom property using the channel with this transformation:
if("Facebook" in A or "Linkedin" in A or "Twitter" in A, "Social", A)
Create New Properties Based on Values of Different Properties
Use custom properties to create a new property using the values of multiple other properties.
A marketplace company wants to track total purchase amount for an order, but the per-unit price is passed as a property and the number of items is passed as a property.
They can create a custom property using “price” and “quantity” with this transformation:
Modify Defined Properties
Use custom properties to create a new property if and only if a property is defined.
A telco company charges its customers based on talk-time (minutes spoken) and on apps purchased. If the company wants to track the average duration per minute, they would want to restrict the calculation to just the purchases for talk-time (where duration (minutes) is defined).
They can create a custom property using “Duration” and “Amount” with this transformation:
if(defined(A), B/A, B)
Check whether Property Values Are the Same
Use custom properties to create a new property if two property values are the same.
A company wants to find out what percentage of purchases are being made by users that have changed countries since sign up.
They can create a custom property to determine whether the two country values are the same with this transformation:
Transform String Property Values to Upper/Lowercase
Use custom properties to change the case of a string property value.
If a company that sells ice-cream wants to look at popular pie flavors, and if the flavors were written with different casing (“vanilla”, “Vanilla”, vaNilla”), the three values would show up differently as opposed to being the same.
They can create a custom property that combines and casts all these values to the same case using this transformation:
upper(A) or lower(A)
Visibility and Editing Controls
When you create custom properties and select Save Permanently, you have the option to decide whether it should be exposed to other project members (visibility controls), and whether you want other non-project owners to have the ability to change the custom properties (editing controls).
When users create a custom property, they have the ability to either:
- Create a custom property temporarily.
- Save a custom property but for themselves. The custom property persists, but is only available for that user.
- Save a custom property for everyone to see and use. The custom property persists and is available to all users in the project.
Users can change these settings at any point of time.
When users create a custom property, they have the ability to choose to not let other non-project owners edit the definition of the custom property. The project owners can always change the definition of any custom property.