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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
<?php
/**
* Piwik - Open source web analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
* @category Piwik_Plugins
* @package Piwik_VisitsSummary
*/
use Piwik\Plugin;
/**
* Note: This plugin does not hook on Daily and Period Archiving like other Plugins because it reports the
* very core metrics (visits, actions, visit duration, etc.) which are processed in the Core
* Day class directly.
* These metrics can be used by other Plugins so they need to be processed up front.
*
* @package Piwik_VisitsSummary
*/
class Piwik_VisitsSummary extends Plugin
{
/**
* @see Piwik_Plugin::getListHooksRegistered
*/
public function getListHooksRegistered()
{
return array(
'API.getReportMetadata' => 'getReportMetadata',
'WidgetsList.add' => 'addWidgets',
'Menu.add' => 'addMenu',
);
}
public function getReportMetadata(&$reports)
{
$reports[] = array(
'category' => Piwik_Translate('VisitsSummary_VisitsSummary'),
'name' => Piwik_Translate('VisitsSummary_VisitsSummary'),
'module' => 'VisitsSummary',
'action' => 'get',
'metrics' => array(
'nb_uniq_visitors',
'nb_visits',
'nb_actions',
'nb_actions_per_visit',
'bounce_rate',
'avg_time_on_site' => Piwik_Translate('General_VisitDuration'),
'max_actions' => Piwik_Translate('General_ColumnMaxActions'),
// Used to process metrics, not displayed/used directly
// 'sum_visit_length',
// 'nb_visits_converted',
),
'processedMetrics' => false,
'order' => 1
);
}
function addWidgets()
{
WidgetsList::add('VisitsSummary_VisitsSummary', 'VisitsSummary_WidgetLastVisits', 'VisitsSummary', 'getEvolutionGraph', array('columns' => array('nb_visits')));
WidgetsList::add('VisitsSummary_VisitsSummary', 'VisitsSummary_WidgetVisits', 'VisitsSummary', 'getSparklines');
WidgetsList::add('VisitsSummary_VisitsSummary', 'VisitsSummary_WidgetOverviewGraph', 'VisitsSummary', 'index');
}
function addMenu()
{
Piwik_AddMenu('General_Visitors', '', array('module' => 'VisitsSummary', 'action' => 'index'), true, 10);
Piwik_AddMenu('General_Visitors', 'VisitsSummary_SubmenuOverview', array('module' => 'VisitsSummary', 'action' => 'index'), true, 1);
}
}
|