Mailchimp + Magento: How to get autoresponders working with the API

Just a quick little how-to on Mailchimp and Magento using the existing extension by Ebizmarts. We want to be able to send customers who sign up for the newsletter through the Magento store a little thank you gift (discount code) X days after signing up using Mailchimp’s excellent autoresponders. This is supported by Mailchimp, but requires double opt-in or the following little 2 step work-around with the Mailchimp API.

For this I’ll assume you have got as far as the Mailchimp list being populated when a Magento customer subscribes, and removed when they unsubscribe. This will require a little modification to the Magento and Mailchimp integration, so only proceed if you’re comfortable with that.

Step 1: Configure your Mailchimp list to have a pseudo sign up date

This is mentioned in the Mailchimp support section, but I’ll quickly add my notes here for completeness.

Go into the lists section and select the forms link for the particular list you are adding emails to from within Magento. From the forms page you can add a new date field that looks something like this:

Field Settings for a new sign on date field

Field Settings for a new sign on date field

Note that whatever you choose for the field tag e.g. SIGNON on this screen needs to match what you use in the code change I’ll show you in step 2. What a perfect segue….

Step 2: Modify the Mailchimp extension (ever so slightly)

The code change is very minor, and assumes you always want to add this Merge var – so it’s not very elegant. In fact it’s arguably a hack, but I haven’t posted one of those for a while so here goes. Modify the file app/code/local/Ebizmarts/Mailchimp/Model/Mailchimp/Mailchimp.php around line 114 so that it looks like this:

if ( $this->getXMLSubscribeConfig('opt-in') != '' ) {
	$merge_vars['OPTINIP'] = $this->getXMLSubscribeConfig('opt-in');
}
// Add this line - be sure you match 'SIGNON' here with the code you chose in Mailchimp...
$merge_vars['SIGNON'] = date("Y-m-d"); // today's date
try {
	$apikey = $this->getXMLGeneralConfig('apikey');

Right so with that change, your Mailchimp list will now get a new variable populated which can in turn be used as a date for the autoresponders within Mailchimp like so:

Set the autoresponder to use the new date you added in Step 1.

Set the autoresponder to use the new date you added in Step 1.

Interestingly this same approach can be used to add all sorts of useful information gained from Magento into your Mailchimp list e.g. Source of visit CPC/Organic etc.

Note: this code change will go away if you upgrade the Mailchimp extension – maybe someone will make this part of the extension so that it is less prone to being hosed by upgrades. Until then, beware.

You might also be interested in:

  1. Using Gmail or Google Apps email with Magento
  2. New feature for Magento Gmail or Google Apps Email Extension
  3. 3 easy steps to add products to the Magento Home Page (or any CMS page)
  4. SMTP Pro Magento extension, free and open SMTP support for Magento
  5. Removing the Compare function in Magento, the easy way


Tagged as , , + Categorized as Magento, PHP, Web Development

2 Comments

  1. I have been using campaign monitor….got it working but it seems a bit limited…have not tried it yet with 1.4…mainly i am using it because its pay per use…is MChimp way way better?

  2. Tough call on the Campaign monitor vs Mailchimp. I think there is a pay-per-use account for Mailchimp too – I haven’t used Campaign monitor, but do recommend Mailchimp to people. We use it for email marketing for several of the suppliers we represent in the US and have no complaints about the reliability or reporting they offer.(they should send me a t-shirt shouldn’t they…).

    I will be adding more autoresponder support for Magento in the future, particularly around soliciting product reviews/order feedback from customers 1-2 weeks after the order ships. Does Campaign monitor offer anything like that?

Leave a Comment

Name:

Email:

Website:

Sporadic Tweeting...

  • New Post: Why I don’t use Flash, ever (and neither should you NZ Herald): Seriously, just don’t do it – I think I’... http://bit.ly/c9p3p9 1 week ago
  • New Post: A new ASchroder.com for 2010 or, why I haven’t written anything for a couple of weeks…: Tonight I releas... http://bit.ly/91NeAk 1 week ago
  • Don't skip the last session. One of the best is last at #irwd Stephan Spencer was insightful last year. Highly recommended. 3 weeks ago
  • More updates...

What I'm listening to

  • The xx - xx
  • Mos Def - The Ecstatic
  • Phoenix - Wolfgang Amadeus Phoenix
  • Jane's Addiction - Nothing's Shocking
  • Florence + The Machine - Lungs
  • Vampire Weekend - Contra
  • The Temper Trap - Conditions
  • The White Stripes - De Stijl
  • Grizzly Bear - Veckatimest
  • Passion Pit - Manners
  • Everclear - Sparkle And Fade
  • Lisa Crawley - Hello, Goodbye and Everything Inbetween