User types

Discover the user-related types available in CQL.

User types refer to data types representing personal information, such as user profiles, usage statistics, and other user traits.

This summary provides an overview of the user-related types:

TypeDescription
UserGeneral information about the user.
GenderThe enumeration of genders.
User statisticsAggregate statistics about the user.

User

The user type represents an individual, such as a customer, user, or anonymous visitor. It stores the profile, statistics, and other personal information.

The user profile has predefined properties that are common to all users. In addition, it can be extended with custom properties to store any additional information about the user, called custom attributes. These attributes are not listed below as they are not part of the type definition, but they can be accessed similarly to any other property.

For example, if you have a custom property called plan that stores the user's subscription plan, you can access it like this:

When accessing a property, if there is a custom attribute and a predefined attribute with the same name, the custom attribute takes precedence. However, it does not overwrite the predefined attribute — it simply hides it. Removing the custom attribute would make the predefined attribute visible again.

Properties

These are the predefined properties of the user profile:

id(optional)

The user's unique identifier provided by the application, such as a UUID or a username.

name(optional)

The name of the user as a combination of their first and last name, separated by a space. For instance, "John Doe".

This property is virtual, meaning it is not stored in the user profile. Instead, it is derived from the first and last name.

firstName(optional)

The first name of the user. For example, "John".

lastName(optional)

The last name of the user. For example, "Doe".

age(optional)

The age of the user. For example, 30.

This property is virtual, meaning it is not stored in the user profile. Instead, it is derived from the birth date.

birthDate(optional)

The birth date of the user. For example, 1990-01-01.

gender(optional)

The gender of the user.

email(optional)

The email address of the user. For example, "john@example.com".

alternateEmail(optional)

The alternate email address of the user, such as a work email address or a secondary email address.

phone(optional)

The phone number of the user. For example, "+1 555 555 5555".

alternatePhone(optional)

The alternate phone number of the user, such as a work phone number or a secondary phone number.

address

The address of the user.

avatar(optional)

The URL of the user's avatar image.

company(optional)

The company the user works for.

companyUrl(optional)

The URL of the company the user works for.

jobTitle(optional)

The job title of the user.

interests

The set of interests the user demonstrates, with no duplicates. For example, "ab testing", "analytics", "data science", etc.

activities

The set of activities the user performs, with no duplicates. For example, "ab testing", "analytics", "data science", etc.

stats

The aggregate statistics about the user.

<attribute>(optional)

A custom attribute, where /*<attribute>*/ is the name of the attribute.

Gender

This type is an enumeration that indicates the gender of a user.

These are the possible values and what they represent:

ValueDescription
maleMale gender.
femaleFemale gender.
neutralNeither male nor female gender.
unknownAn unspecified gender.

User statistics

The user-statistics type represents the aggregate statistics and numbers related to a user's behavior and activity across sessions.

Properties

These are the available properties:

sessions

The total number of sessions across all applications. It is incremented every time the user visits the application.

orders

The total number of orders placed across all sessions. It is incremented every time the user places an order.