Sub topic 3
Building Dynamic Content Blocks
Assume you know how contacts, fields, segments, and merge tags work in an email platform. You should also be able to read basic Liquid-style template syntax.
Dynamic content blocks
A dynamic content block selects different prepared content for different recipients. A merge tag changes a value inside one message, while a dynamic block can change the message itself.
{% if customer.plan == "pro" %}
Your Pro plan includes priority support.
{% elsif customer.plan == "free" %}
Upgrade to Pro to get priority support.
{% else %}
Explore our plans.
{% endif %}The else branch protects contacts whose plan is missing or unfamiliar. In a visual editor, the same rule may appear as audience conditions attached to separate content blocks.
Consent, privacy, and behaviour
Use only data that the contact has consented to share and that the campaign needs. Avoid exposing sensitive attributes in visible text. Behavioural data, such as a viewed product or abandoned cart, should have a clear purpose, retention limit, and lawful collection basis.
An event can trigger relevant content, but it can also become stale. Set an expiry rule, such as ignoring a cart event after seven days.
Rendering item lists
Loops repeat a template for each item. This is useful for receipts and order confirmations.
{% for item in order.items %}
{{ item.name }} x {{ item.quantity }}
{% endfor %}Validate item names, quantities, prices, and list length before rendering. Limit unusually long lists so the email remains readable.
Previewing and testing
Preview with a complete contact, missing fields, an unknown segment, and several item-list sizes. Confirm that fallback text, links, totals, and mobile layout remain correct. Test the rendered output, not just the template rules.
A test environment should fail loudly for missing fields when that failure would hide a data problem. Production templates should still have safe fallbacks where an incomplete record is expected.
Measuring personalisation
Compare a personalised version with a control version that uses generic content. Keep the audience assignment random and change one main variable. Measure the outcome that matches the campaign goal, such as completed purchases or qualified replies, rather than relying only on opens.
| Test element | Example |
|---|---|
| Control | Generic plan message |
| Variant | Plan-specific dynamic block |
| Primary metric | Trial upgrades |
Run the test long enough to collect meaningful results, then check whether the difference is large enough to justify the added data and maintenance.
Exercise
A contact has no plan value and a seven-day-old cart event. Which protections should the template use?
Show answer
Use the generic content branch, ignore the expired cart event, and render safe fallback text rather than exposing a blank or stale message.