Merge tags allow you to personalize your emails. One of the most basic and common uses of merge tags would be something like, “Hello, *|FNAME|*” inserted as a greeting for your email. The tag *|FNAME|* will insert the user’s first name, making for a customized email experience.
In the latest MailChimp system update, we’ve added support for advanced merge tags. These enable you to to do some very cool things, including the ability to create dynamic content. In the Campaign Builder, when you click to edit any area of your content, you’ll see a link for the “advanced merge tag reference”. Clicking this will bring up an information window with all the details I’m about to share. We’ve divided this reference into categories to make it easier to use: Formatting, Dynamic Content, List Information, Sharing, and Campaign Information.
Let’s start with Formatting. This class allows you to modify the way the content inside you various merge tags is displayed. You can make the value displayed appear as all lower case characters using *|LOWER:YOUR_MERGE|* (where *|YOUR_MERGE|* might be something like FNAME for first name or LNAME for last name, etc). *|TITLE:YOUR_MERGE|* will change the value of *|YOUR_MERGE|* to title-case, which means that the first letter in each word is capitalized. This one is especially handy if you want to standardize the way names, for example, are displayed, regardless of whether someone signed up for your list using ALL CAPS or all lower-case characters. Check out the image below for some additional advanced formatting tags.
Next, let’s take a look at the new tags for Dynamic Content. In our opinion, this is one of the most exciting and powerful of our new advanced merge tags. Essentially, we’ve enabled you the capability to set up an *|ELSEIF:CONDITION|*, using the protocol of basic logic statements. Let me give you a scenario to make this a little more clear. Let’s say you run an online store for Major League Baseball fans. You might want to tailor your content to fans of certain teams based on the region they are from. For example:
*|IF:STATE=FL|*
Save 20% on all Marlins Window Stickers!
*|ELSEIF:STATE=GA|*
Save 15% on all Braves apparel!
*|ELSEIF:STATE=MD|*
Save 10% on all Orioles Window Stickers!
*|ELSE:|*
Save 15% on all MLB apparel this weekend only!
*|END:IF|*
In the coming weeks we will be going in to greater detail and giving you more examples, tricks and tips for using these advanced merge tags. There are a few more that I want to mention right now though. *|MC:SHARE|* will add all the social network icons that you see displayed at the bottom of this blog post. (Shameless plug: we know you are reading, now you’ve got to Digg us!) In addition, *|DATE|* will insert the current date, and *|RSS:RECENT|* will insert the titles of your five (by default) most recent blog posts. If you want to display a different number, all you have to do is use *|RSS:RECENTx|* where x = whatever number of posts you want to display. Happy merging!
Quick Update: Here’s a cheatsheet of all MailChimp Merge Tags


