Use Conditional Merge Tag Blocks

This feature requires Author user level or higher.

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. 

In this article, 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.
  • Subject lines do not support conditional merge tags.

Available Operators

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.

*|IF:MERGE|*

content to display

*|END:IF|*

or

 *|IF:MERGE|*

content to display

*|ELSE:|*

alternative content to display

*|END:IF|*

It is also possible to use IFNOT for negative conditions.

*|IFNOT:MERGE|*

content to display

*|END:IF|*

More advanced conditions can be done, such as the example below.

*|IF:MERGE != Bob|*

Your name's not Bob.

*|END:IF|*

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.

    Hello *|IF:FNAME|*
    
    *|FNAME|*,
    
    *|ELSE:|*
    
    Friend,
    
    *|END:IF|*
  • Let subscribers who live in California see a different promotion from those who live in Georgia or other states. 
    *|IF:STATE=CA|*
    
    Save 20% on surf boards!
    
    *|END:IF|*
    
    *|IF:STATE=GA|*
    
    Save 20% on mountain bikes!
    
    *|END:IF|*
    
    *|IF:STATE=FL|*
    
    Save 40% on water skis!
    
    *|END:IF|*
    
    *|IF:STATE=CO|*
    
    Save 50% on ski gear!
    
    *|END:IF|*

    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. 
    *|IF:AGE >= 18|*
    
    Don't forget to vote this Tuesday!
    
    *|END:IF|*
  • Offer different levels of coupons based on subscriber information in your list. For example, you can send custom coupons to reward the subscribers who purchase from you often.

    Set up a  number field in your MailChimp list to keep track of how many purchases each subscriber makes, and import that data from your CRM into the MailChimp field. Then use conditional merge tags to display dynamic coupons that reward loyal customers.

    The order of this code is important to ensure that a subscriber does not meet multiple conditional blocks. 
    *|IF:TRANSACTIONS >= 20|*
    
    Enjoy this 40% off coupon! *|COUPON20|*
    
    *|ELSEIF:TRANSACTIONS >= 10|*
    
    Enjoy this 20% off coupon! *|COUPON10|*
    
    *|ELSE:|*
    
    Enjoy this 10% off coupon! *|COUPON|*
    
    *|END:IF|*
    
    
  • Hide or show parts of your content on  campaign archives
    *|IF:ARCHIVE_PAGE|*
    
    Content visible only on the archive page
    
    *|ELSE:|*
    
    *|END:IF|*

    or

    *|IFNOT:ARCHIVE_PAGE|*
    
    Content visible only in the campaign
    
    *|END:IF|*
  • Use conditional blocks to announce winners/prizes.
  • Request information from subscribers with incomplete data.
    *|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 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.

*|INTERESTED:Skills:Expert|*

You’ve already got a great skill set!

*|END:INTERESTED|*

You can also create a conditional block to display content to subscribers who are not in specified groups.

*|INTERESTED:Skills:Newbie,In Between|*

You’re a newbie or are in between a newbie and an expert.

*|ELSE:|*

You’re not a newbie or in between a newbie and an expert.

*|END:INTERESTED|*

Multiple groups can be nested to show unique content to each group and the default to anyone else.

*|INTERESTED:Skills:Newbie,Expert|*

*|INTERESTED:Skills:Newbie|*

You're a newbie!

*|END:INTERESTED|*

*|INTERESTED:Skills:Expert|*

You're an expert!

*|END:INTERESTED|*

*|ELSE:|*

You aren't a newbie or an expert.

*|END:INTERESTED|*

Was this article helpful?
What can we do to improve articles like this?