Sub topic 9
Building dynamic content blocks
This chapter assumes you can insert merge tags with fallbacks, write a basic if/else condition, and build segments from contact fields. Examples use Liquid-style syntax. Other platforms use different names for the same ideas.
What a dynamic block is
A dynamic content block is a section of an email that shows different content to different recipients. A merge tag changes a word or two inside a sentence. A dynamic block swaps a whole section, such as a hero banner, an offer, or a footer note.
You can build a block in two ways:
- Inline logic. You write conditions in the template, as in the previous chapter. The rule lives in the email.
- Segment-driven variants. You create several versions of a block in the editor and attach a segment to each one. The platform shows the first version whose segment the contact belongs to.
Inline logic suits simple rules on one field. Segment-driven variants suit rules you reuse across campaigns or that combine several conditions.
Building a block step by step
- Pick the one thing that changes. Choose a single section, for example the call to action.
- Write the default first. The default is what a contact sees when no rule matches or data is missing. It must make sense for everyone.
- Add variants. Write one variant per audience, such as Pro customers and Free customers.
- Attach a rule to each variant. Use a segment or a condition on a contact field.
- Order the rules. Platforms check variants from top to bottom and stop at the first match.
Here is the same idea as inline logic, which works in any Liquid-style editor:
{% if customer.plan == "pro" %}
<h2>Your Pro plan includes priority support</h2>
<a href="https://example.com/support">Contact support</a>
{% elsif customer.plan == "free" %}
<h2>Upgrade to Pro</h2>
<a href="https://example.com/upgrade">See Pro features</a>
{% else %}
<h2>Explore our plans</h2>
<a href="https://example.com/plans">Compare plans</a>
{% endif %}The else branch is the default. Contacts with an empty or unexpected plan value land there instead of seeing a blank gap.
Rule order and overlap
A contact can belong to several segments. If a contact is both "Pro" and "Active in the last 30 days", the first matching variant wins. Put your most specific rule at the top and your broadest rule last.
| Position | Rule | Why this position |
|---|---|---|
| 1 | Pro and renewal due in 14 days | Most specific, so it must be checked first |
| 2 | Pro | Broader audience |
| 3 | Free | Broader audience |
| Default | Everyone else | Catches unknown values |
If you put "Pro" first, the renewal variant never appears, because every renewal contact is also a Pro contact.
Common errors
- No default. Some platforms hide the block when nothing matches. The email then has an unexplained gap.
- Wrong rule order. A broad rule placed first hides every narrower rule below it.
- Mismatched values.
"Pro"and"pro"are different strings in most Liquid engines. Clean the data or compare in a normalised form. - Too many variants. Each variant needs its own copy, links, and testing. Add one only when the audience really needs different content.
- Stale segments. If a segment updates only once a day, a contact who just upgraded may still see the Free variant.
Exercise
Exercise
You build a block with three variants in this order: "Customer" (all paying customers), "Customer with an open support ticket", and a default. Contacts with open tickets still see the generic customer message. What is wrong, and how do you fix it?
Show answer
Every contact with an open ticket is also a customer, so the first rule matches and the platform stops there. The narrower rule is never reached. Move "Customer with an open support ticket" above "Customer" so the most specific rule is checked first.
Exercise
A contact's plan field contains "Enterprise", which none of your variants cover. What do they see, and what should you have prepared?
Show answer
They see the default variant, or nothing if you did not define one. Always write a default that works for every contact, including those with unexpected or missing values.