How to Show Your MailChimp Subscriber Count in WordPress

Do you want to display your MailChimp subscriber count? Recently one of our users asked us how they can show their MailChimp subscriber count in WordPress. Displaying social proof encourages other users to join your newsletter. In this article, we will show you how to… Read More »

To leave a comment please visit How to Show Your MailChimp Subscriber Count in WordPress on WPBeginner.

Do you want to display your MailChimp subscriber count? Recently one of our users asked us how they can show their MailChimp subscriber count in WordPress. Displaying social proof encourages other users to join your newsletter. In this article, we will show you how to show your MailChimp subscriber count in WordPress.

MailChimp is one of the most beginner friendly email marketing service provider. If you are not already using MailChimp, then check out our guide on using MailChimp with WordPress.

We will be showing two different methods to display MailChimp subscribers count. The first method is easier and requires you to install a WordPress plugin. The second method is more advanced where you will need to create a plugin based on different source files. If you are not comfortable with editing code snippets, then we will recommend you to use the first method instead.

Method 1: Using MailChimp Subscriber Chiclet Plugin

First thing you need to do is install and activate the MailChimp Subscriber Chiclet plugin. Upon activation, visit Settings » MailChimp Subscriber Chiclet to configure the plugin.

MailChimp Subscriber Chiclet Settings

First you will need to enter your MailChimp API key. If you haven’t created one, then you can login to your MailChimp account dashboard and get one.

Getting API Keys for your MailChimp account

After entering your API key click on the Save Changes button. The plugin will then load your email list from your MailChimp account. Select your email list and configure the plugin settings.

Once you are done, simply copy the shortcode from the bottom of the plugin and add it to any post, page, or text widget where you want to show your subscriber count.

Preview of Mailchimp subscriber chiclet plugin

Method 2: Getting Subscriber Count Using MailChimp API

As you would notice that using the plugin method you get your subscriber count with a powered by MailChimp logo. Many users would just want to get the number so that they can use it with their own email signup forms.

In this method we will be creating a plugin. This plugin will use MailChimp’s API to get subscriber count. You will be able to display the subscriber count anywhere you want using a shortcode.

Step 1: First thing you need to do is to create a folder on your desktop and name it mc-subscriber-count.

Step 2 Inside the folder create a new file and name it mc-subscriber-count.php and paste this code inside it.

Important: Don’t forget to replace Your_MailChimp_API_Key with your actual MailChimp API Key.

<?php
/*
Plugin Name: MailChimp Subscriber Count
Plugin URI:  http://www.wpbeginner.com
Description: Retrieves MailChimp subscriber count and displays it as a text
Version:     1.0
Author:      WPBeginner
Author URI:  http://www.wpbeginner.com
 */
 
