forked from johsin18/DevicePixelRatioMatomoPlugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Archiver.php
44 lines (39 loc) · 1.42 KB
/
Archiver.php
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
38
39
40
41
42
43
44
<?php
/**
* Matomo - free/libre analytics platform
*
* @link http://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Plugins\DevicePixelRatio;
use Piwik\DataTable;
use Piwik\Metrics;
/**
* Class Archiver
* @package Piwik\Plugins\DevicePixelRatio
*
* Archiver is class processing raw data into ready ro read reports.
* It must implement two methods for aggregating daily reports
* aggregateDayReport() and other for summing daily reports into periods
* like week, month, year or custom range aggregateMultipleReports().
*
* For more detailed information about Archiver please visit Matomo developer guide
* http://developer.matomo.org/api-reference/Piwik/Plugin/Archiver
*/
class Archiver extends \Piwik\Plugin\Archiver
{
const DEVICE_PIXEL_RATIO_DIMENSION = "log_visit.device_pixel_ratio";
const DEVICEPIXELRATIO_ARCHIVE_RECORD = "DevicePixelRatio_archive_record";
public function aggregateDayReport()
{
$visitorMetrics = $this
->getLogAggregator()
->getMetricsFromVisitByDimension(self::DEVICE_PIXEL_RATIO_DIMENSION)
->asDataTable();
$this->getProcessor()->insertBlobRecord(self::DEVICEPIXELRATIO_ARCHIVE_RECORD, $visitorMetrics->getSerialized());
}
public function aggregateMultipleReports()
{
$this->getProcessor()->aggregateDataTableRecords(self::DEVICEPIXELRATIO_ARCHIVE_RECORD);
}
}