Conditional merge tag blocks, also known as smart and dynamic merge tag blocks, allow you to create dynamic content conditions based on subscriber data.
Below, we walk through how conditional merge tag blocks function and provide some examples of how they can be used.
Our conditional blocks support traditional IF, ELSE, and ELSEIF logic, as well as the following operators:
- =equal to
- !=does not equal to
- >greater than
- <less than
- >=greater than or equal to
- <=less than or equal to
It is also possible to use IFNOT for negative conditions. For example:
More advanced conditions can be done, such as:
With conditional blocks, you can:
- 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 you know that not all of your recipients have an FNAME value in your list.
- Let folks that live in Texas see a different promotion than those who live in Georgia or other states.
- 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 for announcing winners/prizes.
- Request information from subscribers with incomplete data:
- When using > greater than and other numerical comparisons, we recommend using number fields in your MailChimp list for the most consistent results. If using a text field that includes a non-numberical value, such as a period or a comma, the results may not appear as expected.
- AND conditions and OR conditions cannot be used for values. For example, in the conditional *|IF:FOO OR BAR|*, the entire string, "FOO OR BAR," would be matched against rather than treating OR as a separate statement.
- If your conditional merge tag block is not working as expected, check the syntax of the tags as well as the data in your list for any typos or extra spaces. Additionally, check for any unclosed conditional tags.
Using Groups with conditional 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.
|Was this article helpful?||
|What can we do to improve your experience with articles like this?|
At this time, we are unable to reply to any responses, but we'll use this information to keep the site up-to-date.