Skip to content
Optima docs
Concepts

Attributes and computed attributes

Attribute types, and computed attributes that are defined once and worked out from current data when needed.

An attribute is a named, typed fact about a profile or an event: first_name, city, lifetime_value, order_total. Attributes are what segments filter on and what templates insert into messages.

Attribute types

Every attribute has one of these types. The entity type or event type declares it, and incoming values are converted to the declared type when stored.

TypeHoldsExample
stringTextPrague
decimalA number with decimals129.90
integerA whole number3
booleanTrue or falsetrue
datetimeA date and time2026-10-15T09:30:00Z
jsonStructured data{"size": "M"}
array_stringA list of text values["red", "blue"]

Typing keeps comparisons honest: 10 is greater than 9 as a number, but not as text. See the attribute types reference for details.

Each attribute can also carry a PII level, where 0 means not sensitive, and a list of purposes that allow it to be processed. These drive what each person sees. See consent and purposes.

Computed attributes

A computed attribute is a virtual attribute. It is not sent to Optima and not stored; you define it once and Optima works out its value from the profile's current data whenever it is asked. Use it to turn raw fields and event history into reusable properties, such as a lifecycle_stage or total_spend_90d, without duplicating data. Because the value is derived on demand, it is always as current as the data underneath.

Manage computed attributes under Settings → Workspace → Schema, on the Computed attributes tab. Each has:

FieldMeaning
Entity typeThe kind of profile it is computed for.
NameUnique within the entity type. This is the attribute's key.
DescriptionFree text.
KindSegmentation or Function.
Value typeThe type of the result. Defaults to text for segmentation and a decimal number for function.
DefinitionThe rules that produce the value. A builder is provided, with a JSON view for advanced use.
EnabledWhether the attribute is active. On by default.

Segmentation kind

A segmentation attribute is an ordered list of named segments, each guarded by conditions. Segments are checked in order; the first whose conditions match names the value. If none match, the Otherwise value is used. A condition compares an attribute, an aggregate over events or related profiles, or a signal. Groups can require all conditions (All of (AND)) or any (Any of (OR)).

For example, a lifecycle_stage attribute:

  1. champion: total spend over the last 90 days is at least 1000.
  2. active: at least one purchase in the last 90 days.
  3. Otherwise: lapsed.

Function kind

A function attribute combines numbers into one numeric result: literals, attributes, aggregates over events or related profiles, and signals, joined by arithmetic. Aggregate functions are count, sum, average, minimum, maximum and unique count, over a window you choose.

For example, total_spend_90d is the sum of the order_total attribute of the profile's purchase events in the last 90 days.

The grammar is deliberately bounded to a fixed set of operators and functions, so a definition can be checked when you save it and always evaluated safely.

Checks when you save

Saving runs two checks. First, the definition must be well formed for its kind, and the value type valid. Second, everything it refers to, the entity type, event types and attribute names, must exist in your schema. A duplicate name within an entity type is refused.

Computed attributes appear on profiles with a computed badge, can be added as columns on the Profiles screen, and can be used in segment filters like any attribute.

On this page