diff options
Diffstat (limited to 'plugins/Actions/Columns/VisitTotalActions.php')
-rw-r--r-- | plugins/Actions/Columns/VisitTotalActions.php | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/plugins/Actions/Columns/VisitTotalActions.php b/plugins/Actions/Columns/VisitTotalActions.php index 750cfc8667..85ddc9336d 100644 --- a/plugins/Actions/Columns/VisitTotalActions.php +++ b/plugins/Actions/Columns/VisitTotalActions.php @@ -8,25 +8,42 @@ */ namespace Piwik\Plugins\Actions\Columns; +use Piwik\Columns\MetricsList; +use Piwik\Piwik; +use Piwik\Plugin\ArchivedMetric; +use Piwik\Plugin\ComputedMetric; use Piwik\Plugin\Dimension\VisitDimension; -use Piwik\Plugins\CoreHome\Segment; +use Piwik\Columns\DimensionMetricFactory; use Piwik\Tracker\Action; use Piwik\Tracker\Request; -use Piwik\Tracker; use Piwik\Tracker\Visitor; class VisitTotalActions extends VisitDimension { protected $columnName = 'visit_total_actions'; protected $columnType = 'INT(11) UNSIGNED NULL'; + protected $metricId = 'actions'; + protected $nameSingular = 'Actions_ActionsInVisit'; + protected $segmentName = 'actions'; + protected $type = self::TYPE_NUMBER; - protected function configureSegments() + public function configureMetrics(MetricsList $metricsList, DimensionMetricFactory $dimensionMetricFactory) { - $segment = new Segment(); - $segment->setType(Segment::TYPE_METRIC); - $segment->setSegment('actions'); - $segment->setName('General_NbActions'); - $this->addSegment($segment); + $metric1 = $dimensionMetricFactory->createCustomMetric('bounce_count', Piwik::translate('General_ColumnBounces'), 'sum(case %s when 1 then 1 when 0 then 1 else 0 end)'); + $metric1->setDocumentation(Piwik::translate('General_ColumnBouncesDocumentation')); + $metricsList->addMetric($metric1); + + $metric = $dimensionMetricFactory->createMetric(ArchivedMetric::AGGREGATION_SUM); + $metricsList->addMetric($metric); + + $metric = $dimensionMetricFactory->createMetric(ArchivedMetric::AGGREGATION_MAX); + $metricsList->addMetric($metric); + + $metric = $dimensionMetricFactory->createComputedMetric($metric1->getName(), 'nb_visits', ComputedMetric::AGGREGATION_RATE); + $metric->setTranslatedName(Piwik::translate('General_ColumnBounceRate')); + $metric->setName('bounce_rate'); + $metric->setDocumentation(Piwik::translate('General_ColumnBounceRateDocumentation')); + $metricsList->addMetric($metric); } /** |