Custom Properties

This feature is in Beta and is currently available in the InsightsFunnels, Flows, and Retention reports, as well as Dashboards.

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 people 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

CustomProperties.png

Click Create event/people 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 PEOPLE PROPERTIES you will only be able to select people properties.

Screenshot_2019-11-01_14.28.35.png

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.

Screen_Shot_2019-11-01_at_12.38.55_PM.png

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.

Functions

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)

Example:

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, …)

Example:

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. 

not(condition)

Example:

not (A)

 and Returns true if both conditions are met. Else, returns false.

x and y

Example:

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

Example:

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

Example:

if(“Facebook” in A, “Facebook Corporation”, A)

 boolean  Casts the argument to a boolean.

boolean(value)->false, boolean(alternate value)-> true

Example:

boolean(A)

 number  Casts the argument to a number. 

number(value to cast)

Example:

number(A)

 string  Casts the argument to a string.

string(value to cast)

Example:

string(A)

 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)

Example:

defined(A)

 has_prefix  Determines whether a string starts with another string. This comparison is case-insensitive.

has_prefix(string to check, prefix)

Example:

has_prefix(A, "United")

 has_suffix Determines whether a string ends with another string. This comparison is case-insensitive.

has_suffix(string to check, suffix)

Example:

has_suffix(A,"States")

 min Determines the minimum value between two numbers.

min(number, number)

Example:

min(A,B)

 max Determines the maximum value between two numbers.

max(number, number)

Example:

max(A,B)

 floor Returns the largest integer that is smaller than or equal to the input (ie: rounds down to the nearest integer).

floor(number)

Example:

floor(A)

 ceil

Returns the smallest integer value greater than or equal to the input (ie: rounds up to the nearest integer).

ceil(number)

Example:

ceil(A)

 round Returns the nearest integer value of the input value.

round(number)

Example:

round(A)

 upper Cast string property values to uppercase.

upper(string property)

Example:

upper(A); upper(“hello”) -> “HELLO”

 lower Cast string property values to lowercase.

lower(string property)

Example:

lower(A); lower(“FacEBook”) -> “facebook”

 regex_extract

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  #>)

Example:

regex_extract(“iPhone5.1”,"iPhone(...)",1) ->5.1

 regex_match

Returns true if the pattern matches any part of the string.

regex_match(haystack, pattern)

Example:

regex_match(“zzhaystackzz”, “ha(..)ack”) -> true  

Numeric Operators

Use the following numeric operators in the Formula field to modify your custom property using: 

  • + : Addition
  • - : Subtraction
  • * : Multiplication
  • / : Division

Comparison Operators

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 Cases

Custom Bucketing

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.

For example:

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" )

Screen_Shot_2019-11-01_at_12.03.55_PM.png

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. 

For example:

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)

Screen_Shot_2019-11-01_at_12.13.29_PM.png

Create New Properties Based on Values of Different Properties

Use custom properties to create a new property using the values of multiple other properties.

For example:

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:

A*B

Screen_Shot_2019-07-22_at_1.31.47_PM.png

Modify Defined Properties

Use custom properties to create a new property if and only if a property is defined.

For example:

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)

Screen_Shot_2019-11-01_at_12.18.24_PM.png

Check whether Property Values Are the Same

Use custom properties to create a new property if two property values are the same.

For example:

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:

if(A==B,FALSE, TRUE)

Screen_Shot_2019-11-01_at_12.20.14_PM.png

Transform String Property Values to Upper/Lowercase

Use custom properties to change the case of a string property value.

For example:

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)

Screen_Shot_2019-11-01_at_12.21.54_PM.png

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).

Screen_Shot_2019-11-01_at_12.23.50_PM.png

Visibility 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.

Editing Controls

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.

Is this article helpful?

Comments

0 comments

Article is closed for comments.