Use Dyspatch's Conditional Display feature to dynamically add content to your emails and control what users see.
Using Conditional Display
You can use Conditional Display on any block in Dyspatch. Select the block in the email preview and click the "Display Options" tab to bring up the conditional builder:
From here you can write a conditional statement for when the block should show. For example, say you only wanted to show a specific block to your gold-tier users. You would need to create a condition that looks something like this:
In this example the block will only show when the user_type variable is equal
to the word "gold". You can use similar strategies to set up multiple blocks
that get shown for different user types. For example, you could set up a block
to appear for "silver" tier users.
To help you keep track of which block is using a conditional display Dyspatch will add a "Conditional" tag when you mouse over the block:
Conditional Content in Subject and Preheader Fields
DML conditionals can be used directly in the Subject and Preheader fields of a template. This lets you tailor the subject line or preview text based on data variables — without needing to create separate templates.
Conditional logic in these fields uses the same DML conditional syntax available in DML blocks.
For example, to show a different subject line based on a user's membership tier:
<dys-if-else><dys-if cond="user_type == 'gold'">Your exclusive Gold member offer inside</dys-if><dys-else>Check out what's new this week</dys-else></dys-if-else>The same patterns work in the Preheader field. This example includes an else fallback if the first_name data isn't present:
<dys-if-else><dys-if cond="first_name != nil">Hi @{first_name}, here's something just for you</dys-if><dys-else>Here's something just for you</dys-else></dys-if-else>For a full reference of supported operators and keywords (such as nil, &&, ||, and in), see the DML conditionals documentation.
Tips and Tricks
Conditional blocks are an incredibly useful tool when building out your emails. Here are some tips and ideas to make the most of the feature:
-
Combine with Customer Profiles or Preview Data to quickly test with different data variations
-
Empower your team to use conditional blocks instead of creating one-off code blocks in DML
-
Display targeted content to specific users to increase conversions
-
Use it when A/B testing! One group of users sees Block A, the other Block B