Use Conditional Merge Tags
by Intuit• Updated 2 weeks ago
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.
Before you start
Here are some things to know before you begin this process.
- Make sure you're familiar with how merge tags work in Mailchimp. If you have more than one Mailchimp audience, make sure you use the correct merge tags for the audience you plan to send to. To learn more, check out Getting Started with Merge Tags.
- If you have a Standard plan or higher, our Dynamic Content feature helps you show unique content to specific recipients without manually adding merge tags. To learn more, check out About Dynamic Content.
- Conditional merge tags work with audience fields and groups. Tags don’t work with conditional merge tags.
- Conditional merge tags don't work in email subject lines or with unique URLs. Since conditional merge tags are contact-specific, they won’t populate in test emails either.
- Test your merge tags in Preview Mode for complicated conditional merge tags. If you want to do something extensive, you may want to contact your developer or hire a Mailchimp expert for assistance.
How it works
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.
Available operators
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|* |
Conditional tag format
Here are a few things to keep in mind when using conditional merge tags in your campaigns.
- For the most consistent results, use number fields for greater than, less than, and other numerical comparisons. A text field that includes non-numerical values may not display the results as expected.
- IF logic checks against the entire string value in a statement, so AND conditions and OR conditions should not be used. For example, in the condition *|IF:MERGE OR BAR|*, the entire string, "MERGE OR BAR," would be checked, instead of treating "MERGE" and "BAR" as separate values.
Conditional merge tag examples
Here are a few common uses for conditional merge tags.
Translate content for international audiences
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|*
Display content when data is missing
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|*
Present special offers to customers
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 display content on certain pages
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|*
Display information based on age
*|IF:AGE >= 18|*
Don't forget to vote this Tuesday!
*|END:IF|*
Request missing information
*|IFNOT:FNAME|*
Hey there! It looks like we're missing some information for you! Would you mind updating your profile?
*|END:IF|*
Use groups with conditional merge tags
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.
Troubleshooting
If you've tested your merge tags and they're not working, here are some things to look for.
- Tag syntax errors
If there are syntax errors in your merge tags, the tags might break. Conditional merge tags are case sensitive, and won’t work if there are typos, extra spaces, or missing spaces. - Audience data mismatch
If you use groups with your conditional merge tags, the tags can break if they don’t match your group names exactly as they appear in your audience. This includes capitalization and spacing. - Broken conditional tags
If your conditional merge tags don't work as expected, check for any unclosed conditional tags. Every set of conditional tags must start with an *|IF|* tag and close with an *|END:IF|* tag in the same content block. - Extra space in conditional tags
If you notice extra whitespace in your conditional content, remove all spaces between your conditional merge tags to resolve the issue. - Comma errors in plain-text emails
If you see extra line breaks in the plain-text version of your email, move any commas from outside your conditional tags to the inside. Here’s an example.
Incorrect | Correct |
---|---|
Dear *|IF:MMERGE3|* *|MMERGE3|* *|ELSE:|* *|FNAME|* *|END:IF|*, | *|IF:MMERGE3|* Dear *|MMERGE3|*, *|ELSE:|* Dear *|FNAME|*, *|END:IF|* |
Sign in now for personalized help
See articles customized for your product and join our large community of QuickBooks users.
More like this
- Why you should group your tags in QuickBooks Onlineby QuickBooks•4103•Updated June 21, 2024
- What are tags and why should I use them?by QuickBooks•24828•Updated June 21, 2024
- How to use tags in QuickBooks Onlineby QuickBooks•184•Updated June 20, 2024
- Tag transactions in QuickBooks Onlineby QuickBooks•1616•Updated June 14, 2024
- Remove a product or service in QuickBooks Onlineby QuickBooks•438•Updated 2 weeks ago