-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Plugin.php
87 lines (81 loc) · 3.34 KB
/
Plugin.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
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
<?php namespace Winter\GoogleAnalytics;
use Backend\Models\UserRole;
use System\Classes\PluginBase;
class Plugin extends PluginBase
{
public function pluginDetails(): array
{
return [
'name' => 'Google Analytics',
'description' => 'winter.googleanalytics::lang.strings.plugin_desc',
'author' => 'Winter CMS',
'icon' => 'icon-bar-chart-o',
'homepage' => 'https://github.com/wintercms/wn-googleanalytics-plugin',
'replaces' => ['RainLab.GoogleAnalytics' => '<= 1.3.1'],
];
}
public function registerComponents(): array
{
return [
\Winter\GoogleAnalytics\Components\Tracker::class => 'googleTracker'
];
}
public function registerPermissions(): array
{
return [
'winter.googleanalytics.access_settings' => [
'tab' => 'winter.googleanalytics::lang.permissions.tab',
'label' => 'winter.googleanalytics::lang.permissions.settings',
'roles' => [UserRole::CODE_DEVELOPER],
],
'winter.googleanalytics.view_widgets' => [
'tab' => 'winter.googleanalytics::lang.permissions.tab',
'label' => 'winter.googleanalytics::lang.permissions.widgets',
'roles' => [UserRole::CODE_DEVELOPER, UserRole::CODE_PUBLISHER],
]
];
}
public function registerReportWidgets(): array
{
return [
\Winter\GoogleAnalytics\ReportWidgets\TrafficOverview::class => [
'label' => 'Google Analytics traffic overview',
'context' => 'dashboard',
'permissions' => ['winter.googleanalytics.view_widgets']
],
\Winter\GoogleAnalytics\ReportWidgets\TrafficSources::class => [
'label' => 'Google Analytics traffic sources',
'context' => 'dashboard',
'permissions' => ['winter.googleanalytics.view_widgets']
],
\Winter\GoogleAnalytics\ReportWidgets\Browsers::class => [
'label' => 'Google Analytics browsers',
'context' => 'dashboard',
'permissions' => ['winter.googleanalytics.view_widgets']
],
\Winter\GoogleAnalytics\ReportWidgets\TrafficGoal::class => [
'label' => 'Google Analytics traffic goal',
'context' => 'dashboard',
'permissions' => ['winter.googleanalytics.view_widgets']
],
\Winter\GoogleAnalytics\ReportWidgets\TopPages::class => [
'label' => 'Google Analytics top pages',
'context' => 'dashboard',
'permissions' => ['winter.googleanalytics.view_widgets']
]
];
}
public function registerSettings(): array
{
return [
'config' => [
'label' => 'Google Analytics',
'icon' => 'icon-bar-chart-o',
'description' => 'winter.googleanalytics::lang.strings.settings_desc',
'class' => 'Winter\GoogleAnalytics\Models\Settings',
'permissions' => ['winter.googleanalytics.access_settings'],
'order' => 600
]
];
}
}