forked from rainlab/googleanalytics-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Plugin.php
88 lines (81 loc) · 3.21 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
<?php namespace RainLab\GoogleAnalytics;
use System\Classes\PluginBase;
class Plugin extends PluginBase
{
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'
];
}
public function registerComponents()
{
return [
'\RainLab\GoogleAnalytics\Components\Tracker' => 'googleTracker'
];
}
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'
]
];
}
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']
]
];
}
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',
'permissions' => ['rainlab.googleanalytics.access_settings'],
'order' => 600
]
];
}
public function boot()
{
set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__.'/vendor/google/apiclient/src');
}
}