Building blocks
Attributes
Attributes are the building blocks of creating conditions, which can later be used in reusable segments.
Create an attribute#
Let's create an attribute called country:
description: Countrytype: stringtype and description are the minimum required properties for an attribute.
Types#
These types are supported for attribute values:
booleanstringintegerdoubledatearray(of strings)object(flat object)
boolean#
When an attribute is of type boolean, it can have two possible values: true or false.
For example, if you want to create an attribute for isPremiumUser, you can do it like this:
description: Is Premium Usertype: booleanstring#
When an attribute is of type string, it can have any string value.
For example, if you want to create an attribute for country, you can do it like this:
description: Countrytype: stringinteger#
When an attribute is of type integer, it can have any integer value.
For example, if you want to create an attribute for age, you can do it like this:
description: Agetype: integerdouble#
When an attribute is of type double, it can have any floating point number value.
For example, if you want to create an attribute for rating, you can do it like this:
description: Ratingtype: doubledate#
When an attribute is of type date, it can have any date value in ISO 8601 format.
For example, if you want to create an attribute for signupDate, you can do it like this:
description: Signup Datetype: datearray#
When an attribute is of type array, it can have an array of string values.
For example, if you want to create an attribute for permissions, you can do it like this:
description: Permissionstype: arrayobject#
When an attribute is of type object, it can have nested properties.
For example, if you want to create an attribute for user with some nested properties, you can do it like this:
description: Usertype: objectproperties: id: type: string description: User ID country: type: string description: User countryWhen writing conditions for segments, you can use the dot notation to access nested properties. For example, user.id or user.country.
Archiving#
You can archive an attribute by setting archived: true:
archived: truetype: stringdescription: CountryRelationship with context#
SDKs evaluate values against the context available at runtime. The context is an object where the keys are attribute names and the values are the attribute values.
For example, if you have an attribute called country, the context will look like this:
{ "country": "nl" // The Netherlands}If we combine all the above examples, the full context may look like this:
{ "country": "nl", "isPremiumUser": true, "age": 30, "rating": 4.5, "signupDate": "2025-01-01T00:00:00Z", "permissions": ["read", "write"], "user": { "id": "12345", "country": "nl" }}
