Search documentation...

K
ChangelogBook a demoSign up

Traits

Traits are part of the Advanced Customer Studio, available as an add-on to Business tier plans.

Overview

When defining audiences, you sometimes need computed or calculated attributes rather than raw data. For example, you may want to create an audience based on Lifetime Value (LTV) though you don't have this column in your Users table. Creating it entails summing the price of all purchases made by a particular user.

Hightouch Traits enable users of any technical background to:

You can use these computed fields—called traits—to supercharge personalization across marketing channels without having to rely on data teams.

Trait types

Trait TypeExample Usage
SumSum of price of all purchases a user has made in their lifetime
CountCount of songs listened to in the past two weeks
AverageAverage session time of a user
Most FrequentMost Frequent category of articles read
FirstFirst page a user visited
LastLast product a user viewed
Custom SQLAll SKUs a user added to their cart before abandoning it
FormulaUse the result of a string column to create a boolean flag

Traits are defined on parent model, but you can also create traits based on events to capture information about customer actions in a customer funnel.

Create a trait

  1. Go to the Traits page and click Create -> New Trait.

Creating traits in the Hightouch UI

  1. Select a parent model.
  2. Select the calculation method.

Configure trait method in the Hightouch UI

  1. Select the related model from which you're aggregating column values.
  2. [Optional] Apply any conditions to the calculation method.
  3. Select the related model from which you're aggregating column values.
  4. Select the trait type, for example, SUM.
  5. Add required configurations for the trait type. For SUM, for instance, you need to select which column to sum.

Configure trait calculation in the Hightouch UI

  1. Give the trait a descriptive Name, for example, "Lifetime Value."
  2. Click Save.

Finalize trait in the Hightouch UI

The trait is now part of the parent model, and you can use it when creating audiences. It will automatically be available to sync for any audience that belongs to this parent model.

Create a trait template

Alternatively, you can also create a Trait Template. Unlike Traits, Trait Templates can't have any conditions applied to it. However, you can then build traits off the template and apply any conditions you desire. Trait Templates allow you to easily reuse your trait configuration without having to start from scratch each time.

  1. Go to the Traits page and click Create -> New template.
  2. Go through the trait creation steps just like you would for a regular trait.

Once you have created a template, it will be available to all audiences under the same parent model. You can use the template as a filter for creating audiences or use it to create trait enrichments for syncing data.

Updating a trait template will also update its underlying traits. For instance, if you were to change the trait calculation type of the template from SUM to COUNT, all of its underlying traits will also use the COUNT aggregation.

Create a trait from a template

After you create a template, you can use it as a base to create traits.

  1. Go to the Traits page and click Create -> Start with a template.
  2. Select a template and click Choose template.

Select trait template in the Hightouch UI

  1. [Optional] Add any conditions to the trait.
  2. Give the trait a descriptive Name, for example, "Lifetime Value."
  3. Click Save.

Finalize templated trait in the Hightouch UI

Create audiences with traits

Once you've created a trait, you can use it for filtering within your audiences. Traits filters are under Custom traits in the filters dropdown.

Trait filter option

There are three kinds of traits you can use in your audience filter:

  • Trait templates
  • Traits
  • Custom traits

Using trait templates in the audience

  1. Click Add filter
  2. Navigate to Custom traits and select a trait template. For example, if you created an LTV trait, you can use it to filter for "All users that have spent more than $100."

Using a trait to filter audiences

  1. [Optional] You can also add filters to apply before Hightouch calculates trait values. For example, you can restrict the LTV calculation to purchases where the Brand was Nike directly in the audience builder.

Filtering traits in the Hightouch UI

  1. [Optional] You can save the trait filter as a new trait enrichment. To do so, click the actions button and "Save trait enrichment"

Using traits in the audience

  1. Click Add filter
  2. Navigate to Custom traits and select a trait

Trait to filter audiences

  1. [Optional] You can edit the trait configuration by clicking Edit. Updating these filters will not affect the original trait.
  2. [Optional] If you edit the trait and want to save it as a new trait, click the actions button and "Save trait."

Save edited trait

Creating a custom trait within the audience

Maybe you don't have a suitable trait or trait template to act as a filter. Or, maybe you just want to experiment with a trait filter without necessarily creating one for the parent model. You can create a custom trait inline within the audience query builder.

  1. Click Add filter
  2. Navigate to Custom traits and click Create a custom trait
  3. Select a related model
  4. Select the configuration for your trait

