blob: dd0018300c9edc9a25eebe0f965ebb225bcb833d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<?php
/**
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\CoreHome\Columns;
use Piwik\Columns\DimensionSegmentFactory;
use Piwik\Plugin\Dimension\VisitDimension;
use Piwik\Plugin\Segment;
use Piwik\Segment\SegmentsList;
class VisitorDaysSinceFirst extends VisitDimension
{
protected $type = self::TYPE_NUMBER;
protected $sqlSegment = 'ROUND(log_visit.visitor_seconds_since_first / 86400)';
protected $nameSingular = 'General_DaysSinceFirstVisit';
protected $columnName = 'visitor_seconds_since_first';
protected $segmentName = 'daysSinceFirstVisit';
public function configureSegments(SegmentsList $segmentsList, DimensionSegmentFactory $dimensionSegmentFactory)
{
$segment = new Segment();
$segment->setSegment('daysSinceFirstVisit');
$segment->setName('General_DaysSinceFirstVisit');
$segment->setCategory('General_Visitors');
$segment->setSqlSegment('log_visit.visitor_seconds_since_first');
$segment->setSqlFilterValue(function ($value) {
return (int)$value * 86400;
});
$segmentsList->addSegment($dimensionSegmentFactory->createSegment($segment));
}
}
|