PHP MailChimp Campaign CSV Parser

The MailChimp Campaign CSV Parser is a PHP library to take a downloaded MailChimp Campaign CSV export and parse it in a easy-to-use array. Includes industry rates to compare statistics with.

I’ve worked with MailChimp a lot in past and current projects. My biggest compliant is they’re lack of detailed reports and overly restrictive API usage limits. A common problem I’ve had is extrapolating data from they’re campaign CSV reports — I do this because you can pull more data from the downloaded CSV at one time than the API. A long list of campaign details is useless to marketers if they can’t easy consume, comprehend and make quick decisions off the data. That’s where the MailChimp Campaign CSV Parser PHP library comes in.

Download Now Fork on GitHub

Usage

The MailChimp Campaign CSV Parser PHP library is pretty straightforward to use. All you need is a MailChimp Campaign report that can be downloaded from your MailChimp account under ‘Campaigns‘ > ‘Reports‘.

MailChimp Campaign Report
Download MailChimp CSV Report: Log into your MailChimp account, click ‘Campaigns’ then ‘Export’.

Once you’ve downloaded the CSV report, download the MailChimp Campaign CSV Parser PHP library then initialize and configure the library like below:

/**
 * Include the MailChimp Report Generator class.
 */
require_once( 'lib/MailChimp_Campaign_CSV_Parser.class.php' );

// Initialize the MailChimp Report Generator class.
$MC = new MailChimp_Campaign_CSV_Parser;

// Get data from the MailChimp Report Generator class.
$MC->config['mailchimp_campaign_export_file'] = 'reports/report.csv';

/**
 * Select the industry that relates to the email campaigns
 */
$MC->config['industry'] = $industry;

// Get and parse the first 500 campaigns.
$MC->parse_campaign_export( $limit );
$data = $MC->array;

See the README file for more configuration options. Parsed array includes the following info:

[columns][columns_left]

  • Average Abuse Complaint Rate
  • Number of Abuse Complaints
  • Average Bounce Rate
  • Number of Campaigns
  • Number of Clicks
  • Report End Date
  • Number of Forwarded Opens
  • Number of Hard Bounces
  • Highest Campaign Abuse Complaint Rate
  • Highest Campaign Click Rate
  • Highest Campaign Open Rate
  • Industry Statistics
  • Lowest Campaign Abuse Complaint Rate
  • Lowest Campaign Click Rate
  • Lowest Campaign Open Rate
  • Number of Opens
  • Number of Recipients
  • Number of Soft Bounces
  • Report Start Date
  • Number of Successful Deliveries

[/columns_left][columns_right]

  • Number of Times Forwarded
  • Number of Total Bounces
  • Number of Trashed/Marked Spam
  • Average Unique Click Rate
  • Number of Unique Clicks
  • Average Unique Open Rate
  • Number of Unique Opens
  • Average Unsubscribe Rate
  • Number of Unsubscribes
  • Highest Campaign Unsubscribe Rate
  • Lowest Campaign Unsubscribe Rate
  • Highest Campaign Trashed/Marked Spam Rate
  • Lowest Campaign Trashed/Marked Spam Rate
  • Number of Days in Report
  • Campaigns by Date
  • Campaigns by Subject
  • Campaigns by Title
  • Campaigns by Weekday
  • Raw Campaign Data

[/columns_right][/columns]

Author: Ben Marshall

Red Bull Addict, Self-Proclaimed Grill Master, Entrepreneur, Workaholic, Front End Engineer, SEO/SM Strategist, Web Developer, Blogger

Leave a Reply

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