mailchimp-anatomy

We just kicked off our blog notification campaign this past week. Maybe you are even reading this because of that email! As is often the case, while building out this campaign, I stumbled on several hurdles to creating what I thought would be the best experience for our readers (You!). There are a lot of important questions to ask yourself as you put together an email campaign, even if it’s just for a blog notification. This article will walk you through the process I went through in building out our Article Notification email Campaign.

What I realized in building this out is that creating custom bold and striking pixel perfect blog notifications in MailChimp — while totally possible — is not as straight forward as I imagined. MailChimp’s great strength is just like WordPress’. It gives you the ability to put up a simple and nice looking email campaign without much skill or code needed at all. Those are great. But as soon as you want to do a bit more complex stuff, it takes quite a bit of creativity and dedication and a bit of thinking outside the box. But the good news is that it’s totally possible.

So here’s the overview of an Advanced MailChimp RSS Feed:

This is an RSS-Driven Email campaign. This means that an email is populated automatically based on our blog’s RSS feed. Every weekday when MailChimp scan’s our site and notices a new blog post, it populates the email and sends it out to our subscribers. This is one of the major reasons why I love MailChimp, it’s a really powerful and flexible tool.

If you are not familiar with RSS-Driven campaigns, here’s two great resources to get you started. Read these first and then come back:

  • MailChimps “MailChimp for Bloggers” Article is very user-friendly and detailed.
  • WPBeginner has some WordPress-specific info and discusses email groups and lists in detail as well.

OK. With all that in mind, here’s all that went into creating our Blog notification email.

Goals:

For a succinct but effective blog notification email, I wanted to have the following:

  1. Show the three most recent blog posts from our site per email
  2. Have the most recent post be formatted differently for it to have more prominence
  3. Highlight some of our products
  4. Highlight articles from other blogs we like

This makes our blog notification emails fairly robust without being overwhelming. You can take a look at it here (PDF). We wanted this email campaign to be more valuable than simply saying “Hey we wrote something!”

Tools:

So to do all of this, I had to leverage quite a bit more things than I expected. Here’s a quick overview:

  1. Familiarity with MailChimp’s FEEDBLOCK merge tags (see here)
  2. Ability to create a custom WordPress RSS feed (see here)
  3. Do some custom code block within MailChimps templating system (see here)
  4. Integrate the “enclosure tag” into your custom WordPress RSS feed (see here)
  5. Use ChimpFeedr for feed aggregator (see here)

All this together took a full day to figure out and implement. But overall we’re pretty happy with the end result. I definitely didn’t think I’d be digging into customized WordPress RSS feeds when I started mapping out what we wanted for this campaign. Read on and you’ll see why it was necessary.

Dealing with MailChimp’s Lack of an Offset Feature

campaign-headerThe first thing I wanted to do was to be able to highlight our latest blog post, but also link readers to the most recent posts as well. This means the first item in the RSS feed needs to have different formatting than the others. I was certain I’d see email campaigns like that and it seems like a really reasonable idea. But once I started down that path in MailChimp it became clear that it was anything but easy.

Basically, MailChimp doesn’t have any built-in features to distinguish between the first and following articles. MailChimp has these shortcodes call FEEDBLOCK which I thought perhaps I could do two seperate Feed Blocks, one showing the latest formatted differently, then another with an “offset=1” attribute to show the others.

As you can see in the example above, I also wanted that first post to have the full-bleed featured image in it. MailChimp can show images in your articles no problem. There’s also our friend Rob Marlbrough’s handy plugin “Featured Image in RSS w/Size and Position” which I’ve used in a lot of campaigns before. Unfortunately, in this case I need to be able to separate the image from the content in order for it to be the exact width I needed, and Rob’s simply shows the image within the content of the post itself. Further, WordPress’ feeds by default don’t show images at all and don’t separate them in any meaningful way.

So the combination of a lack of an offset, plus the lack of being able to separate the image from the content meant I had to do a custom RSS feed for WordPress so that MailChimp would get the information it needed.

Creating a Custom RSS Feed in WordPress