[...] actually a PLEH-thora of new merge tags we just launched, which you can find in the new “advanced merge tag reference” described here. Spread the monkey [...]
Any way to filter down the social network icons to just the ones you want to use? There are just so many that I think it’s unusable right now.
@Jared–
Right now the *|MC:SHARE|* merge tag is only able to give you ALL of the social network icons. We may be able to add a way to filter them down in the future, but for now, it’s all or nothing.
I am looking for a way to set a coupon expiration date when an email is sent
I could use *|DATE|* like this
This coupon expires 7 days after *|DATE|*
But that requires people to do math and think
I would like a merge tag that is calculated off the current date
This coupon expires *|DATE:+7|*
Which would add 7 days to the current date
@bbrodka–
Your date request sounds reasonable enough, although it is not something we currently support. Because of the way the back end code is written, we would have to implement custom formatting for the *|DATE|* merge tag.
We’re putting this request into the suggestion box, and it may be something we can implement in future system upgrades.
+1 on being able to show a future date for coupons with an expiration date. I need to do this also. Right now I am just saying “offer expires 1 month after *|DATE:M. d Y|*”. I would rather use “offer expires *|DATE:M(+1). d Y|*” or something like that.
[...] you know you can use some nifty new advanced merge tags inside of MailChimp to test different designs or content in your email [...]
[...] basically going to be using dynamic merge tags in your welcome messages. In particular, “If Interested” tag: [...]
[...] a video of some neat things you can do with MailChimp’s merge tags (formatting tricks, dynamic content based on interests, [...]
I using MailChimp from Argentina and i need to set a male or female header (like Ms Betty or Mr John) to start my mails.
Is any way to do this?
@Ezequiel – You can only use the advanced merge tag feature if you also have a field in your database for “gender”.
then, you could say “IF gender is MALE, then blah”
Alternatively, you wouldn’t need to use any logic if you have a field where your users can specify Mr., Mrs., Ms, Dr., Rev., etc.
@Ben, thanks.
I discover the way a few minutes after my comment, but i apreciate your answer.
Thanks again!
Just a heads up: if you use the DATE tage make sure you include a colon – so it should read *|DATE:|*
Similarly for the *|ELSE:|* tag
Lovely!
My adress get’s displayed incorrect in the footer of the email:
Our mailing address is:
company name
P.O. Box
City
City, State, Postalcode
It repeats the city and sets the postalcode at the wrong position. How to solve this?
[...] update your customers’ data (like purchase history, product alerts, etc), then use our advanced merge tags in your campaign to insert dynamic content for each recipient. If you take a moment to think about [...]
Can the advanced merge conditional statements be nested?
Are regular expressions supported by any chance?
@Nima – Yes, conditional statements can be nested. Please make sure you run lots of test campaigns to make sure that it’s all working (and looking) the way you want. No, regular expressions aren’t supported. As you may have already guessed, our approach is to leave the super-advanced stuff out of “MailChimp Proper” to keep it simple on the front end. Then, we program functionality into the MailChimp API for our super advanced users. You may want to look into a way to handle all your dB manipulation and segmentation on your end, then use the API to sync recipients over for each campaign. And if you need any developers with MailChimp API experience, check out the MailChimp Experts Directory: http://blog.mailchimp.com/experts/
Hi there, I’m trying to build an rss-to-email template for a client and want to show the previous day’s posts in a grid format (there are about 12-15 posts per day). I’m using a s (3 per row) and need to insert a after every third .
Is it possible to have some kind of counter using the merge tags?
@Jack – I asked our programmers, and they say what you’re attempting to do is not possible right now. There might be a way to do it later, as we expand on our merge tags to work like more of a programming language (something other advanced users have been asking for).
Will the conditionals parse correctly for HTML code? For instance, on EmailVision we set up conditionals in order to use the same email template for multiple brands.
If our lists have a field for a specific SITE, would MailChimp process this correctly?
*|IF:SITE=SITE1|*
style=”color: blue; font-weight: bold;”
*|ELSEIF:SITE=SITE2|*
style=”color: red; font-weight: normal;”
*|ELSE:|*
style=”color: yellow;”
*|END:IF|
I have a single master list, with a custom “interests” field for segmentation. I want to allow users to optin to different interests from different areas of my site. Problem is, if they try to optin via a subscribe form, but they are already on the list, they get a plain “email address already exists” error, with no indication that they should Update their profile to add the new interest. I was wondering if these conditionals can be used to trap for that error on the SignIn form, then direct them to their update page as an option.
I tried a test but was unsuccessful.
Thoughts?
Yes, I distinctly recall another user asking us for this in a different (and angrier) way. Thanks for taking the time to submit this. I’ll scrounge up the details from the last request and post it to our internal wishlist.
I have almost the same requirement. I want to let registered visitors indicate an interest in any one of dozens of subject areas, i.e. a checkbox at each area that allows the visitor to express an interestin updates. Then, when I send out an email they only get the content for that subject area if they have indicated interest. Can we do this?
__ Keep me informed about X
Ivan, it kinda sounds like you’re asking for list segmentation? Check this out: http://blog.mailchimp.com/segmentation/
If that’s not what you mean, try asking the support team. If you can give them a specific scenario, they’ll probably be able to point you in the right direction.
http://blog.mailchimp.com/support/
hi,
we are using the mailchimp API. sometime soon, we want to start sending out more customized emails i.e not just making the names be variable and if/else conditions but actually, based on person’s preference and past behaviour ( of CTR, etc ), decide the content of the email i.e the logic on our end. In a certain way, we want to segment users but have a segment/bucket of 1 user each. How would we do that and the best way to do that ?
Ashish,
At the present time the dynamic merge fields only refer to values within a profile. If you wanted to include previous action such as subscribers who have clicked or taken some other action, then you’d need to add this information to the subscriber’s profile.
For instance you could have a field called “recent purchase”. Then you can update your list for each relevant campaign and update the value in the “recent purchase” field. You could insert a date value or just a yes/no value depending upon how you want to filter. Then you can use the *|IF:RECENTPURCHASE|* check to determine whether or not to place in your dynamic content.
Is it possible to do something like *|IF:EMAIL CONTAINS ‘aol’|* blah *|END:IF|*
Hi,
I am trying to add conditional, but cannot get it to work when I preview and use “view live merge”.
Here is the piece of logic in my email, and the preview always take the “ELSE IF” section in preview.
*|IF:MMERGE5=Finland|*
Get Starterguide for Finland in Finnish
Get Starterguide for Finland in English
Get Starterguide for Finland in Swedish (coming soon).
*|ELSEIF:MMERGE5=Poland|*
Get Starterguide for Poland in Polish (Not yet available)
Get Starterguide for Poland in English
*|ELSEIF:MMERGE5=Denmark|*
Get Starterguide for Denmark in Danish (Not yet available)
Get Starterguide for Denmark in English
*|ELSE:|*
Please get the Starter guide in your preffered language in backoffice documents section.
*|END:IF|*
Hopefully you can see what is is wrong, and how to fix it. My “MMERGE5″ is Country , and in the list manager I have : “Finland, Denmark, Poland”.
Thanks,
Peter
I am having the same issue, but can’t see anything wrong with either of our codes…
Have you had any further luck?
Hi,
I wanted to display information only if a user has a certain value for multiple merge fields. Is it possible to have nested IF statements, or to use AND within one IF statement?
I’m thinking something like:
*|IF:MERGE_1=0|*
*|IF:MERGE_2=0|*
*|IF:MERGE_3=0|*
Text to show would go here
*|END:IF|*
*|END:IF|*
*|END:IF|*
or something like this:
*|IF:MERGE_1=0 && MERGE_2=0 && MERGE_3=0|*
Text to show would go here
*|END:IF|*
All best,
Morgan
The ability to target based on interests is great, but is there a condition for is not interested.
For example,
*|INTERESTED:Hawaiian Shirts|*
Hawaiian Shirts Special Feature Content
*|END:INTERESTED|*
bunch of regular email content goes here
*|NOTINTERESTED:Hawaiian Shirts|*
Regular hawaiian shirt content goes here, but we didn’t want to include this if we had already included the Hawaiian Shirts Special Feature content as it would be somewhat duplicative
*|END:NOTINTERESTED|*
I realize you can do nested Interested Statements with ELSE’s, but it becomes too complex & the logic starts becoming hyper-nested to solve a simple problem.
If there isn’t an ability to do Not Interested, PLEASE consider adding it.. This works great for MERGE fields.. just need the same functionality for interests.
Thanks!
Is it possible to use the API or advanced merge tag feature to allow for an email that displays product based on previous purchase history? I know this would be fairly customized but we’re looking at some various solutions that might allow for this sort of dynamic email marketing.
Hi Stu, I believe it’s possible. The scenario would be that you handle all the “previous purchases, and what to recommend” stuff on your side, then pass over content to MailChimp for delivery.
Thanks Ben. Each of our product sku’s contains a category number so could we create a merge scenario that would be something like….If purchased product, (which would be a field in the list data base) contains “product id #X, then display this image. My question really is when using dynamic content can the merge be designed so the results are based on if the list field contains as opposed to if the list field is. If that can be accomplished then this should work and we;d assign text and image based on product category. Hope that makes sense.
Thanks for your help…
@Stu – I don’t think the “if contains” is possible with our current merge tags. Only if-equal. That’s the kinda logic you’d need to pre-process on your end, then you could pass all appropriate fields over to MailChimp via the API.
I could be mistaken. If so, the nerds here (apparently) monitor my comments, and always jump in to correct me when I say something wrong. Which is quite often.
Ben,
I had asked Bill about something similar in chat & I think we had determined it wouldn’t be possible because this would amount to a unique email for each contact. We had thought about doing this via a unique RSS feed for each contact. We would be very interested if you could elaborate on possible approaches to this. Our only thought here was to use dynamic merge tags to pass a unique ID to a script on our web server that served up an image dynamically for the customer & pass the same unique ID to the target URL, which would then generate the recommendations page. We’d love to include more robust content in the email itself though.
Thanks
Thanks Ben and Rusty. I was hoping to find a solution that wouldn’t involve my IT guy. Yes Rusty, in response to your comment
<>
That is exactly what we’re trying to do. If we get further along I will certainly post here, thank you both for your help.
Hi,
i’ve in my signupform something like this
Title (with checkboxes Mr. & Mrs), then firstname & lastname.
In german i need two different salution if is a man or a woman
Sehr geehrter Firstname Lastname (Men)
Sehr geehrte Firstname Lastname
How can i relize it?
Thanks
Max
I show you 2 screens, at this adress:
http://www.0815ag.de/bilder/chimp/first.jpg
http://www.0815ag.de/bilder/chimp/second.jpg
Is it possible to use these merge tags to create a customized hyperlink for each recipient? Or is there another way to track which recipients click on a hyperlink in an email?
Lisa, you could use the optional AIM Reports add-on to see who clicked on which links:
http://blog.mailchimp.com/add-ons/aim-reports/
I’m trying to alter the “final welcome email” based on the current month. We offer a different special each month. The *|IF|* conditional doesn’t seem to play nicely with *|DATE:|*
Here’s an example of what I’m trying to do:
*|IF:DATE:m=10|*
October Special
*|ELSEIF:DATE:m=11|*
November Special
*|ELSEIF:DATE:m=9|*
September Special
*|ELSE:|*
Generic Special
*|END:IF|*
All I end up getting is the “Generic Special” text regardless of how I modify the Date in the If tag.
Any thoughts?
Ken, I’m trying to do a similar thing with IF:DATE:N for days of the week.
I can’t even get my ELSE condition to evaluate!
Any luck with getting your date based IF statement to work? I posted about mine here: http://jungle.mailchimp.com/forum/topics/if-statements-based-on-date
I am planning on using RSS to create campaigns. My question is how to I using merge tags pick up and display specific XML rags from my feed beyond what the cheat sheet shows. eg if my feed has a field called longdescription. How can I used that?
I would like to merge individual images, each image is the name of the receiver, can I merge those pre-generted image in any way, I have a field in the databse with the correct image filename.
Yes. Just upload the images to your server (loading into your MailChimp image gallery might work too, but I’m not sure if the filenames get altered when you do that, so test test test). Let’s say you have photos of sales reps, like bob.jpg, mary.jpg, and rob.jpg. In your newsletters, each subscriber/customer should see a different picture of their sales rep. Your database needs a column like “sales_rep” and the names of sales reps would go there (bob, mary,rob). The merge tag for that dB column would be *|SALES_REP|*
in your email newsletter, wherever you want the photo to show up, you’d code your image tag like this:
img src=”http://www.example.com/images/*|SALES_REP|*.jpg
That’s how it works in concept. It’s been years since I’ve actually tried this, and our functionality has changed a lot since then. But i’ve seen people doing it, so I know it still works. You might just have to tweak a few steps there.
Hi,
is it possible to customize also the Object field of the email (putting “Good morning Mr. XXX” in the Object and not just in the content of the email)?
Thanks,
Marco
Marco – Do you mean “subject” of the email? If so, then yes. But test first! If you actually meant “object” then I’m not sure what you mean.
Ben,
One of my email newsletter is showing RSS items via feed properly. But when i published an article which doesn’t have an image there is a blank image showing up. Can we set a condition prior to |RSS:ITEM:ENCLOSURE_URL|.
I want something like this:
*|IF:RSSITEM:ENCLOSURE_URL|* show image in image src filed as *|RSSITEM:ENCLOSURE_URL|* *|END:IF|
Is it possible? i dont’ see this supported in your forum and other blog posts.
Sorry to bother you but the documentation is not good, you have simply given http://blog.mailchimp.com/resources/merge/ link and left everything else for the imagination. I think you should create more precise documentation like php.net or msdn.
Hey, that’s what feedback is for! Thanks! We’re working on a completely new knowledge base at the moment. Once that’s done, we’ll move into tutorials and more detailed documentation. Seeing actual use-cases from customers helps tremendously.
Are there rules for the value attributes in *|IF:MERGEXX=VALUE|* I see all those examples being single strings, no spaces, not quoted. Is that the rule?
I ask because I’m trying to figure out why
*|IF:CITY=New Liskeard|* (or similar) isn’t working.
cmkl
I have two groups for my list. “I’m also interested in…” and “Events Attended.”
Under Events Attended I have many groups titled, “Board and Staff”, “Event 1″, “Event 2″, etc.
I’m trying to do a conditional statement and can’t get it to work:
*|INTERESTED:Board and Staff|*
You have attended a Board and Staff event
*|END:INTERESTED|*
What am I doing wrong?
Hi!
When I use the Merge tags for facebook and twitter, my links for those 2 turn blue, instead of the color that I have designed for links. It looks fine in the pop up preview but is blue in g-mail, hotmail and yahoo. Please help!
Is it possible that they’re a different color because they’re visited links (i.e. links you’ve already visited in that browser )?
I’m having the same problem – the two links that get inserted in my footer via merge tags show up as the default blue because the css specified for my footer links don’t get inlined on those two anchor tags.
Anyone have a way around this?
We use a separate field for the preferred language of the client, and create conditional mails delivering English, German, or Spanish text to the appropriate receiver, using merge tags (we have in-house translators for all texts, so we don’t use the automatic translation functions)
Example *|IF:MERGE6=ES|* Spanish mailing text blah blah blah… *|END:IF|*
The problem we have is that our lists are updated from a number of sources – Social netwoking sites, our own signup forms and CRM systems. Each may represent the language as “en”(lowercase) or “EN” (uppercase).
Rather than sort all of that out in every system, I’d like to know if there is a way to combine conditional tags with formatting tags such as:
*|IF:UPPER:MERGE6=ES|*
I tried it but it didn’t work. Is there a better way?
Hey. Is there any way to run more complex ‘interests’ conditions for dynamic content? i.e. at the moment I notice that you can show particular content for those who are interested in Interest 1 OR interest 2 by using -*|INTERESTED:Interest1,Interest2|*
But can you show particular content for those who are interested in Interest 1 AND Interest 2?
Can you go even more complex than this and run a condition like – Interested in Interest 1AND Interest 2 OR Interest3?
Take a look at the IF:INTERESTED dynamic merge tags over at: http://blog.mailchimp.com/merge/
Is it possible to do something like *|IF:EMAIL CONTAINS ‘aol’|* blah *|END:IF|*
How can i do this?
This is the same question as Stephen in this post.
Hmm, to be honest, I’ve never tried. I doubt we set it up to work that way, but you could always run a small test to see for yourself. Plug in the code, then do a pop-up preview. In the bottom of the pop-up window, you’ll see a button to “preview merge tags” for each recipient. You’ll see if the merge tags perform the way you want.
I do know that it’s something you can do in the segmentation options, whenever you specify a list. We let you segment by “if email address contains” there.
Is there any way to bring in data from another source (i.e. our shopping cart database) and include that data as a mergefield/tag in our mailchimp newsletters?
I have been sending out newsletters with First / Last Name personalisation but for customers where this information is missing in the subscriber list outlook breaks their email. There is an option to add a predefined value so that if the first/last name is missing it puts in the set predefined value (ie. Customer) but only for mailchimp template forms.
Can I set predefined values for the First Name and Last Name fields when in ADVANCED mode?
Working to set up dynamic content/merge tags based on data customers provide… Do I need to have fields for all data in the sign up form?