Sub topic 2
Keeping Data Clean So Merged Text Reads Well
Assume you know how contacts, lists, and fields work in an email platform. The examples use Liquid-style syntax; field names and rules vary between platforms.
Clean Data Before Rendering
A merge tag reads a value from a contact field and inserts it into the message. The template cannot reliably fix misspellings, extra spaces, inconsistent capitalisation, or invalid values.
Before sending, normalise important fields:
- Remove leading and trailing spaces.
- Standardise capitalisation for names and locations.
- Validate dates, numbers, and email addresses.
- Decide how empty, unknown, or outdated values should appear.
- Keep field names and value formats consistent across data sources.
Use a fallback when a value is missing:
Hi {{ customer.first_name | default: "there" }},
Here is your weekly update.A fallback prevents awkward text such as “Hi ,”. It should be a natural replacement, not a misleading guess. For example, use “there” rather than inventing a first name.
Personalising Subject Lines and Preheaders
Subject lines and preheaders are useful places for short, well-tested personalisation:
Subject: {{ customer.first_name | default: "Your" }} weekly summary
Preheader: New ideas selected for your interests.Keep the variable near the beginning, where truncation is less likely to hide it. Do not add sensitive information or detailed behaviour to a subject line. Preview the result on both mobile and desktop.
Showing Different Content with Conditional Logic
Conditional content uses if, elsif, and else rules to select text:
{% 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 %}Always include a generic else branch unless the platform guarantees that every contact has a valid value. Test spelling, whitespace, and every possible branch.
Using Segments to Decide Who Sees What
A segment is a group of contacts selected by shared rules, such as plan, region, or recent purchase. Segments can choose a dynamic content block before the email is rendered. Keep rules mutually understandable, document their priority, and provide a default block for contacts in no segment.
Exercise
A contact has an empty first name and an unknown plan. What should your template display?
Show answer
Display the fallback greeting and the generic conditional branch, then verify both results in a preview.