Conditional merge tag blocks allow you to embed dynamic content in your campaigns. You'll create multiple versions of campaign content, and use conditional merge tags to check subscriber data and display the relevant information to the right subscribers.
Conditional merge tag blocks can become complex very quickly, so be sure to test your campaign thoroughly. If you want to do something extensive, you may want to contact your developer or hire a MailChimp expert if you need assistance.
Below, you'll learn how conditional merge tag blocks work and find many examples of how they can be used.
Before You Start
Here are some things to know before you begin this process.
- Before you add conditional merge tag blocks to your campaign content, familiarize yourself with the components of a conditional merge tag block and how they can be used in campaigns.
- Conditional merge tag blocks need to include the merge tag assigned to the list field you’re using, so make sure you use the correct merge tag. The examples below may use merge tags that are different from the merge tags for your list fields.
MailChimp conditional merge tag blocks support traditional IF, ELSE, and ELSEIF logic, as well as these operators.
- = equal to
- != does not equal to
- > greater than
- < less than
- >= greater than or equal to
- <= less than or equal to
In the examples below, MERGE is the merge tag assigned to the list field.
It is also possible to use IFNOT for negative conditions.
More advanced conditions can be done, such as the example below.
- For > greater than and other numerical comparisons, we recommend that you use number fields in your MailChimp list for the most consistent results. If you use a text field that includes a non-numerical value, such as a period or a comma, the results may not appear as expected.
- AND conditions and OR conditions can't be used for values. For example, in the conditional *|IF:MERGE OR BAR|*, the entire string, "MERGE OR BAR," would be matched against rather than treating "MERGE" and "BAR" as separate statements.
Conditional Merge Tag Block Examples
Below, you'll find a list of common uses for conditional merge tag blocks.
- Present content that is unique to each recipient.
- Show default values 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 list.
- Let subscribers who live in California see a different promotion from those who live in Georgia or other states.
If your campaign includes multiple conditional blocks, like the example above, remove all spaces between the merge tags. Otherwise, additional whitespace is included around the content. For example, the above conditional merge tag block should look like the following in your campaign.
- Display information based on age.
- Offer different levels of coupons based on purchase activity. The order of this code is important to ensure that a subscriber does not meet multiple conditional blocks.
- Hide or show parts of your content on campaign archives.
- Use conditional blocks to announce winners/prizes.
- Request information from subscribers with incomplete data.
If your conditional merge tag block doesn't work as expected, check the syntax of the tags and the data in your list for any typos or extra spaces. Additionally, check for any unclosed conditional tags.
Use Groups with Conditonal Merge Tag Blocks
If you have groups in your list, you can send conditional content to subscribers based on the group they're in.
The format for this conditional block is *|INTERESTED:GroupTitle:GroupName|*. For example, you might have a group set in your list to define the skill level of your subscribers.
Group Title: Skills
Group Name 1: Newbie
Group Name 2: In Between
Group Name 3: Expert
You can then create a conditional block to display content only to your Expert group.
You can also create a conditional block to display content to subscribers who are not in specified groups.
Multiple groups can be nested to show unique content to each group and the default to anyone else.
For the *|INTERESTED|* merge tag to work as expected, the Group Title can't contain any colons (:).