Sub topic 1
Merge tags versus dynamic content: what personalisation means
Email personalisation is the practice of filling one template with data about each recipient, so that thousands of people receive messages that differ in the parts that matter. This chapter defines the two main techniques, merge tags and dynamic content, and shows how a platform turns a template and a contact record into a finished email. Later chapters cover each technique in detail.
Prerequisites
This chapter assumes you have:
- Sent at least one campaign from an email platform.
- A working idea of contacts, lists and fields, such as first name or email address.
- Seen basic HTML email structure. This is helpful but not required.
Examples use Liquid-style syntax. Liquid is a template language that several platforms use or imitate. Tag names, field names and filter names vary by platform, so check your platform's documentation before copying a snippet.
What personalisation means
A personalised email is built from two inputs:
- A template, which is the fixed text and layout you write once.
- A contact record, which is the stored data about one recipient, such as name, plan, city or last purchase.
At send time, the platform combines them. This step is called rendering. The output is one finished email per recipient, and each one is different from the others.
Personalisation operates at two levels:
- Merge tags replace a small piece of text with a value from the contact record.
- Dynamic content changes whole sections of the email, such as which paragraph, image or product list appears.
Merge tags
A merge tag, also called a placeholder or variable, is a marker in the template that the platform replaces with a value from the contact record. In Liquid-style syntax, double curly braces mark the tag.
Hi {{ customer.first_name | default: "there" }},
Thanks for being with us.The tag customer.first_name points to a field. The part after the pipe, | default: "there", is a filter. A filter changes or checks a value before it is inserted. Here, default supplies "there" when the field is empty or missing. A contact named Sam receives "Hi Sam," and a contact with no first name receives "Hi there,".
A merge tag never changes the structure of the email. Every recipient gets the same paragraphs in the same order. Only the inserted values differ.
Dynamic content
Dynamic content means the structure or substance of the email changes depending on the recipient. The platform evaluates a rule for each contact and includes or excludes content accordingly. Two common forms exist:
- Conditional blocks use if/else logic on a contact attribute.
- Repeated content uses a loop to output one item per entry in a list.
This conditional block shows one of three messages by plan:
{% 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 matters. It handles contacts whose plan is blank, misspelled or not one of the values you expected. Without it, those contacts would get an empty gap where the message should be.
This loop repeats one line for each item in an order:
{% for item in order.items %}
{{ item.name }} x {{ item.quantity }}
{% endfor %}An order with one item produces one line, and an order with twelve produces twelve. You write the template once.
Many platforms also offer dynamic content blocks in a visual editor. You attach an audience rule, usually a segment, to a block, and the platform shows the block only to contacts who match. Under the hood this is the same idea as a conditional. The editor hides the syntax.
Comparing the two techniques
| Aspect | Merge tags | Dynamic content |
|---|---|---|
| What changes | A value inside a sentence | Whole sentences, blocks or lists |
| Logic needed | None, or a simple filter | Conditions or loops |
| Email structure | Identical for everyone | Can differ per recipient |
| Typical example | First name in the greeting | Offer based on plan |
| Main failure | Blank or awkward inserted value | Wrong or empty block shown |
| Effort to test | Low | Higher, because there are many paths |
The techniques are not alternatives. Most real emails use both: a merge tag for the greeting inside a dynamic block that only some contacts see.
How rendering works
The platform follows the same sequence for every recipient.
Two consequences follow:
- Rendering happens per contact, using the data as it is at that moment. If a field changes between your test and the send, the output changes.
- The recipient only sees the result. A tag that fails to resolve appears in the final email as a blank, a raw tag or an error, and you do not get a second chance.
What happens when data is missing
Missing data is the most common cause of personalisation mistakes. A field can be empty, absent, or filled with something unexpected. Platforms handle these cases differently. Some insert nothing, which leaves "Hi ," in the greeting. Some print the raw tag text. Some stop the send with an error.
A fallback value is the default text used when a field has no usable value. The default filter above is one. Always supply one for any merge tag that sits inside a sentence.
You can reproduce these behaviours in code. This Python example uses Jinja2, a template library whose syntax is close to Liquid. It shows a fallback replacing an empty first name. It also shows StrictUndefined, which raises an error on a missing field instead of silently rendering a blank.
from jinja2 import Environment, StrictUndefined
env = Environment(undefined=StrictUndefined)
template = env.from_string("Hi {{ first_name | default('there', true) }}, your plan is {{ plan }}.")
print(template.render(first_name="", plan="Pro"))
try:
template.render(first_name="Sam")
except Exception as error:
print(type(error).__name__)The first call prints Hi there, your plan is Pro. The second call has no plan value, so it prints UndefinedError. The true argument to default makes it apply to empty strings as well as undefined values. Without it, an empty first name would stay empty.
Choosing between them
Start with the simplest tool that meets the need.
- Use a merge tag when only a value differs and the message is the same for everyone.
- Use a conditional when different groups need different wording or offers.
- Use a loop when the number of items varies per recipient.
- Use a segment-driven block when marketers, not template authors, should control who sees what.
More logic means more paths to test. An email with three independent conditionals has up to eight combinations of output. Add logic only when the value justifies the testing cost.
Common mistakes
- Using a merge tag with no fallback, which produces "Hi ," for contacts without a first name.
- Assuming a field is always filled, when imports, sign-up forms and integrations often leave it blank.
- Writing a conditional with no
elsebranch, so unexpected values show nothing. - Inserting a field into a sentence that only reads correctly for some values, for example "your 1 items".
- Copying syntax between platforms without checking. Some use
{{ }}and filters, and others use*|FIRSTNAME|*or%%first_name%%and different conditional keywords.
Exercise
A template contains the greeting Hi {{ customer.first_name }}, and a block that reads {% if customer.plan == "pro" %}Priority support is included.{% endif %}. A contact has an empty first name and the plan value "Pro" with a capital P. Which technique does each part use, and what is likely to go wrong for this contact?
Show answer
The greeting is a merge tag and the second part is dynamic content (a conditional). The greeting has no fallback, so this contact will probably see "Hi ,". The comparison == "pro" is case-sensitive in Liquid, so "Pro" will not match, and with no else branch the contact sees nothing in that block. Fixes: add | default: "there" to the greeting, normalise plan values to lowercase in the data (or compare the lowercased value), and add an else branch.
Exercise
Your team wants an order confirmation that lists every purchased product, and a banner that appears only for contacts who joined in the last 30 days. Which technique fits each requirement?
Show answer
The order list needs a loop, because the number of items varies per order. The new-member banner needs a conditional or a segment-driven dynamic block, because it appears for some contacts and not others. Merge tags alone could insert values such as the order number but could not repeat items or show or hide the banner.