Expressions

General info

Expressions are formulas that can be created for both customers and events and serve as derived attributes which can combine multiple attributes and can be used for further specification of customers or events. Expressions for events work as an event attribute, and expressions for customers work as customer attributes.

expressions_fixed

 

Management expressions

Creating an expression

Expressions are created in Data & Assets, management section.

First, you need to select if you intend to derive for a customer, or an event. This will determine where the derived attribute can be used. After that, you can type the formula into the field, or you can use the buttons to add attributes and functions and then edit them.

 

expression creation

Expressions consist of three main parts: attributes, functions and operators.

  • Attributes are customer or event attributes, aggregates or running aggregates that were either defined previously, or are created directly from the expression builder. These provide the values to the formula
  • Functions take the values from attributes and return a value based on the input
    • Max(A,B) compares the two values and returns the bigger one. This function takes only two attributes. If more attributes are to be compared, one can use multiple functions inside, e.g. Max( Max(A,B),Max(C,D))
    • Min(A,B) compares the two values and returns the smaller one. This function takes only two attributes. If more attributes are to be compared, one can use multiple functions inside, e.g. Min( Min(A,B),Min(C,D))
    • Ifnull(A,B) checks the A attribute for value. If it is set, ifnull returns A. If A is not set, the returned value is B
    • Floor(A) removes the decimal part of the A value
    • Ceil(A) rounds the A value upward
    • Round(A) rounds the A value mathematically
    • Now() returns the actual timestamp
  • Operators are basic mathematical functions for adding, retracting etc. the other components of the expression

Uses

Expressions are used when further specifying events or customers e.g. in segmentations, reports, funnels, etc. They can be used similarly as other attributes to be compared to a constant value or other attributes. Some of the uses are as follows:

  • Setting a simple value to which multiple attributes are compared. When a need arises to change the compared value, you can change only the expression to affect all of the conditions instead of changing them one by one
  • Attributing revenue to some actions. To evaluate the effectiveness of a newsletter, web layer or other campaign, it is good to count only purchases that occur within specific time after the action. For that you would define expression for purchase event and setting it to timestamp minus running aggregate of last banner timestamp and then compare it to desired value.

expression example

 

Updated on August 21, 2017

Was this article helpful?

Related Articles