-
Notifications
You must be signed in to change notification settings - Fork 42
/
Plugin.php
112 lines (105 loc) · 3.46 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php namespace RainLab\GoogleAnalytics;
use System\Classes\PluginBase;
/**
* Plugin base class
*
* @package rainlab/googleanalytics
* @author Alexey Bobkov, Samuel Georges
*/
class Plugin extends PluginBase
{
/**
* pluginDetails
*/
public function pluginDetails()
{
return [
'name' => 'Google Analytics',
'description' => 'rainlab.googleanalytics::lang.strings.plugin_desc',
'author' => 'Alexey Bobkov, Samuel Georges',
'icon' => 'icon-bar-chart-o',
'homepage' => 'https://github.com/rainlab/googleanalytics-plugin'
];
}
/**
* boot
*/
public function boot()
{
set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__.'/vendor/google/apiclient/src');
}
/**
* registerComponents
*/
public function registerComponents()
{
return [
\RainLab\GoogleAnalytics\Components\Tracker::class => 'googleTracker'
];
}
/**
* registerPermissions
*/
public function registerPermissions()
{
return [
'rainlab.googleanalytics.access_settings' => [
'tab' => 'rainlab.googleanalytics::lang.permissions.tab',
'label' => 'rainlab.googleanalytics::lang.permissions.settings'
],
'rainlab.googleanalytics.view_widgets' => [
'tab' => 'rainlab.googleanalytics::lang.permissions.tab',
'label' => 'rainlab.googleanalytics::lang.permissions.widgets'
]
];
}
/**
* registerReportWidgets
*/
public function registerReportWidgets()
{
return [
'RainLab\GoogleAnalytics\ReportWidgets\TrafficOverview' => [
'label' => 'Google Analytics traffic overview',
'context' => 'dashboard',
'permissions' => ['rainlab.googleanalytics.view_widgets']
],
'RainLab\GoogleAnalytics\ReportWidgets\TrafficSources' => [
'label' => 'Google Analytics traffic sources',
'context' => 'dashboard',
'permissions' => ['rainlab.googleanalytics.view_widgets']
],
'RainLab\GoogleAnalytics\ReportWidgets\Browsers' => [
'label' => 'Google Analytics browsers',
'context' => 'dashboard',
'permissions' => ['rainlab.googleanalytics.view_widgets']
],
'RainLab\GoogleAnalytics\ReportWidgets\TrafficGoal' => [
'label' => 'Google Analytics traffic goal',
'context' => 'dashboard',
'permissions' => ['rainlab.googleanalytics.view_widgets']
],
'RainLab\GoogleAnalytics\ReportWidgets\TopPages' => [
'label' => 'Google Analytics top pages',
'context' => 'dashboard',
'permissions' => ['rainlab.googleanalytics.view_widgets']
]
];
}
/**
* registerSettings
*/
public function registerSettings()
{
return [
'config' => [
'label' => 'Google Analytics',
'icon' => 'icon-bar-chart-o',
'description' => 'rainlab.googleanalytics::lang.strings.settings_desc',
'class' => \RainLab\GoogleAnalytics\Models\Settings::class,
'permissions' => ['rainlab.googleanalytics.access_settings'],
'order' => 600
]
];
}
}