Skip to content

Commit

Permalink
Add number of MailChimp lists to tracked data.
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyvankooten committed Oct 9, 2015
1 parent 235e1f6 commit 6a1965b
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions includes/admin/class-usage-tracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ public function track() {
protected function get_tracking_data() {

$data = array(
'site' => home_url(),
// use md5 hash of home_url, we don't need/want to know the actual site url
'site' => md5( home_url() ),
'options' => $this->get_tracked_options(),
'number_of_mailchimp_lists' => $this->get_mailchimp_lists_count(),
'mc4wp_version' => MC4WP_LITE_VERSION,
'plugins' => (array) get_option( 'active_plugins', array() ),
'php_version' => PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION,
Expand All @@ -87,14 +89,25 @@ protected function get_tracking_data() {
return $data;
}

/**
* @return int
*/
protected function get_mailchimp_lists_count() {
$mailchimp = new MC4WP_MailChimp();
$lists = $mailchimp->get_lists( false, true );
return count( $lists );
}

/**
* @return array
*/
public function get_tracked_options( ) {

$checkbox_options = mc4wp_get_options( 'checkbox' );
$form_options = mc4wp_get_options( 'form' );
$ignored_options = array( 'api_key', 'license_key' );

// make sure these keys are always stripped
$ignored_options = array( 'api_key', 'license_key', 'lists' );

// filter options
$checkbox_options = array_diff_key( $checkbox_options, array_flip( $ignored_options ) );
Expand Down

0 comments on commit 6a1965b

Please sign in to comment.