Calculated fields enable you to track events as they come in, set up a calculation using event fields, and store the resulting data on a participant’s profile. Once the calculated field is set up, its value will update dynamically as you send us events that meet your criteria.
This guide will show you the basic process for setting up a calculated field, including two examples at the end. For more details about how calculated fields work and what types of calculations are possible, see our article on calculated fields.
To create the calculated field, you can do so in two ways:
Navigate to Data → Fields and select Create calculated field.
From the Program Setup screen, add or edit a goal or action. Under the Goal or Action Criteria heading, select the
[Dropdown Menu] to set a Condition and then select Create New Calculated Field.
Complete the fields:
Name
Event
Calculation
Event field (if applicable for your calculation)
Apply an optional tracking window if you want to perform a sum or count calculation on a rolling basis. The time zone selected on the Settings → General page will apply to the tracking window.
Tip
For details about the window types and when to use them, see Tracking Windows for Calculated Fields.
If you applied a sliding window, then you can set a maximum value to be counted for each unit of your interval (e.g., each day in a 60 day interval).
Add an optional active period if you want to set a start and end date for the calculation.
Add filters if you only want events that meet specific criteria to be included in the calculation.
Review your selections and decide if you want to backfill the values for all participants.
Save your changes.
Reward participants who make 3 or more purchases of at least $50 in one month after the referral was started
Scenario
You have a referral program and want to reward participants who frequently make sizable purchases soon after they’ve been referred. You determine that for your program, this means any participant who makes 3 or more purchases of at least $50 in the month after the referral starts. A calculated field can help you determine which of your participants meet this threshold and act as the basis for a program rule that issues these participants a reward.
Here’s how the calculation can be set up:
Under the Calculation heading, complete the Name field.
Enter the following values for the event and calculation fields:
Apply a fixed tracking window. This will cause the calculation to reset each month.
Select Fixed Window.
Select a 1 calendar month window duration.
Add a filter to specify that you only want to count the purchase events with a value of $50 or more:
Select Add Rule.
For the first Condition
[Dropdown Menu], select the
events.fields.revenue
field.Change the operator type to greater than or equal to.
Enter
50
as the string variable value.
Review and save.