Sub topic 4
Testing Personalization and Fallback Values
Personalization puts data from your contact records into a message: a first name in the greeting, a plan name in the body, a renewal date in a button label. It fails in ways that are easy to miss and embarrassing to read. This chapter covers how to test merge tags and fallback values before a send.
This chapter assumes you know what a merge tag is, can send a test message from your email platform, and have a seed list (the test recipients covered in the previous chapter). It uses Liquid-style syntax for its examples. Your platform may use a different syntax, so check its documentation.
What can go wrong with personalization
A merge tag is a placeholder that the platform replaces with a value from each contact's record when it builds the message. Three things commonly go wrong.
- Empty data. The field exists but holds nothing for this contact. Without a fallback, the greeting becomes "Hello ," or "Hello !".
- Unrendered tags. The platform does not recognize the tag, so the raw text reaches the reader, for example "Hello {{ first_name }},". This usually comes from a typo in the field name, a tag copied from another platform, or a field that was renamed or deleted.
- Bad data. The field holds a value that technically exists but reads wrongly. Examples are "N/A", "test", an email address in the name field, a name in all capitals ("JOHN"), or a placeholder such as "Customer".
A fallback value is the text the platform uses when the field is empty. In Liquid-style syntax, a default filter supplies it:
Hello {{ first_name | default: "there" }},
Thanks for being a customer since {{ signup_year | default: "the beginning" }}.With data, this renders as "Hello Maria, Thanks for being a customer since 2021." With empty fields, it renders as "Hello there, Thanks for being a customer since the beginning."
The second sentence shows why fallbacks need review. A fallback has to read naturally in the exact sentence where it sits. "Since the beginning" works. "Since 2021" works. A generic fallback such as "valued customer" can read oddly in other positions.
Where merge tags hide
Teams usually test the greeting and stop. Merge tags can also appear in places that are easy to forget:
- The subject line and preheader (the preview text shown next to the subject).
- Image alt text and image URLs, for example a personalized banner.
- Link URLs, such as a link with the contact's ID or email in the query string.
- Button labels and conditional blocks.
- The plain-text version, which is often a separate template.
- The footer, including the sender address and any account details.
Subject lines are the highest risk. A broken subject such as "{{ first_name }}, your order" is visible in the inbox before the reader opens anything. Some platforms also handle tags in the subject differently from tags in the body.
Build test contacts that cover the cases
A test send to your own address only checks the case where your own record is complete. To test fallbacks, you need seed contacts whose data is deliberately incomplete or unusual.
Create a small set of seed contacts, each representing one case:
| Seed contact | Data state | What it checks |
|---|---|---|
| Complete | All fields filled with normal values | The expected rendering |
| Empty fields | `first_name` and `signup_year` empty | Fallback values |
| Whitespace only | `first_name` holds a single space | Whether the platform treats a space as empty |
| Long values | A 40-character first name, a long company name | Layout and line wrapping |
| Special characters | Names such as "Zoë", "O'Brien", "Łukasz" | Encoding and apostrophe handling |
| Capitalization | `first_name` stored as "MARIA" | Whether the copy looks wrong in capitals |
| Missing field | A contact created before the field existed | Records that never had the field at all |
The whitespace case matters because many platforms test whether a field is empty, and a single space is not empty. The default filter then does nothing, and you get "Hello ,".
The "missing field" case differs from the "empty field" case on some platforms. An empty field exists with no value. A missing field was never set. Both should trigger the fallback, but you should confirm that they do on your platform rather than assume.
Run the test and read the output
Send the campaign to the seed contacts using the same send path as a real send. The previous chapter explained why a test send should match a real send as closely as possible. Many platforms offer a "preview as contact" feature that renders the message for a chosen record. That is quick and useful for drafts, but a real test send also exercises the actual delivery path, including the subject line and plain-text version, so use both.
For each seed contact, read the whole message, including the subject, the preheader, the footer and the plain-text part. Check the following:
- No raw tag text such as
{{,}},%}or*|appears anywhere. - No sentence has a stray gap, double space, or lonely punctuation mark where a value should be.
- Every fallback reads naturally in its sentence.
- Capitalization and special characters display correctly.
- Long values do not break the layout.
A search is faster than reading when you have many test messages. If you can save the received message as HTML or text, search for the characters that signal a failed merge.
import re
import sys
# Patterns that suggest a merge tag was not rendered.
LEFTOVER = [
r"\{\{.*?\}\}", # Liquid / Handlebars style
r"\{%.*?%\}", # Liquid block tags
r"\*\|.*?\|\*", # Mailchimp style
r"%%.*?%%", # Other platforms
]
with open(sys.argv[1], encoding="utf-8") as f:
text = f.read()
found = False
for pattern in LEFTOVER:
for match in re.findall(pattern, text):
print("UNRENDERED:", match)
found = True
# A greeting that ends in a bare comma suggests an empty value.
for match in re.findall(r"(?:Hello|Hi|Dear)\s*[,!]", text):
print("EMPTY GREETING:", match)
found = True
if not found:
print("No leftover merge tags found")Run it as python check_tags.py received_message.html for each test message. The script finds only the obvious failures. It cannot tell you that a fallback reads badly, so you still need to read each message.
Conditional content
Conditional blocks show different content depending on a field. For example, a block might show a discount only to a certain plan. Each branch needs testing, including the branch that applies when the field is empty.
{% if plan == "pro" %}
Your Pro plan renews on {{ renewal_date }}.
{% elsif plan == "free" %}
Upgrade to Pro to unlock reporting.
{% else %}
Explore our plans on our pricing page.
{% endif %}Create one seed contact per branch. The else branch is the one most often left untested, and it is the one real contacts with odd or missing data will hit. If a branch has no else and the field is empty, the reader may see an empty space in the message where a section should be. Check that the surrounding text still makes sense with the block missing.
Order of checks
The diagram shows a practical sequence for personalization testing.
Start by listing every tag in the template. A list gives you something to tick off, and it exposes tags in places you had not thought about, such as alt text.
Fix data problems at the source
Fallbacks hide gaps in your data. They do not repair it. If 30 percent of your contacts have no first name, "Hello there" will appear for nearly a third of your audience, and personalization will not feel personal. Before the send, check how many contacts in the actual segment have an empty value for each field you use. Most platforms let you build a segment of "first name is empty" and show its count.
Use that count to decide. If few contacts are affected, a good fallback is enough. If many are affected, consider removing the personalization from that spot, or write copy that works for everyone without the merge tag.
Also consider fields that are filled but wrong. Names entered in capitals, or names that contain a full email address, will pass an empty-field test. Look at a sample of real values from the segment, not just your seed contacts.
Common mistakes
- Testing only the complete record. Everything looks fine because your own contact has all the data.
- Forgetting the subject and preheader. The body renders correctly while the subject shows a raw tag.
- A fallback that does not fit the sentence. "Hello valued customer" is fine in a greeting but odd in "Your valued customer plan".
- Copying tags between platforms. Syntax from one platform often does not render on another.
- Changing the template after testing. An edit made after the test send is not covered by it. Test again after any change to the copy or tags.
Summary
Personalization testing checks that every merge tag renders, that fallbacks read naturally, and that conditional branches behave for contacts with incomplete data. Build seed contacts that represent empty, whitespace-only, long, special-character and missing-field cases. Send real tests, read every part of the message, and check the real segment for how often each field is empty.
Exercise
Your template greeting is Hello {{ first_name | default: "there" }},. A seed contact whose first_name holds a single space receives the message and sees "Hello ,". Why did the fallback not apply, and how would you detect this problem before a send?
Show answer
The platform treats a single space as a value, not as an empty field, so the default filter does not trigger. To detect it, include a seed contact whose first_name is whitespace only, send a test, and read the greeting. You can also build a segment on the real list to find contacts with whitespace-only names and clean the data, or trim the value in the template if your platform supports a trim filter.
Exercise
List four places other than the email body where a merge tag might appear and fail unnoticed.
Show answer
Any four of: the subject line, the preheader, image alt text, image or link URLs, button labels, the plain-text version, and the footer.