How to Show Your MailChimp Subscriber Count in WordPress

Posted by Eyden Haze . on January 11, 2016

MailChimp is one of the best e-mail marketing solutions. Once you have installed it in your WordPress website, you would want to keep an eye on your subscribers to do all the data analysis and number crunching. Not only the analytics, you can show it as a social proof to your visitors to attract more subscribers. Humans have the habit of following what the majority is doing. If a visitor reads a specific post which has no subscribers he/she would not be motivated enough to subscribe to it. And if we take another scenario where the post has, say 20,000 subscribers then your visitor would want to know why so many people are subscribing to it and hence, he/she would subscribe to your post/page. Hence, the subscriber count plays a vital role in converting business.

MailChimp Subscriber Count

All in all, whatever reason you have for displaying your MailChimp subscriber count in WordPress, we have the apt solutions for it. You can either choose an existing plugin for it or create your own plugin. If you are not a developer the former way is better for you and if you want to write all the code yourself and do not want to use any other plugin, then you can go with the second way. Like, everything has an easy way and a difficult way but you need to choose one according to your preferences.

1. MailChimp Subscriber Chiclet

mailchimp-subscriber-chiclet

The easy way is to install MailChimp Subscriber Chiclet plugin in your WordPress. Once the installation is complete, you need to activate the plugin. Go to Settings and click on MailChimp Subscriber Chiclet for configuration. You will be asked to enter your MailChimp API key. Enter the key and in case you do not have it, then login to your MailChimp account and get the API key.

After entering the API key, click on Save Changes button. Your email list will be loaded from the MailChimp account. Now, you need to select the email list and then start configuring the plugin settings. At the bottom of the plugin, you will see a shortcode. You need to copy that shortcode and then add the same to any post, page or widget where you want to display the subscriber count. It was a much simpler way than the next one which is done the developer’s way. If you do not understand the code snippets and all the techy-stuff, then you should stick with this option only.

2. MailChimp API:

The other way to display the MailChimp Subscriber count on WordPress is by using the MailChimp API. When you display the subscriber count using the MailChimp Subscriber Chiclet, you will notice that under the count it is written ‘Powered by MailChimp’. The users might want to see just the count, so you can create your own plugin and here is how:

  • Create a folder on your desktop which should be named as mc-subscriber-count.
  • Now in that folder, create a file named mc-subscriber-count.php. In this file copy the below written code:

$mc = $MailChimp->call(‘lists/list’);
$subscriber_count .= $mc[data][0][stats][member_count];
file_put_contents($lastRunLog, time());
file_put_contents($subfile, $subscriber_count);

} else {

$subscriber_count .= file_get_contents($subfile);

}

return number_format($subscriber_count);

}

add_shortcode(‘mc-subscribers’, ‘wpb_mc_sub_count’);
add_filter(‘widget_text’, ‘do_shortcode’);

?>

  • Now inside the same folder create a new folder named as logs. Inside the logs folder, create two files using a text editor such as Notepad. Name one file as lastrun.log and the other one as subcount.log.
  • After that, download MailChimp PHP Wrapper source code from MailChimp repository. When you have downloaded the zip file, extract the files from it. In the extracted folder, there will be a src folder which will have Mailchimp.php and Mailchimp folder.
  • Copy these two files and paste them in the folder that you created in the very first step.
  • With the help of an FTP client, upload the entire mc-subscriber-count folder on your WordPress site.
  • Go to your WordPress admin dashboard and in the plugin settings, activate MailChimp Subscriber Count Plugin.
  • Now use the shortcode: mc-subscribers in any post, page or widget to display the subscribers count.

01-api-key

Clearly there is more effort in the second way, so you always have another option to go by which is the first one. However, in both of the above described methods you would need the MailChimp API key. So, make sure you have the API key beforehand. You can choose either of these and get the subscribers count on your WordPress site.

Author Bio:

Nirdosh has a knack for exploration and loves to dig into WordPress, and share her knowledge with others. She is currently working with WP Daily Themes. She is also a programmer, a writer and a motivational speaker.

Leave a Comment

Your email address will not be published. Required fields are marked *