Conditional Merge Tags
How do I use conditional merge-tags (variables) in my emails ?
Conditional merge tags allow you to create truly personalized email campaigns by displaying different content based on your prospect's data. Instead of sending generic messages, you can tailor specific sections of your email to match each recipient's industry, role, company size, or any other data point you have. This targeted approach significantly improves engagement rates and conversion by making each recipient feel that your message was crafted specifically for them.
Guide to Write Dynamic Content Email in SmartReach.io
Introduction to Merge Tags
Merge tags like {{first_name}}
personalize your emails by inserting prospect-specific information. These tags represent columns in your prospect data (examples: {{first_name}}
, {{profession}}
, {{experience}}
).
Dynamic content emails use logic applied to these merge tags. When writing logic statements, use column names without the curly braces.
Basic Operators
== equals
!= does not equal
or logical OR
and logical AND
Control Flow Options
If Statement
Shows content when a condition is true.
{% if profession == 'marketer' %}
You are invited to DreamForce.
{% endif %}
Result: If profession is "marketer", adds "You are invited to DreamForce."
Unless Statement
Shows content when a condition is false (opposite of if).
{% unless profession == 'Marketer' %}
You are not invited to DreamForce.
{% endunless %}
Result: If profession is NOT "Marketer", adds "You are not invited to DreamForce."
If-Elsif-Else Statement
Handles multiple conditions.
{% if profession == 'Marketer' %}
You are invited to DreamForce.
{% elsif profession == 'Sales Development Rep' %}
You should go to SaaSSales.
{% else %}
Tell me your profession.
{% endif %}
Case-When Statement
Similar to a switch statement for multiple conditions.
{% case profession %}
{% when 'Marketer' %}
You are invited to DreamForce.
{% when 'Sales Development Rep' %}
You should go to SaaSSales.
{% else %}
Tell me your profession.
{% endcase %}
Helpful Features
Comments
Add notes in your dynamic content that won't appear in emails.
{% comment %}
This text won't show in the email
{% endcomment %}
Raw Tag
Disables merge tag processing when you need to show actual curly braces.
{% raw %}
How are you {{first_name}}
{% endraw %}
Result: Shows literally "How are you {{first_name}}" without processing the merge tag.
String Operations
Contains
Checks if a string contains a substring.
{% if first_name contains 'Peter' %}
Your first name includes Peter.
{% endif %}
Capitalize
Makes the first letter uppercase.
{{ "awesome" | capitalize }} <!-- Result: "Awesome" -->
{{ first_name | capitalize }} <!-- If first_name = "mickey mouse", result: "Mickey mouse" -->
Default
Provides a fallback value when the original is empty, nil, or false.
Hi {{ first_name | default: 'there' }}!
Result: Shows "Hi there!" if first_name is empty/null.
Append
Combines two strings.
{{ company | append: " Inc." }} <!-- If company = "Apple", result: "Apple Inc." -->
Nil Check
Checks if a value is null or empty.
{% if company == nil %}
Hey there!
{% else %}
Hey {{ company }}!
{% endif %}
Result: Shows "Hey there!" when company is null/empty.
Hey (if the value of a string is null or empty)
Updated about 19 hours ago