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:
Add required configurations for the trait type. For SUM, for instance, you need to select which column to sum.
Give the trait a descriptive Name, for example, "Lifetime Value."
Click Save.
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.
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.
Go to the Traits page and click Create -> New template.
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.
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."
[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.
[Optional] You can save the trait filter as a new trait enrichment. To do so, click the actions button and "Save trait enrichment"
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.
Click Add filter
Navigate to Custom traits and click Create a custom trait
Select a related model
Select the configuration for your trait
[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.
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.
Go to the Traits tab of the audience you want to add enrichments to.
Click Create trait.
Enter a Name and select the Parent trait.
[Optional] Add conditions to apply on top of the parent trait.
Once created, these enrichment traits appear in the Audience preview and sync configuration like any other field.
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.
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.
Give the event trait a descriptive Name.
Select the aggregation you want to use, for example, Last.
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.
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:
Select SQL as the Aggregation type.
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.
Enter a default value for when the SQL returns no rows.
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 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:
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:
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.
Select Formula as the Aggregation type.
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.
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.