Number Attribute
This article describes how to use the number attribute.
The number attribute stores a numeric value for browsing metrics such as visits, page views, and events. Common examples include Lifetime Value, Order Total Transaction, or Days Since Last Purchase.
How it works
Numeric values are stored as decimals or integers. Choose the type that matches your needs:

Decimal (default)
 Decimal values can have zero (0) or more decimal digits.
 Example:
12
,12.0
,12.345
 Recommended for attributes that represent monetary values.

Integer
 Only whole number values are stored.
 Example:
12
,4
,3214
 Useful for number attributes that represent quantities, counters, or scores.
The number attribute is available in the following scopes: Event, Visit, Visitor.
There are no storage capacity limits for number attributes, but these attributes are still limited by the maximum size of the profile after encryption and compression.
Number enrichments
Increment or decrement number enrichment
This enrichment modifies a number with a positive value (increment) or a negative value (decrement). The modifying value can be a separate number attribute or a constant value.
For example, to calculate the Lifetime Total Value (LTV) of a visitor’s orders use this enrichment to increment the attribute with the value of the order_total
attribute each time the purchase
event occurs.
Attribute Name: Lifetime Total Value
 Initial:
121.78
 Enriched With: order_total
220.00
 Result:
341.78
Set ratio
Set the quotient of two numbers as a new ratio number.
For example, to calculate the Average Cart Items Per Order use this enrichment to set the ratio of the Total Cart Items Purchased attribute to the Total Orders Completed attribute.
Attribute Name: Average Cart Items Per Order
 Initial: —
 Enriched With:
Total Cart Items Purchased:48.00
Total Orders Completed:3.00
 Result:
16.00
Set product
Set the product of two numbers as a new number.
For example, to calculate the coupon_discount_amount
, use this enrichment to multiply the order_subtotal
by the coupon_discount_percent
.
Attribute Name: coupon_discount_amount
 Initial:—
 Enriched With:
order_subtotal:42.00
coupon_discount_percent:0.05
 Result:
2.10
Set difference
Set the difference of two numbers as a new number.
Attribute Name: order_subtotal
 Initial:
42.00
 Enriched With:
order_subtotal:42.00
coupon_discount_amount:2.10
 Result:
39.90
Set sum
Set to the sum of two numbers.
For example, set order_total
to the sum of order_subtotal
and order_tax_amount
.
Attribute Name: order_total
 Initial: —
 Enriched With:
order_subtotal:39.90
order_tax_amount:3.29
 Result:
43.19
Set number
Set the number to a specific number.
For example, set Last Purchase Amount to the value of order_total
whenever the purchase
event occurs.
Attribute Name: Last Purchase Amount
 Initial: —
 Enriched With: order_total:
43.19
 Result:
43.19
Set difference between two dates
Calculates the elapsed time between two events. Elapsed time can be expressed as one of the following:
 Minutes
 Hours
 Days
 Weeks
 Months
The difference is always stored as a positive value, so the dates can be set in any order.
For example, to calculate Days Since Last Purchase as the difference in days between Last Purchase Date and Current Visit Date.
While date attributes are stored as Unix timestamps, these examples use formatted dates for readability.
Attribute Name: Days Since Last Purchase
 Initial: —
 Enriched With:
Last Purchase Date:"2018/10/30"
Current Visit Date:"2019/11/01"
 Result:
367
Set rolling average based on timeline
The rolling average is the arithmetic mean of numerical values captured over time. These values come from number and tally](/serverside/attributes/datatypes/tally/) attributes that are collected as entries in a timeline. The timeline’s expiration determines which entries can be factored into the final average. If there is not an expiration date, it is a simple average solution.
Attribute Name: Average Order Value
 Initial: —
 Enriched With:
[20.00, 30.00, 40.00, 50.00]
 Result:
35.00
Set rolling sum based on timeline
A rolling sum is the aggregate of numerical values in a number or tally attribute that are captured as entries in a timeline. The timeline’s expiration determines which entries can be factored in during the aggregation.
Attribute Name: Total Order Value
 Initial: —
 Enriched With:
[10.00, 20.00, 30.00, 40.00, 50.00]
 Result:
150.00
Set number to the number of entries in timeline
Set the number to the number of entries in a timeline.
Attribute Name: Total Order Count
 Initial: —
 Enriched With:
[10.00, 20.00, 30.00, 40.00, 50.00]
 Result:
5.00
Set number to tally value
Set the number to a specific value within the tally. Specify the tally attribute and the name of the entry in the tally. For example, a tally for Site Category Views might have an entry for “Shoes”.
Attribute Name: Shoe Category View Count
 Initial: —
 Enriched With: Site Category Views:
{"Shoes": 42}
 Result:
42
Set number to the count of items in tally
Set the attribute to the number of entries in a tally. For example, a tally for Site Category Views might have three entries in it.
Attribute Name: Number of Categories Viewed
 Initial: —
 Enriched With:
{
"Shoes": 42,
"Shirts": 11,
"Pants": 8
}
 Result:
3.00
Set number to the count of items in set of strings
Set the number to the count of items in a set of strings. For example, a set of strings Active Browser Types might have 3 entries.
Attribute Name: Number of Active Browser Types
 Initial: —
 Enriched With:
["Firefox", "Safari", "Chrome"]
 Result:
3.00
Set number to tally’s rolling max based on a timeline
Set the number to the rolling maximum of another number in a tally captured within a timeline.
Attribute Name: Highest Order Value
 Initial: —
 Enriched With:
[10.00, 20.00, 30.00, 40.00, 50.00]
 Result:
50.00
Set number to change in number
Set this attribute to the difference between it and another attribute since the last event. For example, use this enrichment to capture the difference between a previous order amount and the current order amount. To set an attribute named Change in Order Value, set it to the change in order_subtotal
since the previous order.
Attribute Name: Change in Order Value
 Initial:
30.00
 Enriched With: order_subtotal:
42.00
 Result:
12.00
Set number to change in date
Set this attribute to the change in value of the selected value between this event and the last event. For example, use this enrichment to capture the change in months of the Last Purchase Date date attribute each time a purchase occurs.
The change in date can be expressed as one of the following:
 Minutes
 Hours
 Days
 Weeks
 Months
Attribute Name: Months Since Last Purchase
 Initial:
 Enriched With:
Last Purchase Date (last event):"10/31/2019"
Last Purchase Date (this event):"12/31/2019"
 Result: 2 (months)
Set to the number of items in an array
Set to the number of items in an array. For example, to store the number of products in the cart, use this enrichment to capture the number of items in the cart_product_id
array.
Attribute Name: num_cart_items
 Initial: —
 Enriched With: product_id:
["prod123", "prod456"]
 Result:
2.00
This page was last updated: February 21, 2023