Creating event expressions
You can create an event expression to enrich its parameters while creating different types of analyses (for example, metrics, segmentations, funnels, and so on). This means that you can use the result of the event expression as a special parameter of an event in other types of analytics.
Requirements
A tracking code implemented into the website.
Creating an event expression
- Go to Analytics > Expressions > New expression.
- To let other users know about the purpose of the expression, you can add a short description to it.
- To select the type of expression you want to create, click the icon. From the dropdown list select Event.
- From the Choose event dropdown, select an event.
- To start creating the formula of the expression, click the Select button.
- You can choose one of four elements: customer, constant, dynamic key, or a function.
- To define the settings of the chosen element, click that element.
- In case you choose a customer, select the customer attribute you want to include in the formula.
- In case you choose a constant, type the number or text (users can write a number in words,
nine
instead of9
). - In case you choose a dynamic key, type in the key name (the ID of the key, for example
orderID
) and its default value. The default value will be replaced with the target one indicated in, for example, the request for expression result (when you request the expression result through Synerise Analytics API).
- Define the dependencies between the elements in the expression by selecting the mathematical operators.
- To complete creating the expression, click Save.
Example of use
Goal: To create a metric that counts liters of sold liquid products.
Prerequisites: Non-standard attributes for bought product event: product quantity
and product volume
. Instruction for adding event parameters available at the link.
Steps:
-
Go to Analytics > Expressions > New expression.
-
Enter the name of the expression.
Note: The name of the event expression becomes also the name of the parameter of the event. -
Select Event as a type of expression.
-
From the Choose event dropdown, select the
Bought products
event. -
Click the Select button.
Result: A dropdown list appears. -
From the dropdown list select Event attribute.
-
To display the settings of the event attribute, click it.
-
From the Choose parameter dropdown, select
quantity
. -
Next to the added event attribute, click the plus button. Result: A dropdown list appears.
-
From the dropdown list, select Event attribute.
-
To display the settings of the event attribute, click it.
-
From the Choose parameter dropdown, select
volume
. -
Multiply those two attributes, by selecting the multiplication sign between two event attributes.
-
To complete, click Save.
-
Go to Analytics > Metrics > New metric.
-
Enter the name of the metric.
-
As a type, select Simple metric.
-
As the aggregator, set
Count
. -
As the occurrence type, set
All
. -
From the Choose event dropdown list, select
Bought product
. -
Click button.
Result: The Choose parameter button appears. -
Click the Choose parameter button.
Result: A pop-up appears. -
On the pop-up, click the three-dot button.
Result: A dropdown shows. -
From the dropdown, select Expressions.
-
In the list of expressions, find the event expression you have just created.
-
To select a specific time range, click the calendar icon. Confirm your choice with the Apply button.
-
To complete the process, click Save.
Output: The metric counts the number of liters of purchased products in the form of a liquid from 6th of May to 6th of June. In this example, the number of purchased products is changeable, however, the product capacity is always the same and sourced from the product feed.