« Back to Documentation Overview

listGrowthHistory – v1.2

 listGrowthHistory(string apikey, string id)

Access the Growth History by Month for a given list.

Section
List Related
mcapi_listGrowthHistory.php
Parameters
apikey a valid API Key for your user account. Get by visiting your API dashboard
id the list id to connect to. Get by calling lists()
Returns
array array of months and growth
Returned Fields
stringmonthThe Year and Month in question using YYYY-MM format
integerexistingnumber of existing subscribers to start the month
integerimportsnumber of subscribers imported during the month
integeroptinsnumber of subscribers who opted-in during the month

Examples (1)

download example code

[1] mcapi_listGrowthHistory.php

  1. <?php
  2.  
  3. // Include the MailChimp API code. Do Not Edit This!
  4. require_once 'inc/MCAPI.class.php';
  5. require_once 'inc/config.inc.php'; //contains apikey
  6.  
  7. $api = new MCAPI($apikey);
  8.  
  9. $history = $api->listGrowthHistory($listId);
  10.  
  11. if ($api->errorCode){
  12. echo "Unable to run listGrowthHistory()!\n\tCode=".$api->errorCode."\n\tMsg=".$api->errorMessage."\n";
  13. } else {
  14. foreach($history as $h){
  15. echo $h['month']."\n";
  16. echo "\tExisting=".$h['existing']."\n";
  17. echo "\tImports=".$h['imports']."\n";
  18. echo "\tOptins=".$h['optins']."\n";
  19. }
  20.  
  21. }
  22.  
  23. ?>
  24.  
  25.