Google Analytics Dashboard for WP (GADWP) - Version 4.4

Version Description

  • Bug Fix: frontend reports and widget are not responsive
  • Bug Fix: random notices for today and yesterday reports
  • Enhancement: Italian translation, updated by Leo
  • Enhancement: admin widget responsive design and optimizations
  • Enhancement: added acquisition channel reports
  • Enhancement: added acquisition social networks reports
  • Enhancement: added acquisition search engines reports
  • Enhancement: new location report and countries/cities list table
  • Enhancement: new pages report (removed top 24 limit)
  • Enhancement: new searches report (removed top 24 limit)
  • Enhancement: new referrers report (removed top 24 limit)
  • Enhancement: frontend, per page reports (removed top 24 limit)
  • Enhancement: added campaigns in real-time report/screen
  • Enhancement: asynchronous reports loading and speed improvements
  • Enhancement: code optimization for all frontend and backend features
  • Enhancement: finished the error standardization process; easier debugging
  • Enhancement: GAPI library update
Download this release

Release Info

Developer deconf
Plugin Icon 128x128 Google Analytics Dashboard for WP (GADWP)
Version 4.4
Comparing to
See all releases

Version 4.4

Files changed (102) hide show
  1. admin/ajax-actions.php +147 -0
  2. admin/css/ga_dash.css +360 -0
  3. admin/dashboard_widgets.php +1043 -0
  4. admin/ga_dash_settings.php +1529 -0
  5. admin/images/clicky.png +0 -0
  6. admin/images/gadash-icon.png +0 -0
  7. admin/images/google-analytics-dashboard.png +0 -0
  8. admin/images/help.png +0 -0
  9. admin/images/mcdn.png +0 -0
  10. admin/images/ssl.png +0 -0
  11. admin/images/star.png +0 -0
  12. admin/images/wp.png +0 -0
  13. admin/js/admin.js +65 -0
  14. admin/js/wp-color-picker-script.js +3 -0
  15. config.php +280 -0
  16. front/ajax-actions.php +162 -0
  17. front/css/content_stats.css +58 -0
  18. front/frontend.php +182 -0
  19. front/js/content_stats.js +1 -0
  20. front/tracking.php +80 -0
  21. front/tracking/code-classic.php +28 -0
  22. front/tracking/code-universal.php +104 -0
  23. front/tracking/events-classic.php +42 -0
  24. front/tracking/events-universal.php +53 -0
  25. front/widgets.php +235 -0
  26. gadwp.php +87 -0
  27. install/install.php +136 -0
  28. install/uninstall.php +37 -0
  29. languages/ar.mo +0 -0
  30. languages/ar.po +987 -0
  31. languages/ga-dash-de_DE.mo +0 -0
  32. languages/ga-dash-de_DE.po +989 -0
  33. languages/ga-dash-es_ES.mo +0 -0
  34. languages/ga-dash-es_ES.po +1094 -0
  35. languages/ga-dash-fr_FR.mo +0 -0
  36. languages/ga-dash-fr_FR.po +996 -0
  37. languages/ga-dash-hu_HU.mo +0 -0
  38. languages/ga-dash-hu_HU.po +995 -0
  39. languages/ga-dash-it_IT.mo +0 -0
  40. languages/ga-dash-it_IT.po +1013 -0
  41. languages/ga-dash-pl_PL.mo +0 -0
  42. languages/ga-dash-pl_PL.po +983 -0
  43. languages/ga-dash-pt_BR.mo +0 -0
  44. languages/ga-dash-pt_BR.po +993 -0
  45. languages/ga-dash.pot +849 -0
  46. readme.txt +533 -0
  47. realtime/jquery/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  48. realtime/jquery/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  49. realtime/jquery/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  50. realtime/jquery/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  51. realtime/jquery/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  52. realtime/jquery/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  53. realtime/jquery/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  54. realtime/jquery/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  55. realtime/jquery/images/ui-icons_222222_256x240.png +0 -0
  56. realtime/jquery/images/ui-icons_2e83ff_256x240.png +0 -0
  57. realtime/jquery/images/ui-icons_454545_256x240.png +0 -0
  58. realtime/jquery/images/ui-icons_888888_256x240.png +0 -0
  59. realtime/jquery/images/ui-icons_cd0a0a_256x240.png +0 -0
  60. realtime/jquery/jquery.ui.tooltip.html.css +57 -0
  61. realtime/jquery/jquery.ui.tooltip.html.js +7 -0
  62. tools/autoload.php +33 -0
  63. tools/gapi.php +971 -0
  64. tools/iso3166.php +247 -0
  65. tools/nprogress/nprogress.css +89 -0
  66. tools/nprogress/nprogress.js +476 -0
  67. tools/src/Google/Auth/Abstract.php +36 -0
  68. tools/src/Google/Auth/AppIdentity.php +105 -0
  69. tools/src/Google/Auth/AssertionCredentials.php +136 -0
  70. tools/src/Google/Auth/Exception.php +22 -0
  71. tools/src/Google/Auth/LoginTicket.php +69 -0
  72. tools/src/Google/Auth/OAuth2.php +633 -0
  73. tools/src/Google/Auth/Simple.php +64 -0
  74. tools/src/Google/Cache/Abstract.php +53 -0
  75. tools/src/Google/Cache/Apc.php +111 -0
  76. tools/src/Google/Cache/Exception.php +22 -0
  77. tools/src/Google/Cache/File.php +190 -0
  78. tools/src/Google/Cache/Memcache.php +182 -0
  79. tools/src/Google/Cache/Null.php +55 -0
  80. tools/src/Google/Client.php +686 -0
  81. tools/src/Google/Collection.php +96 -0
  82. tools/src/Google/Config.php +414 -0
  83. tools/src/Google/Exception.php +20 -0
  84. tools/src/Google/Http/Batch.php +141 -0
  85. tools/src/Google/Http/CacheParser.php +184 -0
  86. tools/src/Google/Http/MediaFileUpload.php +300 -0
  87. tools/src/Google/Http/REST.php +147 -0
  88. tools/src/Google/Http/Request.php +476 -0
  89. tools/src/Google/IO/Abstract.php +329 -0
  90. tools/src/Google/IO/Curl.php +159 -0
  91. tools/src/Google/IO/Exception.php +22 -0
  92. tools/src/Google/IO/Stream.php +230 -0
  93. tools/src/Google/IO/cacerts.pem +2183 -0
  94. tools/src/Google/Logger/Abstract.php +406 -0
  95. tools/src/Google/Logger/Exception.php +22 -0
  96. tools/src/Google/Logger/File.php +156 -0
  97. tools/src/Google/Logger/Null.php +41 -0
  98. tools/src/Google/Logger/Psr.php +91 -0
  99. tools/src/Google/Model.php +281 -0
  100. tools/src/Google/Service.php +39 -0
  101. tools/src/Google/Service/AdSense.php +3585 -0
  102. tools/src/Google/Service/Analytics.php +1991 -0
