Formulas
Calculate how many units a campaign gives from the contents of the cart.
Unit effects such as Add units take either a fixed number, for example 100, or a formula that calculates the amount from the transaction. Open the formula editor with the Σ button next to the effect's value.
items.total * 0.02This formula gives 2 units for every 100 of the transaction's value, so a purchase of 5,000 earns 100 points.

Variables
| Variable | Value |
|---|---|
items.count | Number of items in the transaction. |
items.total | Total value of the items in the transaction. |
sku('SKU').count | Number of items with this SKU. |
sku('SKU').total | Total value of the items with this SKU. |
category('CATEGORY').count | Number of items in this category. |
category('CATEGORY').total | Total value of the items in this category. |
SKU and CATEGORY are matched against the sku and category your integration sends on each product of the transaction, so write them exactly as you send them.
Operators
Use +, -, * and /, with parentheses to group.
Functions
| Function | Example | Result |
|---|---|---|
floor | floor(5.9) | 5, rounded down |
round | round(5.5) | 6, rounded to the nearest whole number |
ceil | ceil(5.1) | 6, rounded up |
abs | abs(-1.23) | 1.23, the absolute value |
min, max | min([items.total * 0.02, 500]) | The smallest or largest value in the list |
sum, avg | sum([1, 2, 3]) | 6, the sum or average of the list |
rand | rand(100) | A random whole number from 1 to 100 |
Examples
| Goal | Formula |
|---|---|
| 2 points per 100 spent | items.total * 0.02 |
| 1 point per full 100 spent | floor(items.total / 100) |
| 10 points per item | items.count * 10 |
| 5 points per 100 spent on one category | category('Electronics').total * 0.05 |
| 50 points per unit of one product | sku('SH-100').count * 50 |
| 2% back, at most 500 points | min([items.total * 0.02, 500]) |
When the campaign should count only some purchases, pair the formula with a
condition. For example, use category('Electronics').total * 0.05 with the
condition Has product from category Electronics.