Conditional merge tag blocks, also known as smart and dynamic merge tag blocks, allow you to create dynamic content conditions based on subscriber data.
Depending on what you want to achieve, conditional merge tag blocks can become advanced. It is important to test your campaign to make sure the conditional merge tag blocks are formatted correctly. More complicated conditional merge tag blocks may need the help of a developer or one of our experts.
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
Below is an example.
It is also possible to use IFNOT for negative conditions.
More advanced conditions can be done, such as the example below.
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 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.
- 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.
- 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:FOO OR BAR|*, the entire string, "FOO OR BAR," would be matched against rather than treating "FOO" and "BAR" as separate statements.
- 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 (:).