Here’s the short version of what I did: In order to have the first blog item large, I used MailChimp’s FEEDBLOCK mergetag and pulled only the latest post. But I needed that image too, so I customized our default theme to include the featured image as an “enclosure”. That is the only image type that MailChimp will recognize using WordPress’ RSS 2.0 formatting.

We chose a template in MailChimp that had a full bleed image right at the top. But the problem is that that image is static, not fed from a feed. The whole reason we set up the enclosure RSS feed was to use that image there. So — without getting into too much detail — MailChimp uses global classes to format a lot of the content of these template, including for these images. In the end, I was able to use a custom code block, and the class name that MailChimp uses for the full-bleed image to insert the enclosure image into the template. Here’s the code:

 The Offset Feed

Next, I created an additional custom RSS feed that I called “offset” which pulls all the posts EXCEPT the latest one. This is the feature I wanted MailChimp to do, but it doesn’t. But since I could create that in WordPress, I could point the second FEEDBLOCK mergetag to that feed.

I won’t go into all the details of creating a custom feed. Instead, here’s the two invaluable sources I used to do ours:

One thing you’ll notice when you’re looking at the code in Greg Rickaby’s template is that it’s calling the posts with a simple wp_query and while statement. Because of that, I knew that I could customize the wp_query with an offset to get all the latest blog posts EXCEPT the most recent. You can grab our offset RSS code here.

One important note: if you use “sticky” any of your posts, the offset won’t work correctly. So you’ll want to add 'ignore_sticky_posts' => 1 to your query as well. Thanks to Joey Allam for pointing that out (see his comment below).

Next I needed to add featured images to our default WordPress feed as an RSS 2.0 enclsoure, since that is the image type that MailChimp recognizes as being able to be called separately with a mergetag. There is a plugin that essentially does this, but the Codex explains it perfectly and only requires a custom template and a few lines in your functions.php file, or custom functionality plugin. You can grab our custom RSS feed with enclosure template here.

Whew… all the hard stuff is over now. The rest is really just fun customization.

Advertise Yourself

campaign-adsWhy send an email to your blog subscribers without giving them a little heads up about other parts of your website besides your blog? The MailChimp template we chose had some nicely formatted accent boxes. We used them to give attention to our premium plugins.

Aggregate and Advocate Your Friends

But seriously, there’s a LOT of WordPress knowledge out there. And we love to prop up our friends. But putting together a curated list of posts is time consuming. The best way to get a nice list of relevant content is to aggregate posts from sources you trust. A really easy way to aggregate blogs into one cohesive feed is with MailChimp’s own ChimpFeedr.com service. This will collect all the posts in order of publish date/time into one feed that you can add into your email campaign. Of course, this means that sometimes one blog will be listed more times than others, or one blog doesn’t get listed at all because it hasn’t posted recently or you only list 3 or 4 posts. Regardless, adding a curated list like that to your email campaign shows that you are well connected and just want to help spread the knowledge, not just funnel all your readers just to your content.

You can see the ChimpFeeder Feed we put together here: http://mix.chimpfeedr.com/baa24-wordimpress-friends

Of course, with all that talk about our blog newsletter, now you’re just DIEING to sign-up for it, right? Here is it:

Newsletter Signup

Other Good Examples?

That’s how we put together our blog notification. Are you subscribed to other really stunning e-newsletters? Have you put together something you’re really proud of? Tell us in the comments.

Matt is Head of Support and Community Outreach at WordImpress.com. He's the author of many free WordPress plugins, a popular blogger at his website, an admin of the Advanced WordPress Facebook group, co-organizer of the San Diego WordPress Meetup, and a frequent WordCamp speaker and attender.

Follow Matt:

