SegmentTraitsOverview

Traits

Traits are computed attributes about customer entities. They transform raw warehouse data into meaningful metrics — like a customer’s lifetime value, their most-purchased product category, or the number of days since their last login — that can then be used to build audiences.

What Is a Trait?

A trait is a single computed value attached to an entity type. Every trait produces one value per entity instance. For example, a trait called total_order_value on the User entity type would compute one number for each user in your warehouse.

Traits are warehouse-native: SignalSmith generates SQL and executes it directly against your data warehouse. No data is copied out of your warehouse to compute traits. The results are materialized back into a trait table in your warehouse schema for fast audience evaluation.

Trait Types

SignalSmith offers three ways to define traits, ranging from full SQL flexibility to visual no-code builders:

SQL Traits

SQL Traits let you write custom SQL to compute any metric. This is the most flexible option — anything you can express in a SQL query, you can turn into a trait.

Use when: You need multi-table joins, window functions, CTEs, warehouse-specific functions, or any computation that doesn’t fit the visual builders.

-- Example: Customer lifetime value
SELECT
  user_id,
  SUM(order_total) - SUM(refund_amount) AS lifetime_value
FROM orders
LEFT JOIN refunds ON orders.order_id = refunds.order_id
GROUP BY user_id

Aggregation Traits

Aggregation Traits use a visual builder to define common aggregations without writing SQL. You pick a source table, an aggregation function, a column to aggregate, and optional filters.

Use when: You need a straightforward count, sum, average, min, max, or count distinct over a single table.

Supported functions:

FunctionDescriptionExample
CountNumber of rowsTotal number of orders
SumSum of a numeric columnTotal revenue
AverageMean of a numeric columnAverage order value
MinMinimum valueFirst purchase date
MaxMaximum valueMost recent login
Count DistinctUnique values in a columnNumber of distinct products purchased

Formula Traits

Formula Traits combine existing traits using arithmetic and logical expressions. They don’t query the warehouse directly — instead, they operate on the materialized results of other traits.

Use when: You want to derive new metrics from traits you’ve already built, like ratios, scores, or boolean flags.

average_order_value = total_revenue / order_count
is_high_value = lifetime_value > 1000

Trait Properties

Every trait has these core properties:

PropertyDescription
NameHuman-readable label displayed in the UI and available for audience building
SlugURL-safe identifier used in the API and as the materialized column name
Entity TypeThe entity type this trait is computed for (e.g., User, Account)
Data TypeThe output type: string, number, boolean, date, or timestamp
TypeSQL, Aggregation, or Formula
ScheduleHow often the trait is re-evaluated (manual, hourly, daily, weekly, or custom cron)

How Traits Are Used

Once computed, traits are available throughout Segment:

  • Audience conditions — Filter customers by trait values (e.g., lifetime_value > 500)
  • Formula inputs — Reference traits in formula expressions to derive new metrics
  • Audience sync fields — Include trait values as fields sent to destinations
  • Insights — Track trait distributions and trends over time

Trait Evaluation

Traits are evaluated by the trait evaluation pipeline, which generates SQL, executes it against your warehouse, and materializes results into a dedicated trait table. The pipeline handles scheduling, dependency ordering (formula traits that depend on other traits), and error tracking.

Next Steps