admin/ajax-actions.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Author: Alin Marcu
4
+ * Author URI: http://deconf.com
5
+ * License: GPLv2 or later
6
+ * License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
+ */
8
+ if (! class_exists('GADASH_Backend_Ajax')) {
9
+
10
+ final class GADASH_Backend_Ajax
11
+ {
12
+
13
+ function __construct()
14
+ {
15
+ // Backend Widget Realtime action
16
+ add_action('wp_ajax_gadashadmin_get_realtime', array(
17
+ $this,
18
+ 'ajax_adminwidget_realtime'
19
+ ));
20
+ // Admin Widget get Reports action
21
+ add_action('wp_ajax_gadashadmin_get_widgetreports', array(
22
+ $this,
23
+ 'ajax_adminwidget_reports'
24
+ ));
25
+ }
26
+
27
+ /**
28
+ * Ajax handler for getting reports for Admin Widget
29
+ *
30
+ * @return string|int
31
+ */
32
+ function ajax_adminwidget_reports()
33
+ {
34
+ global $GADASH_Config;
35
+
36
+ $projectId = $_REQUEST['projectId'];
37
+ $from = $_REQUEST['from'];
38
+ $to = $_REQUEST['to'];
39
+ $query = $_REQUEST['query'];
40
+
41
+ if (! isset($_REQUEST['gadashadmin_security_widget_reports']) or ! wp_verify_nonce($_REQUEST['gadashadmin_security_widget_reports'], 'gadashadmin_get_widgetreports')) {
42
+ print(json_encode(- 30));
43
+ die();
44
+ }
45
+
46
+ /*
47
+ * Include Tools
48
+ */
49
+ include_once ($GADASH_Config->plugin_path . '/tools/tools.php');
50
+ $tools = new GADASH_Tools();
51
+
52
+ if (! $tools->check_roles($GADASH_Config->options['ga_dash_access_back'])) {
53
+ print(json_encode(- 31));
54
+ die();
55
+ }
56
+
57
+ if ($GADASH_Config->options['ga_dash_token'] and function_exists('curl_version') and $projectId and $from and $to) {
58
+ include_once ($GADASH_Config->plugin_path . '/tools/gapi.php');
59
+ global $GADASH_GAPI;
60
+ } else {
61
+ print(json_encode(- 24));
62
+ die();
63
+ }
64
+
65
+ switch ($query) {
66
+ case 'referrers':
67
+ print($GADASH_GAPI->get_referrers($projectId, $from, $to));
68
+ break;
69
+ case 'contentpages':
70
+ print($GADASH_GAPI->get_contentpages($projectId, $from, $to));
71
+ break;
72
+ case 'locations':
73
+ print($GADASH_GAPI->get_locations($projectId, $from, $to));
74
+ break;
75
+ case 'bottomstats':
76
+ print(json_encode($GADASH_GAPI->get_bottomstats($projectId, $from, $to)));
77
+ break;
78
+ case 'trafficchannels':
79
+ print($GADASH_GAPI->get_trafficchannels($projectId, $from, $to));
80
+ break;
81
+ case 'medium':
82
+ print($GADASH_GAPI->get_trafficdetails($projectId, $from, $to, 'medium'));
83
+ break;
84
+ case 'visitorType':
85
+ print($GADASH_GAPI->get_trafficdetails($projectId, $from, $to, 'visitorType'));
86
+ break;
87
+ case 'socialNetwork':
88
+ print($GADASH_GAPI->get_trafficdetails($projectId, $from, $to, 'socialNetwork'));
89
+ break;
90
+ case 'source':
91
+ print($GADASH_GAPI->get_trafficdetails($projectId, $from, $to, 'source'));
92
+ break;
93
+ case 'searches':
94
+ print($GADASH_GAPI->get_searches($projectId, $from, $to));
95
+ break;
96
+ default:
97
+ print($GADASH_GAPI->get_mainreport($projectId, $from, $to, $query));
98
+ break;
99
+ }
100
+
101
+ die();
102
+ }
103
+
104
+ // Real-Time Request
105
+ /**
106
+ * Ajax handler for getting realtime analytics data for Admin widget
107
+ *
108
+ * @return string|int
109
+ */
110
+ function ajax_adminwidget_realtime()
111
+ {
112
+ global $GADASH_Config;
113
+
114
+ $projectId = $_REQUEST['projectId'];
115
+
116
+ if (! isset($_REQUEST['gadashadmin_security_widgetrealtime']) or ! wp_verify_nonce($_REQUEST['gadashadmin_security_widgetrealtime'], 'gadashadmin_get_realtime')) {
117
+ print(json_encode(- 30));
118
+ die();
119
+ }
120
+
121
+ /*
122
+ * Include Tools
123
+ */
124
+ include_once ($GADASH_Config->plugin_path . '/tools/tools.php');
125
+ $tools = new GADASH_Tools();
126
+
127
+ if (! $tools->check_roles($GADASH_Config->options['ga_dash_access_back'])) {
128
+ print(json_encode(- 31));
129
+ die();
130
+ }
131
+
132
+ if ($GADASH_Config->options['ga_dash_token'] and function_exists('curl_version') and $projectId) {
133
+ include_once ($GADASH_Config->plugin_path . '/tools/gapi.php');
134
+ global $GADASH_GAPI;
135
+ } else {
136
+ print(json_encode(- 24));
137
+ die();
138
+ }
139
+
140
+ print($GADASH_GAPI->gadash_realtime_data($projectId));
141
+
142
+ die();
143
+ }
144
+ }
145
+ }
146
+
147
+ $GADASH_Backend_Ajax = new GADASH_Backend_Ajax();
admin/css/ga_dash.css ADDED
@@ -0,0 +1,360 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Options pages */
2
+ table.options {
3
+ padding-left: 10px;
4
+ width: 100%;
5
+ }
6
+
7
+ .options td {
8
+ padding: 0px 5px 5px 5px;
9
+ }
10
+
11
+ td.title, td.info {
12
+ width: 130px;
13
+ padding-left: 20px;
14
+ }
15
+
16
+ td.title-select {
17
+ width: 300px;
18
+ }
19
+
20
+ td.debugging {
21
+ width: 150px;
22
+ }
23
+
24
+ td.info {
25
+ padding-bottom: 15px;
26
+ }
27
+
28
+ td.title label {
29
+ font-weight: bold;
30
+ }
31
+
32
+ .gadash-title {
33
+ float:left;
34
+ margin-right: 10px;
35
+ margin-top: 2px;
36
+ clear:left;
37
+ }
38
+
39
+ .gadash-desc {
40
+ font-size: 1em;
41
+ }
42
+
43
+ .gadash-top {
44
+ vertical-align: top;
45
+ }
46
+
47
+ pre.gadash {
48
+ }
49
+
50
+ .show_hide, .log_data {
51
+ display: none;
52
+ }
53
+
54
+ pre.log_data {
55
+ white-space: pre-wrap;
56
+ }
57
+
58
+ td.roles {
59
+ padding-bottom: 15px;
60
+ }
61
+
62
+ #ga_speed_samplerate, #ga_realtime_pages {
63
+ width: 50px;
64
+ }
65
+
66
+ .event-option, .event-option-desc {
67
+ float: left;
68
+ }
69
+
70
+ #gapi-access-code {
71
+ color: red !important;
72
+ }
73
+
74
+ /* Options pages ON/OFF Switch */
75
+ .onoffswitch {
76
+ position: relative;
77
+ width: 55px;
78
+ float: left;
79
+ -webkit-user-select: none;
80
+ -moz-user-select: none;
81
+ -ms-user-select: none;
82
+ }
83
+
84
+ .onoffswitch-checkbox {
85
+ display: none !important;
86
+ }
87
+
88
+ .onoffswitch-label {
89
+ display: block;
90
+ overflow: hidden;
91
+ cursor: pointer;
92
+ border: 2px solid #C9C9C9;
93
+ border-radius: 5px;
94
+ }
95
+
96
+ .onoffswitch-inner {
97
+ width: 200%;
98
+ margin-left: -100%;
99
+ -moz-transition: margin 0.3s ease-in 0s;
100
+ -webkit-transition: margin 0.3s ease-in 0s;
101
+ -o-transition: margin 0.3s ease-in 0s;
102
+ transition: margin 0.3s ease-in 0s;
103
+ }
104
+
105
+ .onoffswitch-inner:before, .onoffswitch-inner:after {
106
+ float: left;
107
+ width: 50%;
108
+ height: 18px;
109
+ padding: 0;
110
+ line-height: 18px;
111
+ font-size: 12px;
112
+ color: white;
113
+ font-family: Trebuchet, Arial, sans-serif;
114
+ font-weight: bold;
115
+ -moz-box-sizing: border-box;
116
+ -webkit-box-sizing: border-box;
117
+ box-sizing: border-box;
118
+ }
119
+
120
+ .onoffswitch-inner:before {
121
+ content: "ON";
122
+ padding-left: 6px;
123
+ background-color: #1269BA;
124
+ color: #FFFFFF;
125
+ }
126
+
127
+ .onoffswitch-inner:after {
128
+ content: "OFF";
129
+ padding-right: 6px;
130
+ background-color: #EEEEEE;
131
+ color: #999999;
132
+ text-align: right;
133
+ }
134
+
135
+ .onoffswitch-switch {
136
+ width: 18px;
137
+ margin: 0px;
138
+ background: #FFFFFF;
139
+ border: 2px solid #C9C9C9;
140
+ border-radius: 5px;
141
+ position: absolute;
142
+ top: 0;
143
+ bottom: 0;
144
+ right: 33px;
145
+ -moz-transition: all 0.3s ease-in 0s;
146
+ -webkit-transition: all 0.3s ease-in 0s;
147
+ -o-transition: all 0.3s ease-in 0s;
148
+ transition: all 0.3s ease-in 0s;
149
+ background-image: -moz-linear-gradient(center top, rgba(0, 0, 0, 0.1) 0%,
150
+ rgba(0, 0, 0, 0) 100%);
151
+ background-image: -webkit-linear-gradient(center top, rgba(0, 0, 0, 0.1)
152
+ 0%, rgba(0, 0, 0, 0) 100%);
153
+ background-image: -o-linear-gradient(center top, rgba(0, 0, 0, 0.1) 0%,
154
+ rgba(0, 0, 0, 0) 100%);
155
+ background-image: linear-gradient(center top, rgba(0, 0, 0, 0.1) 0%,
156
+ rgba(0, 0, 0, 0) 100%);
157
+ }
158
+
159
+ .onoffswitch-checkbox:checked+.onoffswitch-label .onoffswitch-inner {
160
+ margin-left: 0;
161
+ }
162
+
163
+ .onoffswitch-checkbox:checked+.onoffswitch-label .onoffswitch-switch {
164
+ right: 0px;
165
+ }
166
+
167
+ .switch-desc {
168
+ float: left;
169
+ margin-left: 10px;
170
+ }
171
+
172
+ /* Admin Widget & Real-Time Stats*/
173
+
174
+ /* Real-Time content */
175
+ .gadash-pline {
176
+ width: 100%;
177
+ margin: 0 0;
178
+ padding: 5px 0 5px 0;
179
+ background: #fff;
180
+ -moz-box-shadow: 0px 0px 3px 0px #BBB;
181
+ -webkit-box-shadow: 0px 0px 3px 0px #BBB;
182
+ box-shadow: 0px 0px 3px 0px #BBB;
183
+ display: table;
184
+ overflow: hidden;
185
+ }
186
+
187
+ .gadash-pleft {
188
+ width: 90%;
189
+ float: left;
190
+ padding-left:5px;
191
+ }
192
+
193
+ .gadash-pright {
194
+ width: 5%;
195
+ float: right;
196
+ padding-right:5px;
197
+ }
198
+
199
+ #gadash-widget .realtime {
200
+ margin: 10px 0 0 0;
201
+ width: 100%;
202
+ }
203
+
204
+ .gadash-rt-box {
205
+ width: 100%;
206
+ margin: 0 0;
207
+ background: #fff;
208
+ text-align: center;
209
+ -moz-box-shadow: 0px 0px 5px 0px #BBB;
210
+ -webkit-box-shadow: 0px 0px 5px 0px #BBB;
211
+ box-shadow: 0px 0px 5px 0px #BBB;
212
+ display: table;
213
+ }
214
+
215
+ .gadash-tdo-left {
216
+ width: 60%;
217
+ padding: 33px 0;
218
+ float: left;
219
+ text-align:center;
220
+ }
221
+
222
+ .gadash-tdo-right {
223
+ width: 35%;
224
+ margin: 0px 10px 0px 0;
225
+ text-align: left;
226
+ font-weight: bold;
227
+ vertical-align: middle;
228
+ float: right;
229
+ display:table;
230
+ }
231
+
232
+ .gadash-online {
233
+ font-size: 100px;
234
+ font-weight: normal;
235
+ line-height: 1em;
236
+ margin:0 auto;
237
+ width:80%;
238
+ }
239
+
240
+ .gadash-bigtext {
241
+ font-size: 14px;
242
+ width: 100%;
243
+ margin: 0 0;
244
+ padding: 5px 5px 5px 5px;
245
+ background: #fff;
246
+ -moz-box-shadow: 0px 0px 3px 0px #BBB;
247
+ -webkit-box-shadow: 0px 0px 3px 0px #BBB;
248
+ box-shadow: 0px 0px 3px 0px #BBB;
249
+ display: table;
250
+ overflow: hidden;
251
+ }
252
+
253
+ .gadash-bleft{
254
+ float:left;
255
+ width:80%;
256
+ }
257
+
258
+ .gadash-bright{
259
+ float:right;
260
+ width:20%;
261
+ }
262
+
263
+ .gadash-pgdetailsr {
264
+ padding-left: 20px;
265
+ text-align: right;
266
+ }
267
+
268
+ .gadash-pgdetailsl {
269
+ min-width: 250px;
270
+ }
271
+
272
+ #gadash-mainchart{
273
+ width: 98%;
274
+ height:100%;
275
+ margin: 10px auto 10px 0;
276
+ height: 250px;
277
+ }
278
+
279
+ .gadash-floatwraper{
280
+ display:table;
281
+ width:100%;
282
+ height:100%;
283
+ }
284
+
285
+ #gadash-trafficmediums, #gadash-traffictype, #gadash-socialnetworks, #gadash-trafficorganic{
286
+ width:47%;
287
+ margin:10px 0 0 0;
288
+ height: 200px;
289
+ }
290
+
291
+ #gadash-trafficmediums, #gadash-trafficorganic{
292
+ float:left;
293
+ }
294
+
295
+ #gadash-traffictype, #gadash-socialnetworks{
296
+ float:right;
297
+ }
298
+
299
+ #gadash-map, #gadash-prs{
300
+ width: 98%;
301
+ height:100%;
302
+ margin: 10px auto 10px 0;
303
+ }
304
+
305
+ #ga_dash_period, #ga_dash_profile_select {
306
+ font-size: 14px !important;
307
+ padding: 1px !important;
308
+ height: 26px !important;
309
+ }
310
+
311
+ #dashboard-widgets-wrap .postbox {
312
+ margin-right: 10px;
313
+ }
314
+
315
+ /* Admin Widget content */
316
+
317
+ #gadash-progressbar{
318
+ width:100%;
319
+ height:3px;
320
+ margin:5px 0 0px 0;
321
+ }
322
+
323
+ .gadash-wrapper {
324
+ width: 100%;
325
+ }
326
+
327
+ .gadash-wrapper .inside {
328
+ display: table;
329
+ margin: 0 auto;
330
+ padding: 0px;
331
+ }
332
+
333
+ .gadash-wrapper .inside .small-box {
334
+ width: 30%;
335
+ float: left;
336
+ margin: 0 5px 10px 5px;
337
+ background: #fff;
338
+ text-align: center;
339
+ -moz-box-shadow: 0px 0px 7px 0px #BBB;
340
+ -webkit-box-shadow: 0px 0px 7px 0px #BBB;
341
+ box-shadow: 0px 0px 7px 0px #BBB;
342
+ }
343
+
344
+ .gadash-wrapper .inside .small-box h3 {
345
+ font-size: 1em;
346
+ color: #777;
347
+ padding: 0px 5px 0px 5px;
348
+ margin: 0px 0px 0px 0px;
349
+ }
350
+
351
+ .gadash-wrapper .inside .small-box p {
352
+ font-size: 1.2em;
353
+ margin: 0px 0px 2px 0px;
354
+ }
355
+
356
+ @media screen and (max-width: 410px) {
357
+ .gadash-wrapper .inside .small-box {
358
+ width: 45%;
359
+ }
360
+ }
admin/dashboard_widgets.php ADDED
@@ -0,0 +1,1043 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Author: Alin Marcu
4
+ * Author URI: https://deconf.com
5
+ * License: GPLv2 or later
6
+ * License URI: http://www.gnu.org/licenses/gpl-2.0.html
7
+ */
8
+ if (! class_exists('GADASH_Widgets')) {
9
+
10
+ class GADASH_Widgets
11
+ {
12
+
13
+ function __construct()
14
+ {
15
+ global $GADASH_Config;
16
+ add_action('wp_dashboard_setup', array(
17
+ $this,
18
+ 'ga_dash_setup'
19
+ ));
20
+ // Admin Styles
21
+ add_action('admin_enqueue_scripts', array(
22
+ $this,
23
+ 'ga_dash_admin_enqueue_styles'
24
+ ));
25
+ // Admin Menu
26
+ add_action('admin_menu', array(
27
+ $this,
28
+ 'ga_dash_admin_actions'
29
+ ));
30
+ // Network Menu
31
+ add_action('network_admin_menu', array(
32
+ $this,
33
+ 'ga_dash_network_actions'
34
+ ));
35
+ // Plugin Settings link
36
+ add_filter("plugin_action_links_" . plugin_basename($GADASH_Config->plugin_path) . '/gadwp.php', array(
37
+ $this,
38
+ 'ga_dash_settings_link'
39
+ ));
40
+ }
41
+
42
+ function ga_dash_admin_actions()
43
+ {
44
+ global $GADASH_Config;
45
+ global $wp_version;
46
+
47
+ if (current_user_can('manage_options')) {
48
+ include ($GADASH_Config->plugin_path . '/admin/ga_dash_settings.php');
49
+
50
+ add_menu_page(__("Google Analytics", 'ga-dash'), __("Google Analytics", 'ga-dash'), 'manage_options', 'gadash_settings', array(
51
+ 'GADASH_Settings',
52
+ 'general_settings'
53
+ ), version_compare($wp_version, '3.8.0', '>=') ? 'dashicons-chart-area' : $GADASH_Config->plugin_url . '/admin/images/gadash-icon.png');
54
+ add_submenu_page('gadash_settings', __("General Settings", 'ga-dash'), __("General Settings", 'ga-dash'), 'manage_options', 'gadash_settings', array(
55
+ 'GADASH_Settings',
56
+ 'general_settings'
57
+ ));
58
+ add_submenu_page('gadash_settings', __("Backend Settings", 'ga-dash'), __("Backend Settings", 'ga-dash'), 'manage_options', 'gadash_backend_settings', array(
59
+ 'GADASH_Settings',
60
+ 'backend_settings'
61
+ ));
62
+ add_submenu_page('gadash_settings', __("Frontend Settings", 'ga-dash'), __("Frontend Settings", 'ga-dash'), 'manage_options', 'gadash_frontend_settings', array(
63
+ 'GADASH_Settings',
64
+ 'frontend_settings'
65
+ ));
66
+ add_submenu_page('gadash_settings', __("Tracking Code", 'ga-dash'), __("Tracking Code", 'ga-dash'), 'manage_options', 'gadash_tracking_settings', array(
67
+ 'GADASH_Settings',
68
+ 'tracking_settings'
69
+ ));
70
+ }
71
+ }
72
+
73
+ function ga_dash_network_actions()
74
+ {
75
+ global $GADASH_Config;
76
+ global $wp_version;
77
+
78
+ if (current_user_can('manage_netwrok')) {
79
+ include ($GADASH_Config->plugin_path . '/admin/ga_dash_settings.php');
80
+
81
+ add_menu_page(__("Google Analytics", 'ga-dash'), __("Google Analytics", 'ga-dash'), 'manage_netwrok', 'gadash_settings', array(
82
+ 'GADASH_Settings',
83
+ 'general_settings_network'
84
+ ), version_compare($wp_version, '3.8.0', '>=') ? 'dashicons-chart-area' : $GADASH_Config->plugin_url . '/admin/images/gadash-icon.png');
85
+ add_submenu_page('gadash_settings', __("General Settings", 'ga-dash'), __("General Settings", 'ga-dash'), 'manage_netwrok', 'gadash_settings', array(
86
+ 'GADASH_Settings',
87
+ 'general_settings_network'
88
+ ));
89
+ }
90
+ }
91
+
92
+ /*
93
+ * Include styles
94
+ */
95
+ function ga_dash_admin_enqueue_styles($hook)
96
+ {
97
+ global $GADASH_Config;
98
+ $valid_hooks = array(
99
+ 'toplevel_page_gadash_settings',
100
+ 'google-analytics_page_gadash_backend_settings',
101
+ 'google-analytics_page_gadash_frontend_settings',
102
+ 'google-analytics_page_gadash_tracking_settings'
103
+ );
104
+
105
+ if (! in_array($hook, $valid_hooks) and 'index.php' != $hook)
106
+ return;
107
+
108
+ wp_enqueue_style('ga_dash-nprogress', $GADASH_Config->plugin_url . '/tools/nprogress/nprogress.css', NULL, GADWP_CURRENT_VERSION);
109
+
110
+ wp_register_style('ga_dash', $GADASH_Config->plugin_url . '/admin/css/ga_dash.css', NULL, GADWP_CURRENT_VERSION);
111
+
112
+ wp_enqueue_style('ga_dash');
113
+ wp_enqueue_style('wp-color-picker');
114
+ wp_enqueue_script('wp-color-picker');
115
+ wp_enqueue_script('wp-color-picker-script-handle', plugins_url('js/wp-color-picker-script.js', __FILE__), array(
116
+ 'wp-color-picker'
117
+ ), false, true);
118
+ wp_enqueue_script('gadash-general-settings', plugins_url('js/admin.js', __FILE__), array(
119
+ 'jquery'
120
+ ), GADWP_CURRENT_VERSION);
121
+ if (! wp_script_is('googlejsapi')) {
122
+ wp_register_script('googlejsapi', 'https://www.google.com/jsapi');
123
+ wp_enqueue_script('googlejsapi');
124
+ }
125
+ wp_enqueue_script('ga_dash-nprogress', $GADASH_Config->plugin_url . '/tools/nprogress/nprogress.js', array(
126
+ 'jquery'
127
+ ), GADWP_CURRENT_VERSION);
128
+ }
129
+
130
+ function ga_dash_settings_link($links)
131
+ {
132
+ $settings_link = '<a href="' . get_admin_url(null, 'admin.php?page=gadash_settings') . '">' . __("Settings", 'ga-dash') . '</a>';
133
+ array_unshift($links, $settings_link);
134
+ return $links;
135
+ }
136
+
137
+ function ga_dash_setup()
138
+ {
139
+ global $GADASH_Config;
140
+
141
+ /*
142
+ * Include Tools
143
+ */
144
+ include_once ($GADASH_Config->plugin_path . '/tools/tools.php');
145
+ $tools = new GADASH_Tools();
146
+
147
+ if ($tools->check_roles($GADASH_Config->options['ga_dash_access_back'])) {
148
+ wp_add_dashboard_widget('gadash-widget', __("Google Analytics Dashboard", 'ga-dash'), array(
149
+ $this,
150
+ 'gadash_dashboard_widgets'
151
+ ), $control_callback = null);
152
+ }
153
+ }
154
+
155
+ function gadash_dashboard_widgets()
156
+ {
157
+ global $GADASH_Config;
158
+
159
+ /*
160
+ * Include GAPI
161
+ */
162
+ if ($GADASH_Config->options['ga_dash_token'] and function_exists('curl_version')) {
163
+ include_once ($GADASH_Config->plugin_path . '/tools/gapi.php');
164
+ global $GADASH_GAPI;
165
+ } else {
166
+ echo '<p>' . __("This plugin needs an authorization:", 'ga-dash') . '</p><form action="' . menu_page_url('gadash_settings', false) . '" method="POST">' . get_submit_button(__("Authorize Plugin", 'ga-dash'), 'secondary') . '</form>';
167
+ return;
168
+ }
169
+
170
+ /*
171
+ * Include Tools
172
+ */
173
+ include_once ($GADASH_Config->plugin_path . '/tools/tools.php');
174
+ $tools = new GADASH_Tools();
175
+
176
+ $tools->ga_dash_cleanup_timeouts();
177
+
178
+ if (current_user_can('manage_options')) {
179
+
180
+ if (isset($_REQUEST['ga_dash_profile_select'])) {
181
+ $GADASH_Config->options['ga_dash_tableid'] = $_REQUEST['ga_dash_profile_select'];
182
+ }
183
+
184
+ $profiles = $GADASH_Config->options['ga_dash_profile_list'];
185
+ $profile_switch = '';
186
+
187
+ if (is_array($profiles)) {
188
+ if (! $GADASH_Config->options['ga_dash_tableid']) {
189
+ if ($GADASH_Config->options['ga_dash_tableid_jail']) {
190
+ $GADASH_Config->options['ga_dash_tableid'] = $GADASH_Config->options['ga_dash_tableid_jail'];
191
+ } else {
192
+ $GADASH_Config->options['ga_dash_tableid'] = $tools->guess_default_domain($profiles);
193
+ }
194
+ } else
195
+ if ($GADASH_Config->options['ga_dash_jailadmins'] and $GADASH_Config->options['ga_dash_tableid_jail']) {
196
+ $GADASH_Config->options['ga_dash_tableid'] = $GADASH_Config->options['ga_dash_tableid_jail'];
197
+ }
198
+
199
+ $profile_switch .= '<select id="ga_dash_profile_select" name="ga_dash_profile_select" onchange="this.form.submit()">';
200
+ foreach ($profiles as $profile) {
201
+ if (! $GADASH_Config->options['ga_dash_tableid']) {
202
+ $GADASH_Config->options['ga_dash_tableid'] = $profile[1];
203
+ }
204
+ if (isset($profile[3])) {
205
+ $profile_switch .= '<option value="' . esc_attr($profile[1]) . '" ';
206
+ $profile_switch .= selected($profile[1], $GADASH_Config->options['ga_dash_tableid'], false);
207
+ $profile_switch .= ' title="' . __("View Name:", 'ga-dash') . ' ' . esc_attr($profile[0]) . '">' . esc_attr($tools->ga_dash_get_profile_domain($profile[3])) . '</option>';
208
+ }
209
+ }
210
+ $profile_switch .= "</select>";
211
+ } else {
212
+ echo '<p>' . __("Something went wrong while retrieving profiles list.", 'ga-dash') . '</p><form action="' . menu_page_url('gadash_settings', false) . '" method="POST">' . get_submit_button(__("More details", 'ga-dash'), 'secondary') . '</form>';
213
+ return;
214
+ }
215
+ }
216
+
217
+ $GADASH_Config->set_plugin_options();
218
+
219
+ ?>
220
+ <form id="ga-dash" method="POST">
221
+ <?php
222
+
223
+ if (current_user_can('manage_options')) {
224
+ if ($GADASH_Config->options['ga_dash_jailadmins']) {
225
+ if ($GADASH_Config->options['ga_dash_tableid_jail']) {
226
+ $projectId = $GADASH_Config->options['ga_dash_tableid_jail'];
227
+ } else {
228
+ echo '<p>' . __("An admin should asign a default Google Analytics Profile.", 'ga-dash') . '</p><form action="' . menu_page_url('gadash_settings', false) . '" method="POST">' . get_submit_button(__("Select Domain", 'ga-dash'), 'secondary') . '</form>';
229
+ return;
230
+ }
231
+ } else {
232
+ echo $profile_switch;
233
+ $projectId = $GADASH_Config->options['ga_dash_tableid'];
234
+ }
235
+ } else {
236
+ if ($GADASH_Config->options['ga_dash_tableid_jail']) {
237
+ $projectId = $GADASH_Config->options['ga_dash_tableid_jail'];
238
+ } else {
239
+ echo '<p>' . __("An admin should asign a default Google Analytics Profile.", 'ga-dash') . '</p><form action="' . menu_page_url('gadash_settings', false) . '" method="POST">' . get_submit_button(__("Select Domain", 'ga-dash'), 'secondary') . '</form>';
240
+ return;
241
+ }
242
+ }
243
+
244
+ if (! ($projectId)) {
245
+ echo '<p>' . __("Something went wrong while retrieving property data. You need to create and properly configure a Google Analytics account:", 'ga-dash') . '</p> <form action="https://deconf.com/how-to-set-up-google-analytics-on-your-website/" method="POST">' . get_submit_button(__("Find out more!", 'ga-dash'), 'secondary') . '</form>';
246
+ return;
247
+ } else {
248
+ $profile_info = $tools->get_selected_profile($GADASH_Config->options['ga_dash_profile_list'], $projectId);
249
+ if (isset($profile_info[4])) {
250
+ $GADASH_GAPI->timeshift = $profile_info[4];
251
+ } else {
252
+ $GADASH_GAPI->timeshift = (int) current_time('timestamp') - time();
253
+ }
254
+ }
255
+
256
+ if (isset($_REQUEST['query'])) {
257
+ $query = $_REQUEST['query'];
258
+ $GADASH_Config->options['ga_dash_default_metric'] = $query;
259
+ $GADASH_Config->set_plugin_options();
260
+ } else {
261
+ $query = isset($GADASH_Config->options['ga_dash_default_metric']) ? $GADASH_Config->options['ga_dash_default_metric'] : 'sessions';
262
+ }
263
+
264
+ if (isset($_REQUEST['period'])) {
265
+ $period = $_REQUEST['period'];
266
+ $GADASH_Config->options['ga_dash_default_dimension'] = $period;
267
+ $GADASH_Config->set_plugin_options();
268
+ } else {
269
+ $period = isset($GADASH_Config->options['ga_dash_default_dimension']) ? $GADASH_Config->options['ga_dash_default_dimension'] : '30daysAgo';
270
+ }
271
+
272
+ ?>
273
+
274
+ <select id="ga_dash_period" name="period" onchange="this.form.submit()">
275
+ <option value="realtime"
276
+ <?php selected ( "realtime", $period, true ); ?>><?php _e("Real-Time",'ga-dash'); ?></option>
277
+ <option value="today" <?php selected ( "today", $period, true ); ?>><?php _e("Today",'ga-dash'); ?></option>
278
+ <option value="yesterday"
279
+ <?php selected ( "yesterday", $period, true ); ?>><?php _e("Yesterday",'ga-dash'); ?></option>
280
+ <option value="7daysAgo"
281
+ <?php selected ( "7daysAgo", $period, true ); ?>><?php _e("Last 7 Days",'ga-dash'); ?></option>
282
+ <option value="14daysAgo"
283
+ <?php selected ( "14daysAgo", $period, true ); ?>><?php _e("Last 14 Days",'ga-dash'); ?></option>
284
+ <option value="30daysAgo"
285
+ <?php selected ( "30daysAgo", $period, true ); ?>><?php _e("Last 30 Days",'ga-dash'); ?></option>
286
+ <option value="90daysAgo"
287
+ <?php selected ( "90daysAgo", $period, true ); ?>><?php _e("Last 90 Days",'ga-dash'); ?></option>
288
+ </select>
289
+ <?php if ($period != 'realtime') {?>
290
+ <select id="ga_dash_query" name="query"
291
+ onchange="this.form.submit()">
292
+ <option value="sessions"
293
+ <?php selected ( "sessions", $query, true ); ?>><?php _e("Sessions",'ga-dash'); ?></option>
294
+ <option value="users" <?php selected ( "users", $query, true ); ?>><?php _e("Users",'ga-dash'); ?></option>
295
+ <option value="organicSearches"
296
+ <?php selected ( "organicSearches", $query, true ); ?>><?php _e("Organic",'ga-dash'); ?></option>
297
+ <option value="pageviews"
298
+ <?php selected ( "pageviews", $query, true ); ?>><?php _e("Page Views",'ga-dash'); ?></option>
299
+ <option value="visitBounceRate"
300
+ <?php selected ( "visitBounceRate", $query, true ); ?>><?php _e("Bounce Rate",'ga-dash'); ?></option>
301
+ <option value="locations"
302
+ <?php selected ( "locations", $query, true ); ?>><?php _e("Location",'ga-dash'); ?></option>
303
+ <option value="contentpages"
304
+ <?php selected ( "contentpages", $query, true ); ?>><?php _e("Pages",'ga-dash'); ?></option>
305
+ <option value="referrers"
306
+ <?php selected ( "referrers", $query, true ); ?>><?php _e("Referrers",'ga-dash'); ?></option>
307
+ <option value="searches"
308
+ <?php selected ( "searches", $query, true ); ?>><?php _e("Searches",'ga-dash'); ?></option>
309
+ <option value="trafficdetails"
310
+ <?php selected ( "trafficdetails", $query, true ); ?>><?php _e("Traffic Details",'ga-dash'); ?></option>
311
+ </select>
312
+ <?php }?>
313
+ </form>
314
+ <div id="gadash-progressbar"></div>
315
+ <?php
316
+ switch ($period) {
317
+
318
+ case 'today':
319
+ $from = 'today';
320
+ $to = 'today';
321
+ $haxis = 4;
322
+ break;
323
+
324
+ case 'yesterday':
325
+ $from = 'yesterday';
326
+ $to = 'yesterday';
327
+ $haxis = 4;
328
+ break;
329
+
330
+ case '7daysAgo':
331
+ $from = '7daysAgo';
332
+ $to = 'yesterday';
333
+ $haxis = 2;
334
+ break;
335
+
336
+ case '14daysAgo':
337
+ $from = '14daysAgo';
338
+ $to = 'yesterday';
339
+ $haxis = 3;
340
+ break;
341
+
342
+ case '30daysAgo':
343
+ $from = '30daysAgo';
344
+ $to = 'yesterday';
345
+ $haxis = 5;
346
+ break;
347
+
348
+ default:
349
+ $from = '90daysAgo';
350
+ $to = 'yesterday';
351
+ $haxis = 16;
352
+ break;
353
+ }
354
+
355
+ if ($query == 'visitBounceRate') {
356
+ $formater = "var formatter = new google.visualization.NumberFormat({
357
+ pattern: '#,##%',
358
+ fractionDigits: 2
359
+ });
360
+
361
+ formatter.format(data, 1); ";
362
+ } else {
363
+ $formater = '';
364
+ }
365
+
366
+ /*
367
+ * Include Tools
368
+ */
369
+ include_once ($GADASH_Config->plugin_path . '/tools/tools.php');
370
+ $tools = new GADASH_Tools();
371
+
372
+ if (isset($GADASH_Config->options['ga_dash_style'])) {
373
+ $light_color = $tools->colourVariator($GADASH_Config->options['ga_dash_style'], 40);
374
+ $dark_color = $tools->colourVariator($GADASH_Config->options['ga_dash_style'], - 20);
375
+ $css = "colors:['" . $GADASH_Config->options['ga_dash_style'] . "','" . $tools->colourVariator($GADASH_Config->options['ga_dash_style'], - 20) . "'],";
376
+ $color = $GADASH_Config->options['ga_dash_style'];
377
+ } else {
378
+ $css = "";
379
+ $color = "#3366CC";
380
+ }
381
+
382
+ if ($period == 'realtime') {
383
+
384
+ wp_register_style('jquery-ui-tooltip-html', $GADASH_Config->plugin_url . '/realtime/jquery/jquery.ui.tooltip.html.css');
385
+ wp_enqueue_style('jquery-ui-tooltip-html');
386
+
387
+ if (! wp_script_is('jquery')) {
388
+ wp_enqueue_script('jquery');
389
+ }
390
+ if (! wp_script_is('jquery-ui-tooltip')) {
391
+ wp_enqueue_script("jquery-ui-tooltip");
392
+ }
393
+ if (! wp_script_is('jquery-ui-core')) {
394
+ wp_enqueue_script("jquery-ui-core");
395
+ }
396
+ if (! wp_script_is('jquery-ui-position')) {
397
+ wp_enqueue_script("jquery-ui-position");
398
+ }
399
+ if (! wp_script_is('jquery-ui-position')) {
400
+ wp_enqueue_script("jquery-ui-position");
401
+ }
402
+
403
+ wp_register_script("jquery-ui-tooltip-html", $GADASH_Config->plugin_url . '/realtime/jquery/jquery.ui.tooltip.html.js');
404
+ wp_enqueue_script("jquery-ui-tooltip-html");
405
+ }
406
+
407
+ if ($period == 'realtime') {
408
+ ?>
409
+ <div class="realtime">
410
+ <div class="gadash-rt-box">
411
+ <div class='gadash-tdo-left'>
412
+ <div class='gadash-online' id='gadash-online'>0</div>
413
+ </div>
414
+ <div class='gadash-tdo-right' id='gadash-tdo-right'>
415
+ <div class="gadash-bigtext">
416
+ <div class="gadash-bleft"><?php _e( "REFERRAL", 'ga-dash' );?></div>
417
+ <div class="gadash-bright">0</div>
418
+ </div>
419
+ <div class="gadash-bigtext">
420
+ <div class="gadash-bleft"><?php _e( "ORGANIC", 'ga-dash' );?></div>
421
+ <div class="gadash-bright">0</div>
422
+ </div>
423
+ <div class="gadash-bigtext">
424
+ <div class="gadash-bleft"><?php _e( "SOCIAL", 'ga-dash' );?></div>
425
+ <div class="gadash-bright">0</div>
426
+ </div>
427
+ <div class="gadash-bigtext">
428
+ <div class="gadash-bleft"><?php _e( "CAMPAIGN", 'ga-dash' );?></div>
429
+ <div class="gadash-bright">0</div>
430
+ </div>
431
+ <div class="gadash-bigtext">
432
+ <div class="gadash-bleft"><?php _e( "DIRECT", 'ga-dash' );?></div>
433
+ <div class="gadash-bright">0</div>
434
+ </div>
435
+ <div class="gadash-bigtext">
436
+ <div class="gadash-bleft"><?php _e( "NEW", 'ga-dash' );?></div>
437
+ <div class="gadash-bright">0</div>
438
+ </div>
439
+ </div>
440
+ </div>
441
+ <div>
442
+ <div id='gadash-pages' class='gadash-pages'>&nbsp;</div>
443
+ </div>
444
+ </div>
445
+ <script type="text/javascript">
446
+
447
+ var focusFlag = 1;
448
+
449
+ jQuery(document).ready(function(){
450
+ jQuery(window).bind("focus",function(event){
451
+ focusFlag = 1;
452
+ }).bind("blur", function(event){
453
+ focusFlag = 0;
454
+ });
455
+ });
456
+
457
+ jQuery(function() {
458
+ jQuery( document ).tooltip();
459
+ });
460
+
461
+ function onlyUniqueValues(value, index, self) {
462