27 Responses to “Anatomy of an Advanced MailChimp RSS Campaign in WordPress”

  1. Rob from Press Wizards

    Thanks for the shout out and mention of my plugin Featured Images in RSS. I’ll be updating it soon to include the media tags needed for Mailchimp to use the images with their RSSIMAGE tag.

    I think in theory you can create unique RSS blocks using RSSITEM, RSSIMAGE and custom CSS to change the display of each item, but I’ve always just included 3 posts with them all displaying the same ways using their default RSSITEMS tag.

    Bravo for creating a custom feed on the WP side to feature the first one, looks great.

    Reply
  2. Derek

    Which feed did you set as the RSS Campaign feed in MailChimp? I’m trying to pull in three feeds from my site (a single post from one category at the top, all posts minus the category and an events CPT). I can pull them all in via separate FEEDBLOCK tags, but when I have a new post, MailChimp sends everything out even if it’s already been sent out before.

    Thanks for any help!

    Reply
    • Matt Cromwell

      Hi Derek,

      In MailChimp you have to set the whole campaign as a particular feed. So we set ours to our whole blog, which is https://wordimpress.com/feed, but I wrapped that in this Mergtag:

      *|RSSITEMS:[$count="1"]|*

      *|RSSITEM:TITLE|*

      *|END:RSSITEMS|*

      The “count” attribute is what limits the number of items. And this is why I needed to setup the second offset feed, so that the older items could get listed in a different way and I had to SKIP the very first post in that offset feed.

      Hope that clarifies a bit.

      Reply
  3. MySiteNow

    Thank you so much for such a well constructed informative article. This helped me immensely today and saved me hours. Thank you!!! -Jen

    Reply
  4. The Falconer's Wife

    Question – MailChimp states that content that uses Feedblock merge tags cannot be tracked in campaign reports because Feedblock tags are populated after click tracking is applied http://kb.mailchimp.com/merge-tags/rss-blog/add-a-blog-post-to-any-campaign. Does that mean if you use the RSS feature that you can’t track the campaign or see analytics?

    Reply
    • Matt Cromwell

      That’s an excellent question. Looking at our own analytics from our campaigns I would say that any links that you generate in your campaign are definitely trackable, and I see plenty of clicks in our report within MailChimp. I think what they are referring to is any links that are within the content of the RSS content itself will not produce clicks in your report. But, for example, if you look at our last campaign sent out with the exact method this article describes (http://eepurl.com/brUXpr) you’ll see that we don’t have any links within the RSS content at all. Instead, each of them are excerpts of the article with a “Read more” link which we DO get data on.

      So, if you were to do a campaign like this and output your entire article with lots of links inside the email, you probably would NOT get data from the links within the content itself. But since we don’t do that with ours, I can’t speak with certainty, just based on the info you provided.

      Hope that clarifies a bit. Thanks for stopping by!

      Reply
  5. Maham Iqbal

    Hi Matt, I just read your article. I am designing an RSS driven email campaign via mail chimp. I have decided to go with show content excerpt merge tag. The issue is an the end of every excerpt it says: The post “name of the post with a clickable link” appeared first on “name of my website with a clickable link”. I’ve been trying to figure our how to remove this last line but haven’t been able to do so. Can you offer any suggestion to help me fix that?

    Reply
    • Matt Cromwell

      It’s really impossible for me to speak to that with authority. I’d recommend you contact MailChimp support. They’ve always been responsive with me.

      Reply
  6. OverYonderField

    And… how to simultaneously post to Facebook? (sorry!) Regular MailChimp campaigns allow you to choose the image and create the text for sharing with FB and Twitter. I don’t think the RSS campaign allows auto posting to FB, and even if it did, someone would have to pause the RSS before each mailing and set the “Social Card,” and then where would the Social Card image and text come from? Doesn’t seem feasible. We had been using Jetpack’s Publicize to autopost the RSS campaigns to FB, but FB was posting the wrong images, not the one from the post in the feed.

    Reply
    • Matt Cromwell

      Honestly, I never auto-post to Facebook, especially to Business Page. Well… at least never with the FIRST post. Facebook already doesn’t highlight Business pages unless you are paying for advertising, and they also put auto-posted posts far down in the priority list. I personally, don’t find any benefit to auto-posting in general.

      Reply
  7. shehan

    Nerdynaut is an online publishing website. read when you free http://www.nerdynaut.com

    Reply
  8. Joe Allam

    Hi Matt, thanks for putting this post together and offering your code for use as well, it is literally EXACTLY what I am looking to do with MailChimp.

    I am personally having trouble implementing it and have been tearing my hair out over the past few hours. It’s got to the point that I have copied your code with no alterations at all, placed it in the root of my theme and then called it in the functions file with Greg’s code (albeit swapping ‘short’ for ‘offset’). I’ve tested the feed with various readers using the link http://joeallam.co.uk/blog?feed=offset Yet it still shows the very first post.

    I’ve even added TESTING to the item’s title which shows up, so I know the file is being referenced correctly, I just can’t get ‘offset=1’ to work…

    Can I just query what the URL would be for the feed to add into MailChimp? And which directory should the feed-offset.php be located in? I seriously don’t understand how my feed is still working, just without the offset. Thanks!

    Reply
    • Matt Cromwell

      Hey Joe, glad it proved helpful for you overall. I know it sounds crazy, but can you post your whole code in a GIST or something so I can take a look? That’s the only way I can speak with authority on why it would or wouldn’t work correctly.

      Reply
      • Joe Allam

        Hi Matt, I somehow never saw this reply! I’m still struggling with this and came back to your original article. I’ve pasted the code into GIST here: https://gist.github.com/anonymous/83cb6182d40c196d9cdd872abee17137

        Can I just confirm where the feed-offset.php files goes? Is it in the theme directory?

        Reply
        • Joe Allam

          Hey Matt!

          I’ve only just now realised and the reason behind my issues with the offset=1 not working. The problem was my use of “Sticky” posts within WordPress and nothing with the code. It held them at the top of the offset queue, which in some cases messed up the order of things tremendously. For your reference, I’ve fixed mine by changing the query from:

          offset=1

          to:

          ‘ignore_sticky_posts’ => 1, // Puts sticky posts in their normal position
          ‘date_query’ => array( ‘before’ => date(‘Y-m-d’, strtotime(‘-6 days’)) // Ignores posts in the last week, which is the frequency of my Mailchimp campaign.

          Just thought you might be interested in seeing how I solved it. Thanks for getting me most of the way there with it!

          Reply
          • Matt Cromwell

            Oh wow. Great sleuthing, and thanks for circling back with your solution. I’ll mention it in the article.

          • Michael

            Hi Joe

            I like your thinking but am having trouble with the insertion of this code into feed-offset.php. Could you please share the full snippet for ‘query_posts’ and any other code that may be affected?

            Thanks heaps!

  9. Azam Ishaq

    Hi, Matt!
    Your Article is Impressed me but still there is lot of people still wondering for deep details. Many of them are confused between RSS URL, RSS Feed Tag, FeedBlock and Plain Feed.

    Reply
    • Matt Cromwell

      Thanks Azam, there are a lot of resources out there on that. Naturally, one article can’t answer all questions, but — as you can see in the comments — it helps a lot of people who already have some pre-requisite knowledge.

      Reply
  10. Judson L Moore

    I love this post and I reference it often for various projects. The last few days I have been having a terrible time with a weird issue. The enclosure is repeating the same image over and over. So, the featured image from the most recent post becomes the image in the enclosure for all the posts. Any thoughts about what is causing this? I have spent some dozen hours trying to figure it out, flushing caches and hacking the code. The result does not change: http://judsonlmoore.com/feed/offset1

    Reply
  11. Sammy Sickweb

    Thank you for the great information. I managed to get everything to work except the offset rss feed. I’m using the same template that you provided, but for some reason it’s still not offsetting the posts. Any idea what I’m not doing correctly?

    Reply
  12. gdrayson

    I would like to do the same as this with woocommerce products. With your your knowledge gained here, is this something that could be done?

    Reply
  13. Fahad Ullah

    Is there a way we can make the RSS IMAGE follow the URL of the article? Like If someone clicks on the featured image, it takes the user to the article.

    Reply
    • Matt Cromwell

      Yes. You can switch your content editor in MailChimp to show the source code and use normal tags and use the MailChimp MergeTag as the image source, then the post URL as the href source.

      Thanks for stopping by!

      Reply

Leave a Reply