Custom trait calculation to filter audiences

  1. [Optional] If you decide that this custom trait is useful enough to persist it for the entire parent model, click the actions button and "Save trait." Doing so converts it into a new trait that can be synced.

Save custom trait calculation

Enrich audiences with traits

Traits defined on the parent model are automcatically available for syncing to destinations. Alternatively, you can create trait enrichments which are traits that are specific to an audience.

Trait enrichments are based on a parent trait which are the trait templates you've defined on the parent model.

Adding a trait enrichment

  1. Go to the Traits tab of the audience you want to add enrichments to.
  2. Click Create trait.
  3. Enter a Name and select the Parent trait.
  4. [Optional] Add conditions to apply on top of the parent trait.

Defining a trait enrichment

Once created, these enrichment traits appear in the Audience preview and sync configuration like any other field.

Event traits

In addition to defining traits on parent models, you can also apply traits to events in the visual audience builder. Event traits automatically become trait enrichments, meaning you can view them in the preview and sync their values. One common use case for event traits is to capture information about abandoned carts.

  1. To create a new event trait, click Add trait on an event condition in the audience builder.

You can only access the Add trait option from an event filter once you've saved the audience.

Adding an event trait in the Hightouch UI

  1. Give the event trait a descriptive Name.
  2. Select the aggregation you want to use, for example, Last.
  3. Select the information you want to capture about the event. For example, you may want to capture the Product_ID, SKU, or Brand of the final product a user added to their cart before abandoning it.

Defining an event trait in the Hightouch UI

Custom SQL traits

Custom SQL traits provide a powerful escape hatch for custom aggregations that the default aggregations don't cover. To build a SQL trait, create a trait and follow these additional instructions:

  1. Select SQL as the Aggregation type.
  2. Enter a raw SQL aggregation. For example, to create a SUM trait with just SQL, you would enter SUM({{ column "price" }}).
Column references must use the following syntax {{column "<COLUMN_NAME>"}}. Column names are case-sensitive.
  1. Enter a default value for when the SQL returns no rows.
  2. Define the Property type of the SQL aggregation result.

See the section on how traits work for more information on how Hightouch calculates and joins custom SQL traits to a parent model.

JSON aggregations

JSON aggregations are a helpful way to aggregate the raw data in a related model. For example, imagine you want to get a list of all product IDs users have purchased. You can do this with the following SQL trait:

ARRAY_AGG(DISTINCT {{column "product_id"}})

CASE statements

CASE statements are a useful way to create friendly options for aggregations. For example, imagine you want to bucket customers into low, medium, and high LTV. You can do this with the following SQL trait:

CASE
  WHEN SUM( {{column "price"}} ) > 100 THEN 'high'
  WHEN SUM( {{column "price"}} ) > 50 THEN 'medium'
  ELSE 'low'
END

Formula traits

Formula traits allow you to reference parent model columns, merged columns, and other traits to build inline transformations. Unlike Custom SQL Traits, there is no aggregation against a single related model. Instead, you can reference columns from a multitude of sources. This unlocks a powerful and flexible way to compose columns all within Hightouch.

Formula trait editor

  1. Select Formula as the Aggregation type.
  2. Enter raw SQL. Here are a few examples:
  • Combine multiple columns into one: CONCAT({{"first_name"}}, ' ', {{"last_name"}}).
  • Use a string column to create a boolean flag: CASE WHEN {{"merged.pets.animal"}} LIKE 'dog' THEN true ELSE false END
  • Reference other traits: CASE WHEN {{"trait.lifetime_total_value"}} > 1000 THEN 'high' ELSE 'low' END.
Column references must use the following syntax: {{"<COLUMN_NAME>"}}. Column names are case-sensitive. We recommend using the SQL editor's autocompletion feature to write the column references.
  1. Define the Property type of the SQL aggregation result.

Ready to get started?

Jump right in or a book a demo. Your first destination is always free.

Book a demoSign upBook a demo

Need help?

Our team is relentlessly focused on your success. Don't hesitate to reach out!

Feature requests?

We'd love to hear your suggestions for integrations and other features.

Last updated: Aug 22, 2024

On this page

OverviewTrait typesCreate a traitCreate a trait templateCreate a trait from a templateCreate audiences with traitsUsing trait templates in the audienceUsing traits in the audienceCreating a custom trait within the audienceEnrich audiences with traitsEvent traitsCustom SQL traitsJSON aggregationsCASE statementsFormula traits

Was this page helpful?