-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEventsEnhanced.php
More file actions
104 lines (93 loc) · 3.33 KB
/
EventsEnhanced.php
File metadata and controls
104 lines (93 loc) · 3.33 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
/**
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Plugins\EventsEnhanced;
/**
* EventsEnhanced plugin - Enhances Matomo native events reports with detailed dimension pages
*
* This plugin adds detail pages for each event dimension value (category, action, name).
* Each detail page shows:
* - Evolution graph for the dimension value
* - Reports for related dimensions
* - Page URLs and titles where events were triggered
* - Custom dimension reports (if available)
*/
class EventsEnhanced extends \Piwik\Plugin
{
/**
* Register plugin events/hooks
*
* @return array
*/
public function registerEvents()
{
return [
'AssetManager.getJavaScriptFiles' => 'getJsFiles',
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys',
'Url.getQueryParametersToExclude' => 'getQueryParametersToExclude',
];
}
/**
* Exclude our custom parameters from being added to menu links
* This prevents the eventCategory/eventAction/eventName params from polluting all menu URLs
*
* @param array $parametersToExclude
*/
public function getQueryParametersToExclude(&$parametersToExclude)
{
$parametersToExclude[] = 'eventDimensionType';
$parametersToExclude[] = 'eventDimensionValue';
}
/**
* Register JavaScript files
*
* @param array $jsFiles
*/
public function getJsFiles(&$jsFiles)
{
$jsFiles[] = 'plugins/EventsEnhanced/javascripts/eventsEnhancedRowAction.js';
}
/**
* Register stylesheet files
*
* @param array $stylesheets
*/
public function getStylesheetFiles(&$stylesheets)
{
$stylesheets[] = 'plugins/EventsEnhanced/stylesheets/eventsEnhanced.less';
}
/**
* Register client-side translation keys
*
* @param array $translationKeys
*/
public function getClientSideTranslationKeys(&$translationKeys)
{
// EventsEnhanced translation keys
$translationKeys[] = 'EventsEnhanced_EventsDetails';
$translationKeys[] = 'EventsEnhanced_EventDimension';
$translationKeys[] = 'EventsEnhanced_EventsOverTime';
$translationKeys[] = 'EventsEnhanced_EventDetailsRowActionTitle';
$translationKeys[] = 'EventsEnhanced_EventDetailsRowActionDescription';
// Core Events translation keys (used in dimension selectors and reports)
$translationKeys[] = 'Events_EventCategory';
$translationKeys[] = 'Events_EventAction';
$translationKeys[] = 'Events_EventName';
$translationKeys[] = 'Events_EventValue';
$translationKeys[] = 'Events_EventCategories';
$translationKeys[] = 'Events_EventActions';
$translationKeys[] = 'Events_EventNames';
$translationKeys[] = 'Actions_PageUrls';
$translationKeys[] = 'UserCountry_Country';
// CustomDimensions translation key (for fallback display)
$translationKeys[] = 'CustomDimensions_CustomDimensionId';
// Premium translation keys
$translationKeys[] = 'EventsEnhanced_PremiumLinkText';
$translationKeys[] = 'EventsEnhanced_PremiumText';
}
}