Let's say you're an e-commerce store selling plants.
You want to use Hightouch Customer Studio to personalize your marketing campaigns based on your customers' geographic region and purchase history.
Before you start creating these audiences, you need to define two essential datasets:
The set of people who make up your audiences—in other words, your customers
The characteristics you want to filter these people on. For example, products they've purchased, actions they've taken on your website or app, etc.
In Hightouch, you define the first as a parent model and the second as related models and events.
Related models and events are similar; they're characteristics to filter parent models off of.
Once you've created your models, you define the relationships between them.
These models and the relationships between them are known as your data schema.
Schema setup is a one-time configuration process. Once you've set up your schema, you can build thousands of audiences with a small set of initial models and events.
By following along with the setup on this page, you'll learn how to create a schema like this:
Continue reading to learn more about model types, relationships, and setup instructions.
Ensure the correct data source is selected from the dropdown next to Schema.
Click Create parent model.
By default, Hightouch prompts you to select a table in your source. If you prefer to use a custom SQL query, dbt model, or another modeling method to define your model, you can change it from the modeling method dropdown.
Once you've defined your model and previewed the results, click Continue.
Enter a name for your parent model, for example, "Users."
Related models and events provide additional characteristics or actions on which you want to filter your parent model.
Related model and event setup are similar; neither requires a primary key. Events require a timestamp column.
In the plant e-commerce example, a related model could be a Plants table with columns for:
user_id: a reference to the user that owns the plant
product_name: the plant name
price: the price of the plant they purchased
used_coupon: whether the user used a coupon when checking out
An events model might include Product viewed events with columns for:
user_id: a reference to the user that viewed the product
page_path: the URL path for the product detail page
When you create related or event models, you simultaneously set up their relationships.
In the plant e-commerce example, let's say you want to create an audience of customers who own a specific plant type or who've visited a particular product page.
You need to define a relationship between your parent model (users) and your related model (plants) and events (product viewed).
Under the hood, Hightouch generates SQL JOINs between your models.
To make this possible, you must create relationships by selecting the foreign keys between your models.
You create relationships during the related model and event setup, though you can also add them later.
If you want to relate two models, they must have the same underlying source in Hightouch.
Related model setup is a one-time step you can complete by following these steps:
Related models must be created in relation to an existing model. Click the + button on any existing model and select Create a related model.
By default, Hightouch prompts you to select a table in your source. If you prefer to use a custom SQL query, dbt model, or another modeling method to define your model, you can change it from the modeling method dropdown.
Once you've defined your model and previewed the results, click Continue.
Enter a name for your related model, for example, "Plants."
Optionally, enter a description.
Define the related model's Relationship. By default, Hightouch names the relationship the same as the related model, but you can edit it by clicking the pencil icon.
Select the relationship's cardinality: 1:1, 1:many, or many:1.
Explicit cardinality is a feature of the new schema builder, released in May 2023.
If you created a related model before this release, Hightouch assumed the relationship's cardinality.
If you assumption is incorrect, modify it via the dropdown.
Cardinality affects your ability to merge columns.
To relate rows from the related model to rows in the parent model, select the relevant foreign key columns from the parent and related models.
If there are multiple columns that the parent and related model must match on, enable Multiple join keys and make additional selections.
If you enable multiple join keys, each pair of columns must match to create a relationship between rows.
If you want to add columns from the parent model onto the related model, turn on Merge columns.
Click Create related model.
The related model now appears in the schema builder.
You can edit an existing related model by clicking on it and making changes in the Query tab.
Event definition is a one-time step similar to related model setup.
The only difference is that event models require a timestamp column.
You can complete event setup by following these steps:
Event models must be created in relation to an existing model. Click the + button on any existing model and select Create a related event.
By default, Hightouch prompts you to select a table in your source. If you prefer to use a custom SQL query, dbt model, or another modeling method to define your model, you can change it from the modeling method dropdown.
If all of your events are in one table, it can be helpful to create one event model per event.
You can use the SQL editor to select events with a specific name or type, for example, "Page viewed," "Order completed," etc.
Once you've defined your model and previewed the results, click Continue.
Enter a name for your event model, for example, "Product viewed."
Optionally, enter a description.
Define the related event's Relationship. By default, Hightouch names the relationship the same as the event model, but you can edit it by clicking the pencil icon.
Select the relationship's cardinality: 1:1, 1:many, or many:1. In most cases, parent models have a 1:many relationship with events.
Explicit cardinality is a feature of the new schema builder, released in May 2023.
If you created a related model before this release, Hightouch assumed the relationship's cardinality.
If the assumption is incorrect, modify it via the dropdown.
Cardinality affects your ability to merge columns.
To relate rows from the events model to rows in the parent model, select the relevant foreign key columns from the parent and event models.
If there are multiple columns that the parent and related model must match on, enable Multiple join keys and make additional selections.
If you enable multiple join keys, each pair of columns must match to create a relationship between rows.
If you want to add columns from the parent model onto the event model, turn on Merge columns.
Click Create event.
The event model now appears in the schema builder.
You can edit an existing event model by clicking on it and making changes in the Query tab.
Merging columns adds columns from one model onto another so that the model with additional columns is more easily filterable in the visual audiences builder.
In a 1:1 relationship, you can merge columns in either direction. The Merge columns toggle only appears on the model that will receive the additional columns.
In a 1:many relationship, you can only merge columns from the parent model (the model on the 1 side of the relationship) to the related model (the model on the many side of the relationship).
For example, if you have a 1:many relationship from Users to Plants, you can only merge Users columns onto Plants columns. This means that the Merge columns toggle only appears when the relationship is viewed on the related model, where it's displayed as many:1.
In most cases, selecting one pair of keys is enough to form a relationship between two models.
You may want to select multiple foreign keys to increase accuracy.
Multiple join keys increase accuracy because all pairs of keys must match for the Hightouch to JOIN the relevant rows.
For example, imagine you're relating a Plants model to Product viewed event model with these foreign keys:
PLANT_ID ⇔ PRODUCT_ID
PDP_URL ⇔ URL
Product viewed events will only be related to a particular plant if both the PRODUCT_ID and and URL from the event data matches a particular plant's PLANT_ID and PDP_URL.
Having both keys ensures that only Product viewed events from a particular page and with a particular PRODUCT_ID are related to a particular plant.
Once you've set up a parent, related, or events model, you can update its configuration by clicking on it and going to its Query tab.
You can also apply additional configurations in its Columns tab.
For example, you can:
Disable a column from being part of the model.
Provide an alias for it to appear as in the visual audience builder. To do so, click the pencil icon that appears next to the column name when you hover over it.
Redact values so they don't appear in the audience preview or explorer.
Turn on suggested values for the visual audience builder. For example, if you're creating an audience you want to filter on "Brand," turning on suggestions populates a dropdown with values—Nike, Adidas, etc.—found in the dataset.
Filter condition dropdowns auto-recommend up to 1,000,000 values for a given column. If a value doesn't show up automatically, you can type it in the search bar and click Add [value]. Make sure that the value you type matches the value in your model exactly.
As your Customer Studio implementation becomes more advanced, your schema may start to look increasingly complex, with multiple parent models all shown in the schema overview.
Hightouch offers a few features to help you better understand and manage models in a complex schema.
The schema overview pages only show models related to the source displayed in the top left dropdown.
If you don't see models you expect, ensure the correct data source is selected.
The search function provides a way to find models and jump between them quickly.
Click the magnifier icon and then enter the name of the model you're searching for.
The search function only shows models related to the source displayed in the top left dropdown.
If you don't see models you expect, ensure the correct data source is selected.
If you know which parent model and its related models you want to work with, click it to open its detail page.
From the model detail page, click View model schema. Hightouch focuses on and rearranges related models based on their connection to the parent model.
This view is beneficial if you have multiple parent models that connect and you want to make sense of your schema from the perspective of each parent model.
You can delete any model from its detail page by clicking the horizontal three-dot menu and clicking Delete.
Deleting a parent model also deletes its relationship to related and event models.
Deletions cannot be undone.
Ensure you want to delete a parent model before doing so.
On May 11, 2023, Hightouch released a new schema builder UI.
Though the UI is improved, the underlying concepts remain the same.
The legacy schema builder will be deprecated in June 2023.
Please use the new schema builder and if you have any feedback or questions.
If you're in the legacy schema builder, you can access the new schema experience by clicking New schema experience on the top right of the Schema page.
If you're in the new schema builder and want to access the legacy one, click Legacy schema.
Choose a primary key and labels for your parent model. The audience builder displays labels previewing results, so you should select labels that help you understand your audience, for example, name or email.
Click Finish to save your model.
In parent models, each row should be unique and there shouldn't be any duplicates. Make sure to set up your model accordingly.
In the legacy schema builder, you need to setup models before you can define relationships between them. You have two options for creating relationships:
Direct relationships—this covers the majority of relationships, including one-to-one and one-to-many relationships
In most cases, you only need to set up direct relationships, which relate models directly to each other.
For the plant e-commerce example, you need a relationship between users and purchases.
To create a direct relationship, follow these steps:
From the Parent models tab, select the parent model you want to define relationships for.
Open the Relationships tab.
Click Add direct relationship.
Enter a Relationship name, for example, "Customer purchases."
Select the appropriate Related Model; you must have configured it first, and it must have the same source as the parent model.
Under Mappings, create the primary-foreign key relationship by selecting the primary key from the parent model and the corresponding foreign key from the related mode.
In general, you should create direct relationships and only use through relationships if you have to.
This arises when different models aren't directly related.
For example, models are often related through an intermediary table when many-to-many relationships occur.
For this reason, many-to-many relationships are also known as through relationships.
For the plant e-commerce example, imagine you have different subscription groups:
quarterly pet-friendly subscription
succulent of the month subscription
annual easy care subscription, etc.
Customers can have several subscriptions.
And each subscription has multiple users subscribed to it.
Model-wise this equates to:
A Users table with a column for:
user_id: a unique identifier for the user
other personal information such as name, email, etc.
A Subscriptions table with a column for:
product_id: a unique identifier for the subscription
name: the subscription's name
delivery: describing the delivery schedule, either monthly, quarterly, or annually
price: the subscription cost
A Memberships table with columns for:
user_id: a reference to the user
product_id: a reference to the subscription
A user is part of a subscription group if the Memberships table has entry matching user_id and product_id.
In this example, you could say, "Users are related to subscriptions through the memberships table."
To build audiences based on subscription properties, for example, all customers that receive a monthly delivery, you would need to create the following relationships:
A direct relationship from users to memberships on user_id
A direct relationship from memberships to subscriptions on product_id
A through relationship from users to subscriptions via the preceding two direct relationships
To create a through relationship in Hightouch, make sure you've setup the necessary direct relationships then follow these steps:
From the Parent models tab, select the parent model you want to define relationships for.
Open the Relationships tab.
Click Add through relationship, below any existing direct relationships.
Enter a Relationship name, for example, "User subscription membership."
Select the appropriate related models.
Click Add relationship.
Ready to get started?
Jump right in or a book a demo. Your first destination is always free.