Getting Started with Merge Tags
Use merge tags to insert dynamic content, like names or titles, in your emails. Learn about merge tags, where to access them, and how to create new ones.
Get the job done with a pro
From training to full-service marketing, our community of partners can help you make things happen.
Conditional merge tags help you control who sees what in your email. When you add conditional merge tags to a specific piece of content, it will show only to the recipients who meet the conditions you set.
In this article, you'll learn about conditional merge tags and how to use them.
Here are some things to know before you begin this process.
Conditional merge tags work similar to programming languages. At the start of your conditional content, you’ll add an opening tag with certain operators and values. You’ll then add a closing tag at the end of your conditional content in the same content block as the opening tag.
For example, let’s say you want certain promotional content in your email to only appear to recipients who are 21 or older. Your conditional tags will look something like this.
*|IF:AGE >= 21|*
Check out our special deals on wine!
*|END:IF|*
Conditional merge tags can do a lot, and you may want to include multiple sets of conditional tags in your campaign.
Mailchimp conditional merge tags support traditional IF statements, as well as these operators.
Operator | Definition |
---|---|
= | equal to |
!= | not equal to |
> | greater than |
< | less than |
>= | greater than or equal to |
<= | less than or equal to |
Conditional merge tag statements will support IF, ELSE, ELSEIF, and IFNOT logic, as represented in this table.
Name | Definition | Example |
---|---|---|
IF | Use IF to indicate the content to display if the *|MERGE|* tag value is true. | *|IF:MERGE|* content to display *|END:IF|* |
ELSE | Use ELSE to indicate alternative content to display if the *|MERGE|* tag value is false. | *|IF:MERGE|* content to display *|ELSE:|* alternative content to display *|END:IF|* |
ELSEIF | Use ELSEIF to specify a new *|MERGE|* tag to be matched against if the first *|MERGE|* tag value is false. | *|IF:TRANSACTIONS >= 20|* Enjoy this 40% off coupon! *|COUPON40|* *|ELSEIF:TRANSACTIONS >= 10|* Enjoy this 20% off coupon! *|COUPON20|* *|ELSE:|* Enjoy this 10% off coupon! *|COUPON10|* *|END:IF|* |
IFNOT | Use IFNOT to indicate the content to display if the *|MERGE|* tag value is false. | *|IFNOT:MERGE|* content to display *|END:IF|* |
Here are a few things to keep in mind when using conditional merge tags in your campaigns.
Here are a few common uses for conditional merge tags.
Display your content in different languages based on contact profile information.
*|IF:MC_LANGUAGE=es|*
Spanish content here.
*|ELSE:|*
Display English content for everyone else.
*|END:IF|*
Show a generic value in place of missing data. For example, you may want to have a greeting like "Hello *|FNAME|*," but not all of your recipients have an FNAME value in your audience.
Hello *|IF:FNAME|*
*|FNAME|*,
*|ELSE:|*
Friend,
*|END:IF|*
Offer different coupons to frequent purchasers or customers whose recent purchases are over a certain amount. Pay special attention to the order of this code to ensure a recipient doesn't meet multiple conditions.
First, set up a number field in your audience to keep track of how many purchases each contact makes, and import that data from your CRM into the Mailchimp field. Then use conditional merge tags to display different coupons that reward customers based on their purchase history.
*|IF:TRANSACTIONS >= 20|*
Enjoy this 40% off coupon! *|COUPON40|*
*|ELSEIF:TRANSACTIONS >= 10|*
Enjoy this 20% off coupon! *|COUPON20|*
*|ELSE:|*
Enjoy this 10% off coupon! *|COUPON10|*
*|END:IF|*
Hide or show parts of your content on campaign pages. This condition can be useful if you send coupons or very time-specific content that you don't want to appear on your campaign page in the future.
*|IF:ARCHIVE_PAGE|*
Content visible only on the sent campaign page.
*|END:IF|*
Or
*|IFNOT:ARCHIVE_PAGE|*
Content visible only in the campaign.
*|END:IF|*
*|IF:AGE >= 18|*
Don't forget to vote this Tuesday!
*|END:IF|*
*|IFNOT:FNAME|*
Hey there! It looks like we're missing some information for you! Would you mind updating your profile?
*|END:IF|*
If you have groups in your audience, you can show conditional content to recipients based on the group they're in. Instead of a merge tag, refer to the group category and names in your conditional tags.
*|INTERESTED:GroupTitle:GroupName|*
Content to display to group.
*|END:INTERESTED|*
Group Category: Customers
Group Name 1: Wholesale
Group Name 2: First-Time Buyers
Group Name 3: Repeat Buyers
To display content only to your Repeat Buyers group, your conditional merge tags should look like this.
*|INTERESTED:Customers:Repeat Buyers|*
Here is a special promotion just for our most dependable customers!
*|END:INTERESTED|*
You can also use conditional tags to display content to recipients who are not in specified groups.
*|INTERESTED:Customers:Wholesale,First-Time Buyers|*
Thanks for your interest in the Potted Planter!
*|ELSE:|*
We aren't sure if you'd like to continue to hear from us. Would you like to update your profile to let us know a little more about you?
*|END:INTERESTED|*
Multiple groups can be nested to show unique content to each group and the default to anyone else. Keep in mind that some recipients may be a member of more than one group, and may see more than one set of conditional content.
*|INTERESTED:Customers:Wholesale,Repeat Buyers|*
*|INTERESTED:Customers:Wholesale|*
You're one of our wholesale buyers.
*|END:INTERESTED|*
*|INTERESTED:Customers:Repeat Buyers|*
You're one of our loyal customers.
*|END:INTERESTED|*
*|ELSE:|*
We aren't sure how you heard about The Potted Planter. Would you like to update your profile to let us know a little more about you?
*|END:INTERESTED|*
For the *|INTERESTED|* merge tag to work as expected, the group category can't contain any colons. To learn how to manage your group settings, check out our Edit Group Category and Names article.
If you've tested your merge tags and they're not working, here are some things to look for.
Incorrect | Correct |
---|---|
Dear *|IF:MMERGE3|* *|MMERGE3|* *|ELSE:|* *|FNAME|* *|END:IF|*, | *|IF:MMERGE3|* Dear *|MMERGE3|*, *|ELSE:|* Dear *|FNAME|*, *|END:IF|* |
Technical Support
Have a question?
Paid users can log in to access email and chat support.
Use merge tags to insert dynamic content, like names or titles, in your emails. Learn about merge tags, where to access them, and how to create new ones.
Merge tags let you insert dynamic content in your campaigns. Get a list containing each merge tag and how to use it.
Conditional merge tags let you hide or display content based on criteria you define. Learn how to format these tags and fix common issues.