function wpb_mc_sub_count() {  
include "Mailchimp.php";
$lastRunLog = 'logs/lastrun.log';
$subfile = 'logs/subcount.log';
$lastRun = file_get_contents($lastRunLog);

if (time() - $lastRun >= 86400) {

$MailChimp = new MailChimp('Your_MailChimp_API_Key');
$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'); 

 ?>

Step 3: Inside mc-subscriber-count folder create another folder and name it logs. Inside the logs folder create two blank files using a plain text editor like Notepad. Name one file lastrun.log and the other subcount.log.

Creating log files

Step 4: Download the MailChimp PHP Wrapper source code from MailChimp repository. Download link is located at the bottom in the right hand column.

After downloading, you need to extract the zip file. Inside the extracted folder, you will see a folder src containing Mailchimp.php file and Mailchimp folder.

MailChimp API Files

Step 5: Copy and paste Mailchimp.php file and Mailchimp folder to your plugin folder.

Final plugin file structure

Step 6: Upload mc-subscriber-count folder to /wp-content/plugins/ folder on your website using an FTP client.

Step 7: Visit the Plugins page on your WordPress admin area and activate MailChimp Subscriber Count plugin.

Step 8: Use shortcode [mc-subscribers] to display MailChimp subscriber count in any post, page, or text widget in WordPress.

We hope this article helped you show MailChimp subscriber count as text on your WordPress site.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

To leave a comment please visit How to Show Your MailChimp Subscriber Count in WordPress on WPBeginner.

Ultimate Guide to Using MailChimp and WordPress

Are you looking to build an email list? Want to send email updates to your subscribers when you publish a new blog post? MailChimp is one of the world’s leading email service provider, and it is extremely easy to use. In this guide, we will… Read More »

To leave a comment please visit Ultimate Guide to Using MailChimp and WordPress on WPBeginner.

Are you looking to build an email list? Want to send email updates to your subscribers when you publish a new blog post? MailChimp is one of the world’s leading email service provider, and it is extremely easy to use. In this guide, we will show you how to use MailChimp and WordPress to get more subscribers.

MailChimp and WordPress

Why Build an Email List?

More than 70% of users who abandon your website will probably never come back unless they buy something from you, or you successfully get them to subscribe to your email list.

Email is private, personal, and by far the most direct form of communication on the internet. Most people check their inbox more than their social media streams. An email will stay in the inbox unless a user takes action on it. On social media, your message will get buried into user’s timeline.

See our guide on why you should start building your email list right away.

Why Use MailChimp with Your WordPress Site?

Over the years, we have found MailChimp to be one of the most beginner friendly email service. Why? Because it’s very easy to use and has tons of WordPress integrations.

It is also by far the most affordable for beginners because it is free as long as you send less than 12000 emails per month or have less than 2000 subscribers. This means you can get started right away without paying anything.

Now as your subscribers grow (more than 2000), you will be asked to upgrade your account to paid plan.

Aside from just capturing and sending emails, some other cool features of MailChimp allows you to setup RSS to email subscriptions, design beautiful email templates, set up auto-responders, and monitor the performance of your email campaigns with comprehensive analytics reports.

Getting Started with MailChimp

To connect MailChimp to your WordPress site, the first thing you will need is a MailChimp account.

Visit the MailChimp website and click on the ‘Signup Free’ button.

Fill in your email and create a username / password for your account.

MailChimp Sign up

Once you are signed in, you will be redirected to your MailChimp dashboard.

Creating Your First Email List

The first thing you need to do in your MailChimp account is setup an email list. On your MailChimp dashboard, click on ‘Create A List’ button.

Creating an email list in MailChimp

You will be asked to provide information like the name for your email list, an email address where users can reply to, a reminder for people how they got on your list, etc. Fill the form and click on the Save button.

That’s all, you have successfully created your first email list. Now you need to connect your email list to your WordPress, so your website visitors can subscribe.

Adding MailChimp Email Signup Forms in WordPress

MailChimp comes with a built-in basic subscription form. All you need to do is go to the Lists page in your MailChimp account. Next click on the downward arrow button next to your email list and select sign up forms.

Getting signup form code from MailChimp

On the next page, you will see some of the form types you can generate. You need to click on the select button next to Embedded Forms.

Select embedded forms

You will be taken to a settings page where you can choose what fields you want to show in your form, adjust form width and other options. When you are done, simply copy the embed code.

Copy the signup form embed code from MailChimp

Now you need to visit your WordPress admin dashboard and click on Appearance » Widgets. Add a Text widget to a WordPress sidebar and paste the signup form code inside it.

Adding signup form code in widgets

That’s all. You can now visit your site and see the MailChimp signup form in action.

MailChimp email signup form

Adding Beautiful Signup Forms Using OptinMonster

While adding a basic MailChimp signup form in WordPress is quite easy, but getting people to join your email list is not. At WPBeginner, we use OptinMonster to build our email list. You can read all about it in this case study where we increased our email subscribers by 600% using OptinMonster.

OptinMonster allows you to add different kind of signup forms such as lightbox popup, floating footer bar, after post forms, sidebar forms, slide-in forms, and more.

You can do A/B testing, page-level targeting, choose from many different templates, and even use exit-intent.

Exit popup in OptinMonster

We built OptinMonster because we needed a WordPress lead generation solution that is easy to use and deliver results.

OptinMonster works with all major email marketing providers including MailChimp.

Setting up WordPress RSS Feed Newsletter in MailChimp

Now that you have visitors subscribing to your email list, it is important that you send them regular updates.

You can always login to your MailChimp account and manually send an email to your subscribers, but with MailChimp you can also setup automated campaigns that send your latest blog posts via email. This is called a RSS newsletter. (See our guide on RSS Feeds in WordPress.)

If you have been using FeedBurner to send emails to your RSS subscribers, then you need to read why you should stop using FeedBurner and move to Feedburner alternatives. It also shows how to move your FeedBurner subscribers to MailChimp.

To setup an RSS to Email campaign, first you need to login to your MailChimp account and then click on Campaigns » Create Campaign.

Creating campaigns in MailChimp

On the next page, MailChimp will show you different type of campaigns you can create. You need to choose RSS-Driven Campaign.

Creating RSS campaign in MailChimp

Enter your RSS feed URL and select when you want to send the automated email. You can send daily, weekly, or even monthly emails. You can also choose the time for your email. When you have picked your settings, click on the Next button at the bottom right corner of the screen to continue.

Enter your RSS feed URL and select email time and frequency

MailChimp will now ask you to select a list. Select your list and click on the next button to continue to the campaign info.

First you need to provide a name for your campaign. After that you will notice that MailChimp has automatically filled in most of the fields for you. These default settings would work for most websites. However feel free to customize it to fit your needs. Click on the Next button to continue.

RSS Email campaign setup

In the next step, you will need to choose a template for your email. MailChimp comes with many different options for that. Choose the one that best suits you by clicking on the select button next to it.

Choosing MailChimp RSS newsletter campaign template

MailChimp will allow you to fine-tune your email design. You can add your logo, a header image, change the text to your own site’s requirements. Mainly you need to add RSS Header and RSS Items box to your email template.

Design RSS Email

Click on the next button when you are done. Lastly click on Save and exit at the top right corner of the screen.

That’s all you have successfully created your WordPress RSS Feed Newsletter with MailChimp.

We hope this article helped you learn how to use MailChimp with WordPress. Now that you have started building your email list, you may want to take a look at our guide on how to grow your email list.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

To leave a comment please visit Ultimate Guide to Using MailChimp and WordPress on WPBeginner.