Add a blog commenter to a MailChimp list

If you have a mailing list or newsletter you want to take every opportunity to encourage people to join it. Did you know that by using the Perch MailChimp Add-on you can give blog commenters the chance to join your list when leaving a comment?

This tip takes advantage of the fact that with Perch 2.3.4 you can submit a form to more than one app. You will need to have Perch Blog and Perch MailChimp installed.

Step by Step

Add perch_mailchimp to the app attribute of perch:form and also add the attributes detailed in the Perch MailChimp docs for whether or not you want a double opt-in and welcome email.

<perch:form id="comment" method="post" app="perch_blog perch_mailchimp" 
class="comment-form" action="<perch:blog id="postURL" />" 
double-optin="true" send-welcome="true">

For a user to be added to a list they should opt in. So we will add a checkbox to enable them to confirm they want to subscribe, only commenters who check this will get pushed to MailChimp.

<perch:input type="checkbox" value="1" id="confirm"
 mailer="confirm_subscribe" />

That’s it. As long as your list is set up in the MailChimp App your commenters can become list subscribers by checking a box.

This would work in the same way for the Perch Comments App. You could also make use of this ability to post to two Apps yourself if you need to get data into some other system. Your app could potentially just be a script that sent the data somewhere.