Merge pull request #1281 from mailpoet/fix-mixpanel-segments
Fix analytics reporting on segments [MAILPOET-1279]
This commit is contained in:
@@ -19,7 +19,7 @@ class Reporter {
|
|||||||
$isCronTriggerMethodWP = Setting::getValue('cron_trigger.method') === CronTrigger::$available_methods['wordpress'];
|
$isCronTriggerMethodWP = Setting::getValue('cron_trigger.method') === CronTrigger::$available_methods['wordpress'];
|
||||||
$checker = new ServicesChecker();
|
$checker = new ServicesChecker();
|
||||||
$bounceAddress = Setting::getValue('bounce.address');
|
$bounceAddress = Setting::getValue('bounce.address');
|
||||||
$segmets = Segment::getAnalytics();
|
$segments = Segment::getAnalytics();
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'PHP version' => PHP_VERSION,
|
'PHP version' => PHP_VERSION,
|
||||||
@@ -50,8 +50,8 @@ class Reporter {
|
|||||||
'Number of standard newsletters sent in last 3 months' => $newsletters['sent_newsletters'],
|
'Number of standard newsletters sent in last 3 months' => $newsletters['sent_newsletters'],
|
||||||
'Number of active post notifications' => $newsletters['notifications_count'],
|
'Number of active post notifications' => $newsletters['notifications_count'],
|
||||||
'Number of active welcome emails' => $newsletters['welcome_newsletters_count'],
|
'Number of active welcome emails' => $newsletters['welcome_newsletters_count'],
|
||||||
'Number of segments' => $segmets['dynamic'],
|
'Number of segments' => isset($segments['dynamic']) ? (int)$segments['dynamic'] : 0,
|
||||||
'Number of lists' => $segmets['default'],
|
'Number of lists' => isset($segments['default']) ? (int)$segments['default'] : 0,
|
||||||
'Plugin > MailPoet Premium' => is_plugin_active('mailpoet-premium/mailpoet-premium.php'),
|
'Plugin > MailPoet Premium' => is_plugin_active('mailpoet-premium/mailpoet-premium.php'),
|
||||||
'Plugin > bounce add-on' => is_plugin_active('mailpoet-bounce-handler/mailpoet-bounce-handler.php'),
|
'Plugin > bounce add-on' => is_plugin_active('mailpoet-bounce-handler/mailpoet-bounce-handler.php'),
|
||||||
'Plugin > Bloom' => is_plugin_active('bloom-for-publishers/bloom.php'),
|
'Plugin > Bloom' => is_plugin_active('bloom-for-publishers/bloom.php'),
|
||||||
|
@@ -249,9 +249,14 @@ class Segment extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static function getAnalytics() {
|
static function getAnalytics() {
|
||||||
return Segment::select_expr('type, count(*) as count')
|
$analytics = Segment::select_expr('type, count(*) as count')
|
||||||
->whereNull('deleted_at')
|
->whereNull('deleted_at')
|
||||||
->groupBy('type')
|
->groupBy('type')
|
||||||
->findArray();
|
->findArray();
|
||||||
|
$result = array();
|
||||||
|
foreach($analytics as $segment) {
|
||||||
|
$result[$segment['type']] = $segment['count'];
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user