Version Description
- Bug Fix: add an unique class to jQuery UI Tooltips to avoid conflicts
- Bug Fix: multiple CSS improvements
- Bug Fix: invalid localized date formats
- Bug Fix: switching between multisite modes doesn't propagate the new network status on all sites
- Bug Fix: Location Settings ignored in posts/pages reports
- Enhancement: unset cookies while revoking the authorization or clearing the cache
- Enhancement: no more page re-loads on admin dashboard widget when switching between reports
- Enhancement: unified reporting system with real-time capabilities
- Enhancement: new tracking options enabling you to customize cookieName, cookieDomain, cookieExpires; props by Martins Sipenko
- Enhancement: display update notices only to admins and only on dashboard
- Enhancement: force language packs updates for all available languages on a Network
- Enhancement: added View switch capabilities
Download this release
Release Info
Developer | deconf |
Plugin | Google Analytics Dashboard for WP (GADWP) |
Version | 4.9 |
Comparing to | |
See all releases |
Code changes from version 4.8.3 to 4.9
- admin/ajax-actions-ui.php +1 -1
- admin/ajax-actions.php +34 -76
- admin/css/admin-widgets.css +185 -0
- admin/css/gadwp.css +22 -203
- admin/settings.php +21 -4
- admin/setup.php +124 -23
- admin/widgets.php +8 -873
- common/js/reports.js +1199 -0
- common/nprogress/nprogress.css +67 -0
- common/nprogress/nprogress.js +476 -0
- common/realtime/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- common/realtime/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- common/realtime/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- common/realtime/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- common/realtime/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- common/realtime/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- common/realtime/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- common/realtime/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- common/realtime/images/ui-icons_222222_256x240.png +0 -0
- common/realtime/images/ui-icons_2e83ff_256x240.png +0 -0
- common/realtime/images/ui-icons_454545_256x240.png +0 -0
- common/realtime/images/ui-icons_888888_256x240.png +0 -0
- common/realtime/images/ui-icons_cd0a0a_256x240.png +0 -0
- common/realtime/jquery.ui.tooltip.html.css +57 -0
- common/realtime/jquery.ui.tooltip.html.js +8 -0
- config.php +42 -21
- front/ajax-actions.php +9 -9
- front/setup.php +6 -5
- front/tracking/code-universal.php +17 -2
- front/widgets.php +2 -2
- gadwp.php +2 -2
- install/install.php +6 -3
- install/uninstall.php +3 -0
- readme.txt +19 -5
- tools/gapi.php +27 -25
- tools/js/item-reports.js +0 -737
- tools/tools.php +6 -15
admin/ajax-actions-ui.php
CHANGED
@@ -27,7 +27,7 @@ if ( ! class_exists( 'GADWP_UI_Ajax' ) ) {
|
|
27 |
* @return json|int
|
28 |
*/
|
29 |
public function ajax_dismiss_notices() {
|
30 |
-
if ( ! isset( $
|
31 |
wp_die( - 30 );
|
32 |
}
|
33 |
|
27 |
* @return json|int
|
28 |
*/
|
29 |
public function ajax_dismiss_notices() {
|
30 |
+
if ( ! isset( $_POST['gadwp_security_dismiss_notices'] ) || ! wp_verify_nonce( $_POST['gadwp_security_dismiss_notices'], 'gadwp_dismiss_notices' ) ) {
|
31 |
wp_die( - 30 );
|
32 |
}
|
33 |
|
admin/ajax-actions.php
CHANGED
@@ -19,12 +19,7 @@ if ( ! class_exists( 'GADWP_Backend_Ajax' ) ) {
|
|
19 |
public function __construct() {
|
20 |
$this->gadwp = GADWP();
|
21 |
|
22 |
-
if ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) && ( 1 == $this->gadwp->config->options['dashboard_widget'] ) ) {
|
23 |
-
// Admin Widget action
|
24 |
-
add_action( 'wp_ajax_gadash_get_widgetreports', array( $this, 'ajax_widget_reports' ) );
|
25 |
-
}
|
26 |
-
|
27 |
-
if ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) && ( 1 == $this->gadwp->config->options['backend_item_reports'] ) ) {
|
28 |
// Items action
|
29 |
add_action( 'wp_ajax_gadwp_backend_item_reports', array( $this, 'ajax_item_reports' ) );
|
30 |
}
|
@@ -36,15 +31,22 @@ if ( ! class_exists( 'GADWP_Backend_Ajax' ) ) {
|
|
36 |
* @return json|int
|
37 |
*/
|
38 |
public function ajax_item_reports() {
|
39 |
-
if ( ! isset( $
|
40 |
wp_die( - 30 );
|
41 |
}
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
if ( ob_get_length() ) {
|
49 |
ob_clean();
|
50 |
}
|
@@ -59,7 +61,9 @@ if ( ! class_exists( 'GADWP_Backend_Ajax' ) ) {
|
|
59 |
} else {
|
60 |
wp_die( - 24 );
|
61 |
}
|
62 |
-
$projectId
|
|
|
|
|
63 |
$profile_info = GADWP_Tools::get_selected_profile( $this->gadwp->config->options['ga_dash_profile_list'], $projectId );
|
64 |
if ( isset( $profile_info[4] ) ) {
|
65 |
$this->gadwp->gapi_controller->timeshift = $profile_info[4];
|
@@ -67,74 +71,28 @@ if ( ! class_exists( 'GADWP_Backend_Ajax' ) ) {
|
|
67 |
$this->gadwp->gapi_controller->timeshift = (int) current_time( 'timestamp' ) - time();
|
68 |
}
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
if ( isset( $uri_parts[3] ) ) {
|
73 |
-
$uri = '/' . $uri_parts[3];
|
74 |
-
} else {
|
75 |
-
wp_die( - 25 );
|
76 |
-
}
|
77 |
-
|
78 |
-
// allow URL correction before sending an API request
|
79 |
-
$filter = apply_filters( 'gadwp_backenditem_uri', $uri );
|
80 |
-
|
81 |
-
$lastchar = substr( $filter, - 1 );
|
82 |
-
|
83 |
-
if ( isset( $profile_info[6] ) && $profile_info[6] && $lastchar == '/' ) {
|
84 |
-
$filter = $filter . $profile_info[6];
|
85 |
-
}
|
86 |
-
|
87 |
-
// Encode URL
|
88 |
-
$filter = rawurlencode( rawurldecode( $filter ) );
|
89 |
-
|
90 |
-
$queries = explode( ',', $query );
|
91 |
-
|
92 |
-
$results = array();
|
93 |
-
|
94 |
-
foreach ( $queries as $value ) {
|
95 |
-
$results[] = $this->gadwp->gapi_controller->get( $projectId, $value, $from, $to, $filter );
|
96 |
-
}
|
97 |
-
|
98 |
-
wp_send_json( $results );
|
99 |
-
}
|
100 |
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
public function ajax_widget_reports() {
|
107 |
-
if ( ! isset( $_REQUEST['gadash_security_widget_reports'] ) || ! wp_verify_nonce( $_REQUEST['gadash_security_widget_reports'], 'gadash_get_widgetreports' ) ) {
|
108 |
-
wp_die( - 30 );
|
109 |
-
}
|
110 |
-
|
111 |
-
$projectId = $_REQUEST['projectId'];
|
112 |
-
$from = $_REQUEST['from'];
|
113 |
-
$to = $_REQUEST['to'];
|
114 |
-
$query = $_REQUEST['query'];
|
115 |
|
116 |
-
|
117 |
-
|
118 |
-
}
|
119 |
|
120 |
-
|
121 |
-
wp_die( - 31 );
|
122 |
-
}
|
123 |
|
124 |
-
|
125 |
-
|
126 |
-
$this->gadwp->gapi_controller = new GADWP_GAPI_Controller();
|
127 |
}
|
128 |
-
} else {
|
129 |
-
wp_die( - 24 );
|
130 |
-
}
|
131 |
|
132 |
-
|
133 |
-
|
134 |
-
if ( isset( $profile_info[4] ) ) {
|
135 |
-
$this->gadwp->gapi_controller->timeshift = $profile_info[4];
|
136 |
} else {
|
137 |
-
$
|
138 |
}
|
139 |
|
140 |
$queries = explode( ',', $query );
|
@@ -142,7 +100,7 @@ if ( ! class_exists( 'GADWP_Backend_Ajax' ) ) {
|
|
142 |
$results = array();
|
143 |
|
144 |
foreach ( $queries as $value ) {
|
145 |
-
$results[] = $this->gadwp->gapi_controller->get( $projectId, $value, $from, $to );
|
146 |
}
|
147 |
|
148 |
wp_send_json( $results );
|
19 |
public function __construct() {
|
20 |
$this->gadwp = GADWP();
|
21 |
|
22 |
+
if ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) && ( ( 1 == $this->gadwp->config->options['backend_item_reports'] ) || ( 1 == $this->gadwp->config->options['dashboard_widget'] ) ) ) {
|
|
|
|
|
|
|
|
|
|
|
23 |
// Items action
|
24 |
add_action( 'wp_ajax_gadwp_backend_item_reports', array( $this, 'ajax_item_reports' ) );
|
25 |
}
|
31 |
* @return json|int
|
32 |
*/
|
33 |
public function ajax_item_reports() {
|
34 |
+
if ( ! isset( $_POST['gadwp_security_backend_item_reports'] ) || ! wp_verify_nonce( $_POST['gadwp_security_backend_item_reports'], 'gadwp_backend_item_reports' ) ) {
|
35 |
wp_die( - 30 );
|
36 |
}
|
37 |
+
if ( isset( $_POST['projectId'] ) && $this->gadwp->config->options['switch_profile'] && $_POST['projectId'] !== 'false' ) {
|
38 |
+
$projectId = $_POST['projectId'];
|
39 |
+
} else {
|
40 |
+
$projectId = false;
|
41 |
+
}
|
42 |
+
$from = $_POST['from'];
|
43 |
+
$to = $_POST['to'];
|
44 |
+
$query = $_POST['query'];
|
45 |
+
if ( isset( $_POST['filter'] ) ) {
|
46 |
+
$filter_id = $_POST['filter'];
|
47 |
+
} else {
|
48 |
+
$filter_id = false;
|
49 |
+
}
|
50 |
if ( ob_get_length() ) {
|
51 |
ob_clean();
|
52 |
}
|
61 |
} else {
|
62 |
wp_die( - 24 );
|
63 |
}
|
64 |
+
if ( $projectId == false ) {
|
65 |
+
$projectId = $this->gadwp->config->options['ga_dash_tableid_jail'];
|
66 |
+
}
|
67 |
$profile_info = GADWP_Tools::get_selected_profile( $this->gadwp->config->options['ga_dash_profile_list'], $projectId );
|
68 |
if ( isset( $profile_info[4] ) ) {
|
69 |
$this->gadwp->gapi_controller->timeshift = $profile_info[4];
|
71 |
$this->gadwp->gapi_controller->timeshift = (int) current_time( 'timestamp' ) - time();
|
72 |
}
|
73 |
|
74 |
+
if ( $filter_id ) {
|
75 |
+
$uri_parts = explode( '/', get_permalink( $filter_id ), 4 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
|
77 |
+
if ( isset( $uri_parts[3] ) ) {
|
78 |
+
$uri = '/' . $uri_parts[3];
|
79 |
+
} else {
|
80 |
+
wp_die( - 25 );
|
81 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
+
// allow URL correction before sending an API request
|
84 |
+
$filter = apply_filters( 'gadwp_backenditem_uri', $uri );
|
|
|
85 |
|
86 |
+
$lastchar = substr( $filter, - 1 );
|
|
|
|
|
87 |
|
88 |
+
if ( isset( $profile_info[6] ) && $profile_info[6] && $lastchar == '/' ) {
|
89 |
+
$filter = $filter . $profile_info[6];
|
|
|
90 |
}
|
|
|
|
|
|
|
91 |
|
92 |
+
// Encode URL
|
93 |
+
$filter = rawurlencode( rawurldecode( $filter ) );
|
|
|
|
|
94 |
} else {
|
95 |
+
$filter = false;
|
96 |
}
|
97 |
|
98 |
$queries = explode( ',', $query );
|
100 |
$results = array();
|
101 |
|
102 |
foreach ( $queries as $value ) {
|
103 |
+
$results[] = $this->gadwp->gapi_controller->get( $projectId, $value, $from, $to, $filter );
|
104 |
}
|
105 |
|
106 |
wp_send_json( $results );
|
admin/css/admin-widgets.css
ADDED
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* Admin Widget & Real-Time Stats*/
|
2 |
+
|
3 |
+
/* Real-Time content */
|
4 |
+
.gadwp-pline {
|
5 |
+
width: 100%;
|
6 |
+
margin: 0 0;
|
7 |
+
padding: 5px 0 5px 0;
|
8 |
+
background: #fff;
|
9 |
+
-moz-box-shadow: 0px 0px 3px 0px #BBB;
|
10 |
+
-webkit-box-shadow: 0px 0px 3px 0px #BBB;
|
11 |
+
box-shadow: 0px 0px 3px 0px #BBB;
|
12 |
+
display: table;
|
13 |
+
overflow: hidden;
|
14 |
+
}
|
15 |
+
|
16 |
+
.gadwp-pleft {
|
17 |
+
width: 90%;
|
18 |
+
float: left;
|
19 |
+
padding-left: 5px;
|
20 |
+
}
|
21 |
+
|
22 |
+
.gadwp-pright {
|
23 |
+
width: 5%;
|
24 |
+
float: right;
|
25 |
+
padding-right: 5px;
|
26 |
+
}
|
27 |
+
|
28 |
+
[id^=gadwp-realtime] {
|
29 |
+
margin: 10px 0 0 0;
|
30 |
+
width: 100%;
|
31 |
+
}
|
32 |
+
|
33 |
+
.gadwp-rt-box {
|
34 |
+
width: 100%;
|
35 |
+
margin: 0 0;
|
36 |
+
background: #fff;
|
37 |
+
text-align: center;
|
38 |
+
-moz-box-shadow: 0px 0px 5px 0px #BBB;
|
39 |
+
-webkit-box-shadow: 0px 0px 5px 0px #BBB;
|
40 |
+
box-shadow: 0px 0px 5px 0px #BBB;
|
41 |
+
display: table;
|
42 |
+
}
|
43 |
+
|
44 |
+
.gadwp-tdo-left {
|
45 |
+
width: 60%;
|
46 |
+
padding: 33px 0;
|
47 |
+
float: left;
|
48 |
+
text-align: center;
|
49 |
+
}
|
50 |
+
|
51 |
+
.gadwp-tdo-right {
|
52 |
+
width: 35%;
|
53 |
+
margin: 0px 10px 0px 0;
|
54 |
+
text-align: left;
|
55 |
+
font-weight: bold;
|
56 |
+
vertical-align: middle;
|
57 |
+
float: right;
|
58 |
+
display: table;
|
59 |
+
}
|
60 |
+
|
61 |
+
.gadwp-online {
|
62 |
+
font-size: 100px;
|
63 |
+
font-weight: normal;
|
64 |
+
line-height: 1em;
|
65 |
+
margin: 0 auto;
|
66 |
+
width: 80%;
|
67 |
+
}
|
68 |
+
|
69 |
+
.gadwp-bigtext {
|
70 |
+
font-size: 14px;
|
71 |
+
width: 100%;
|
72 |
+
margin: 0 0;
|
73 |
+
padding: 5px 5px 5px 5px;
|
74 |
+
background: #fff;
|
75 |
+
-moz-box-shadow: 0px 0px 3px 0px #BBB;
|
76 |
+
-webkit-box-shadow: 0px 0px 3px 0px #BBB;
|
77 |
+
box-shadow: 0px 0px 3px 0px #BBB;
|
78 |
+
display: table;
|
79 |
+
overflow: hidden;
|
80 |
+
}
|
81 |
+
|
82 |
+
.gadwp-bleft {
|
83 |
+
float: left;
|
84 |
+
width: 80%;
|
85 |
+
}
|
86 |
+
|
87 |
+
.gadwp-bright {
|
88 |
+
float: right;
|
89 |
+
width: 20%;
|
90 |
+
}
|
91 |
+
|
92 |
+
.gadwp-pgdetailsr {
|
93 |
+
padding-left: 20px;
|
94 |
+
text-align: right;
|
95 |
+
}
|
96 |
+
|
97 |
+
.gadwp-pgdetailsl {
|
98 |
+
min-width: 250px;
|
99 |
+
}
|
100 |
+
|
101 |
+
[id^=gadwp-mainchart] {
|
102 |
+
width: 98%;
|
103 |
+
height: 100%;
|
104 |
+
margin: 10px auto 10px 0;
|
105 |
+
height: 250px;
|
106 |
+
}
|
107 |
+
|
108 |
+
.gadwp-floatwraper {
|
109 |
+
display: table;
|
110 |
+
width: 100%;
|
111 |
+
height: 100%;
|
112 |
+
}
|
113 |
+
|
114 |
+
[id^=gadwp-trafficmediums], [id^=gadwp-traffictype], [id^=gadwp-socialnetworks], [id^=gadwp-trafficorganic] {
|
115 |
+
width: 47%;
|
116 |
+
margin: 10px 0 0 0;
|
117 |
+
height: 200px;
|
118 |
+
}
|
119 |
+
|
120 |
+
[id^=gadwp-trafficmediums], [id^=gadwp-trafficorganic] {
|
121 |
+
float: left;
|
122 |
+
}
|
123 |
+
|
124 |
+
[id^=gadwp-traffictype], [id^=gadwp-socialnetworks] {
|
125 |
+
float: right;
|
126 |
+
}
|
127 |
+
|
128 |
+
[id^=gadwp-locations], [id^=gadwp-prs] {
|
129 |
+
width: 98%;
|
130 |
+
height: 100%;
|
131 |
+
margin: 10px auto 10px 0;
|
132 |
+
}
|
133 |
+
|
134 |
+
#dashboard-widgets-wrap .postbox {
|
135 |
+
margin-right: 10px;
|
136 |
+
}
|
137 |
+
|
138 |
+
/* Admin Widget content */
|
139 |
+
[id^=gadwp-progressbar] {
|
140 |
+
width: 100%;
|
141 |
+
height: 3px;
|
142 |
+
margin: 5px 0 0px 0;
|
143 |
+
}
|
144 |
+
|
145 |
+
.gadwp-wrapper {
|
146 |
+
width: 100%;
|
147 |
+
}
|
148 |
+
|
149 |
+
.gadwp-wrapper .inside {
|
150 |
+
display: table;
|
151 |
+
margin: 0 auto;
|
152 |
+
padding: 0px;
|
153 |
+
}
|
154 |
+
|
155 |
+
.gadwp-wrapper .inside .small-box {
|
156 |
+
width: 30%;
|
157 |
+
float: left;
|
158 |
+
margin: 0 5px 10px 5px;
|
159 |
+
background: #fff;
|
160 |
+
text-align: center;
|
161 |
+
-moz-box-shadow: 0px 0px 7px 0px #BBB;
|
162 |
+
-webkit-box-shadow: 0px 0px 7px 0px #BBB;
|
163 |
+
box-shadow: 0px 0px 7px 0px #BBB;
|
164 |
+
}
|
165 |
+
|
166 |
+
.gadwp-wrapper .inside .small-box h3 {
|
167 |
+
font-size: 1em;
|
168 |
+
color: #777;
|
169 |
+
padding: 0px 5px 0px 5px;
|
170 |
+
margin: 0px 0px 0px 0px;
|
171 |
+
text-overflow: ellipsis;
|
172 |
+
overflow: hidden;
|
173 |
+
white-space: nowrap;
|
174 |
+
}
|
175 |
+
|
176 |
+
.gadwp-wrapper .inside .small-box p {
|
177 |
+
font-size: 1.2em;
|
178 |
+
margin: 0px 0px 2px 0px;
|
179 |
+
}
|
180 |
+
|
181 |
+
@media screen and (max-width: 410px) {
|
182 |
+
.gadwp-wrapper .inside .small-box {
|
183 |
+
width: 45%;
|
184 |
+
}
|
185 |
+
}
|
admin/css/gadwp.css
CHANGED
@@ -68,27 +68,37 @@ td.gadwp-settings-roles {
|
|
68 |
|
69 |
#poststuff.gadwp h2 {
|
70 |
padding-bottom: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
}
|
72 |
|
73 |
/* Options pages ON/OFF Switch */
|
74 |
-
.gadwp-settings-switchoo {
|
75 |
position: relative;
|
76 |
width: 50px;
|
77 |
float: left;
|
78 |
-
border: none
|
79 |
-
padding: 0
|
80 |
-
height: 22px
|
81 |
-
-moz-box-shadow: none
|
82 |
-
-webkit-box-shadow: none
|
83 |
-
-o-box-shadow: none
|
84 |
-
box-shadow: none
|
85 |
-webkit-user-select: none;
|
86 |
-moz-user-select: none;
|
87 |
-ms-user-select: none;
|
88 |
}
|
89 |
|
90 |
-
.gadwp-settings-switchoo-checkbox {
|
91 |
-
display: none
|
92 |
}
|
93 |
|
94 |
.gadwp-settings-switchoo-label {
|
@@ -98,6 +108,7 @@ td.gadwp-settings-roles {
|
|
98 |
background: transparent;
|
99 |
border: 1px solid #ddd;
|
100 |
border-radius: 2px;
|
|
|
101 |
}
|
102 |
|
103 |
.gadwp-settings-switchoo-inner {
|
@@ -121,6 +132,7 @@ td.gadwp-settings-roles {
|
|
121 |
height: 22px;
|
122 |
line-height: 22px;
|
123 |
font-size: 12px;
|
|
|
124 |
}
|
125 |
|
126 |
.gadwp-settings-switchoo-inner:before {
|
@@ -185,197 +197,4 @@ td.gadwp-settings-roles {
|
|
185 |
float: left;
|
186 |
margin-left: 10px;
|
187 |
line-height: 20px;
|
188 |
-
}
|
189 |
-
|
190 |
-
/* Admin Widget & Real-Time Stats*/
|
191 |
-
|
192 |
-
/* Real-Time content */
|
193 |
-
.gadash-pline {
|
194 |
-
width: 100%;
|
195 |
-
margin: 0 0;
|
196 |
-
padding: 5px 0 5px 0;
|
197 |
-
background: #fff;
|
198 |
-
-moz-box-shadow: 0px 0px 3px 0px #BBB;
|
199 |
-
-webkit-box-shadow: 0px 0px 3px 0px #BBB;
|
200 |
-
box-shadow: 0px 0px 3px 0px #BBB;
|
201 |
-
display: table;
|
202 |
-
overflow: hidden;
|
203 |
-
}
|
204 |
-
|
205 |
-
.gadash-pleft {
|
206 |
-
width: 90%;
|
207 |
-
float: left;
|
208 |
-
padding-left: 5px;
|
209 |
-
}
|
210 |
-
|
211 |
-
.gadash-pright {
|
212 |
-
width: 5%;
|
213 |
-
float: right;
|
214 |
-
padding-right: 5px;
|
215 |
-
}
|
216 |
-
|
217 |
-
#gadash-widget .realtime {
|
218 |
-
margin: 10px 0 0 0;
|
219 |
-
width: 100%;
|
220 |
-
}
|
221 |
-
|
222 |
-
.gadash-rt-box {
|
223 |
-
width: 100%;
|
224 |
-
margin: 0 0;
|
225 |
-
background: #fff;
|
226 |
-
text-align: center;
|
227 |
-
-moz-box-shadow: 0px 0px 5px 0px #BBB;
|
228 |
-
-webkit-box-shadow: 0px 0px 5px 0px #BBB;
|
229 |
-
box-shadow: 0px 0px 5px 0px #BBB;
|
230 |
-
display: table;
|
231 |
-
}
|
232 |
-
|
233 |
-
.gadash-tdo-left {
|
234 |
-
width: 60%;
|
235 |
-
padding: 33px 0;
|
236 |
-
float: left;
|
237 |
-
text-align: center;
|
238 |
-
}
|
239 |
-
|
240 |
-
.gadash-tdo-right {
|
241 |
-
width: 35%;
|
242 |
-
margin: 0px 10px 0px 0;
|
243 |
-
text-align: left;
|
244 |
-
font-weight: bold;
|
245 |
-
vertical-align: middle;
|
246 |
-
float: right;
|
247 |
-
display: table;
|
248 |
-
}
|
249 |
-
|
250 |
-
.gadash-online {
|
251 |
-
font-size: 100px;
|
252 |
-
font-weight: normal;
|
253 |
-
line-height: 1em;
|
254 |
-
margin: 0 auto;
|
255 |
-
width: 80%;
|
256 |
-
}
|
257 |
-
|
258 |
-
.gadash-bigtext {
|
259 |
-
font-size: 14px;
|
260 |
-
width: 100%;
|
261 |
-
margin: 0 0;
|
262 |
-
padding: 5px 5px 5px 5px;
|
263 |
-
background: #fff;
|
264 |
-
-moz-box-shadow: 0px 0px 3px 0px #BBB;
|
265 |
-
-webkit-box-shadow: 0px 0px 3px 0px #BBB;
|
266 |
-
box-shadow: 0px 0px 3px 0px #BBB;
|
267 |
-
display: table;
|
268 |
-
overflow: hidden;
|
269 |
-
}
|
270 |
-
|
271 |
-
.gadash-bleft {
|
272 |
-
float: left;
|
273 |
-
width: 80%;
|
274 |
-
}
|
275 |
-
|
276 |
-
.gadash-bright {
|
277 |
-
float: right;
|
278 |
-
width: 20%;
|
279 |
-
}
|
280 |
-
|
281 |
-
.gadash-pgdetailsr {
|
282 |
-
padding-left: 20px;
|
283 |
-
text-align: right;
|
284 |
-
}
|
285 |
-
|
286 |
-
.gadash-pgdetailsl {
|
287 |
-
min-width: 250px;
|
288 |
-
}
|
289 |
-
|
290 |
-
#gadash-mainchart {
|
291 |
-
width: 98%;
|
292 |
-
height: 100%;
|
293 |
-
margin: 10px auto 10px 0;
|
294 |
-
height: 250px;
|
295 |
-
}
|
296 |
-
|
297 |
-
.gadash-floatwraper {
|
298 |
-
display: table;
|
299 |
-
width: 100%;
|
300 |
-
height: 100%;
|
301 |
-
}
|
302 |
-
|
303 |
-
#gadash-trafficmediums, #gadash-traffictype, #gadash-socialnetworks,
|
304 |
-
#gadash-trafficorganic {
|
305 |
-
width: 47%;
|
306 |
-
margin: 10px 0 0 0;
|
307 |
-
height: 200px;
|
308 |
-
}
|
309 |
-
|
310 |
-
#gadash-trafficmediums, #gadash-trafficorganic {
|
311 |
-
float: left;
|
312 |
-
}
|
313 |
-
|
314 |
-
#gadash-traffictype, #gadash-socialnetworks {
|
315 |
-
float: right;
|
316 |
-
}
|
317 |
-
|
318 |
-
#gadash-map, #gadash-prs {
|
319 |
-
width: 98%;
|
320 |
-
height: 100%;
|
321 |
-
margin: 10px auto 10px 0;
|
322 |
-
}
|
323 |
-
|
324 |
-
#ga_dash_period, #ga_dash_profile_select {
|
325 |
-
font-size: 14px !important;
|
326 |
-
padding: 1px !important;
|
327 |
-
height: 26px !important;
|
328 |
-
}
|
329 |
-
|
330 |
-
#dashboard-widgets-wrap .postbox {
|
331 |
-
margin-right: 10px;
|
332 |
-
}
|
333 |
-
|
334 |
-
/* Admin Widget content */
|
335 |
-
#gadash-progressbar {
|
336 |
-
width: 100%;
|
337 |
-
height: 3px;
|
338 |
-
margin: 5px 0 0px 0;
|
339 |
-
}
|
340 |
-
|
341 |
-
.gadash-wrapper {
|
342 |
-
width: 100%;
|
343 |
-
}
|
344 |
-
|
345 |
-
.gadash-wrapper .inside {
|
346 |
-
display: table;
|
347 |
-
margin: 0 auto;
|
348 |
-
padding: 0px;
|
349 |
-
}
|
350 |
-
|
351 |
-
.gadash-wrapper .inside .small-box {
|
352 |
-
width: 30%;
|
353 |
-
float: left;
|
354 |
-
margin: 0 5px 10px 5px;
|
355 |
-
background: #fff;
|
356 |
-
text-align: center;
|
357 |
-
-moz-box-shadow: 0px 0px 7px 0px #BBB;
|
358 |
-
-webkit-box-shadow: 0px 0px 7px 0px #BBB;
|
359 |
-
box-shadow: 0px 0px 7px 0px #BBB;
|
360 |
-
}
|
361 |
-
|
362 |
-
.gadash-wrapper .inside .small-box h3 {
|
363 |
-
font-size: 1em;
|
364 |
-
color: #777;
|
365 |
-
padding: 0px 5px 0px 5px;
|
366 |
-
margin: 0px 0px 0px 0px;
|
367 |
-
text-overflow: ellipsis;
|
368 |
-
overflow: hidden;
|
369 |
-
white-space: nowrap;
|
370 |
-
}
|
371 |
-
|
372 |
-
.gadash-wrapper .inside .small-box p {
|
373 |
-
font-size: 1.2em;
|
374 |
-
margin: 0px 0px 2px 0px;
|
375 |
-
}
|
376 |
-
|
377 |
-
@media screen and (max-width: 410px) {
|
378 |
-
.gadash-wrapper .inside .small-box {
|
379 |
-
width: 45%;
|
380 |
-
}
|
381 |
}
|
68 |
|
69 |
#poststuff.gadwp h2 {
|
70 |
padding-bottom: 0;
|
71 |
+
font-size: 19.5px;
|
72 |
+
font-weight: normal;
|
73 |
+
padding: 0;
|
74 |
+
margin: 20px 0 15px 0;
|
75 |
+
|
76 |
+
}
|
77 |
+
|
78 |
+
#poststuff.gadwp h2.nav-tab-wrapper {
|
79 |
+
border-bottom: 1px solid #ccc;
|
80 |
+
padding-bottom: 0;
|
81 |
}
|
82 |
|
83 |
/* Options pages ON/OFF Switch */
|
84 |
+
.button-primary.gadwp-settings-switchoo {
|
85 |
position: relative;
|
86 |
width: 50px;
|
87 |
float: left;
|
88 |
+
border: none;
|
89 |
+
padding: 0;
|
90 |
+
height: 22px;
|
91 |
+
-moz-box-shadow: none;
|
92 |
+
-webkit-box-shadow: none;
|
93 |
+
-o-box-shadow: none;
|
94 |
+
box-shadow: none;
|
95 |
-webkit-user-select: none;
|
96 |
-moz-user-select: none;
|
97 |
-ms-user-select: none;
|
98 |
}
|
99 |
|
100 |
+
input.gadwp-settings-switchoo-checkbox {
|
101 |
+
display: none;
|
102 |
}
|
103 |
|
104 |
.gadwp-settings-switchoo-label {
|
108 |
background: transparent;
|
109 |
border: 1px solid #ddd;
|
110 |
border-radius: 2px;
|
111 |
+
text-shadow: none;
|
112 |
}
|
113 |
|
114 |
.gadwp-settings-switchoo-inner {
|
132 |
height: 22px;
|
133 |
line-height: 22px;
|
134 |
font-size: 12px;
|
135 |
+
text-shadow: none;
|
136 |
}
|
137 |
|
138 |
.gadwp-settings-switchoo-inner:before {
|
197 |
float: left;
|
198 |
margin-left: 10px;
|
199 |
line-height: 20px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
}
|
admin/settings.php
CHANGED
@@ -71,7 +71,6 @@ final class GADWP_Settings {
|
|
71 |
}
|
72 |
|
73 |
private static function navigation_tabs( $tabs ) {
|
74 |
-
echo '<div id="icon-themes" class="icon32"><br></div>';
|
75 |
echo '<h2 class="nav-tab-wrapper">';
|
76 |
foreach ( $tabs as $tab => $name ) {
|
77 |
echo "<a class='nav-tab' id='tab-$tab' href='#top#gadwp-$tab'>$name</a>";
|
@@ -531,6 +530,9 @@ final class GADWP_Settings {
|
|
531 |
<div class="switch-desc"><?php echo " ".__("enable AdSense account linking", 'google-analytics-dashboard-for-wp' );?></div>
|
532 |
</td>
|
533 |
</tr>
|
|
|
|
|
|
|
534 |
<tr>
|
535 |
<td colspan="2" class="gadwp-settings-title">
|
536 |
<div class="button-primary gadwp-settings-switchoo">
|
@@ -546,6 +548,21 @@ final class GADWP_Settings {
|
|
546 |
<td class="gadwp-settings-title"><label for="ga_crossdomain_list"><?php _e("Cross Domains:", 'google-analytics-dashboard-for-wp'); ?></label></td>
|
547 |
<td><input type="text" id="ga_crossdomain_list" name="options[ga_crossdomain_list]" value="<?php echo esc_attr($options['ga_crossdomain_list']); ?>" size="50"></td>
|
548 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
549 |
</table>
|
550 |
</div>
|
551 |
<div id="gadwp-exclude">
|
@@ -738,7 +755,7 @@ final class GADWP_Settings {
|
|
738 |
if ( ! $gadwp->config->options['ga_dash_tableid_jail'] ) {
|
739 |
$profile = GADWP_Tools::guess_default_domain( $profiles );
|
740 |
$gadwp->config->options['ga_dash_tableid_jail'] = $profile;
|
741 |
-
|
742 |
}
|
743 |
$gadwp->config->set_plugin_options();
|
744 |
$options = self::update_options( 'general' );
|
@@ -1010,7 +1027,7 @@ final class GADWP_Settings {
|
|
1010 |
if ( isset( $gadwp->config->options['ga_dash_tableid_jail'] ) && ! $gadwp->config->options['ga_dash_tableid_jail'] ) {
|
1011 |
$profile = GADWP_Tools::guess_default_domain( $profiles );
|
1012 |
$gadwp->config->options['ga_dash_tableid_jail'] = $profile;
|
1013 |
-
|
1014 |
}
|
1015 |
$gadwp->config->set_plugin_options( true );
|
1016 |
$options = self::update_options( 'network' );
|
@@ -1047,7 +1064,7 @@ final class GADWP_Settings {
|
|
1047 |
if ( isset( $gadwp->config->options['ga_dash_tableid_jail'] ) && ! $gadwp->config->options['ga_dash_tableid_jail'] ) {
|
1048 |
$profile = GADWP_Tools::guess_default_domain( $profiles );
|
1049 |
$gadwp->config->options['ga_dash_tableid_jail'] = $profile;
|
1050 |
-
|
1051 |
}
|
1052 |
$gadwp->config->set_plugin_options( true );
|
1053 |
$options = self::update_options( 'network' );
|
71 |
}
|
72 |
|
73 |
private static function navigation_tabs( $tabs ) {
|
|
|
74 |
echo '<h2 class="nav-tab-wrapper">';
|
75 |
foreach ( $tabs as $tab => $name ) {
|
76 |
echo "<a class='nav-tab' id='tab-$tab' href='#top#gadwp-$tab'>$name</a>";
|
530 |
<div class="switch-desc"><?php echo " ".__("enable AdSense account linking", 'google-analytics-dashboard-for-wp' );?></div>
|
531 |
</td>
|
532 |
</tr>
|
533 |
+
<tr>
|
534 |
+
<td colspan="2"><?php echo "<h2>" . __( "Cross-domain Tracking", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
|
535 |
+
</tr>
|
536 |
<tr>
|
537 |
<td colspan="2" class="gadwp-settings-title">
|
538 |
<div class="button-primary gadwp-settings-switchoo">
|
548 |
<td class="gadwp-settings-title"><label for="ga_crossdomain_list"><?php _e("Cross Domains:", 'google-analytics-dashboard-for-wp'); ?></label></td>
|
549 |
<td><input type="text" id="ga_crossdomain_list" name="options[ga_crossdomain_list]" value="<?php echo esc_attr($options['ga_crossdomain_list']); ?>" size="50"></td>
|
550 |
</tr>
|
551 |
+
<tr>
|
552 |
+
<td colspan="2"><?php echo "<h2>" . __( "Cookie Customization", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
|
553 |
+
</tr>
|
554 |
+
<tr>
|
555 |
+
<td class="gadwp-settings-title"><label for="ga_cookiedomain"><?php _e("Cookie Domain:", 'google-analytics-dashboard-for-wp'); ?></label></td>
|
556 |
+
<td><input type="text" id="ga_cookiedomain" name="options[ga_cookiedomain]" value="<?php echo esc_attr($options['ga_cookiedomain']); ?>" size="50"></td>
|
557 |
+
</tr>
|
558 |
+
<tr>
|
559 |
+
<td class="gadwp-settings-title"><label for="ga_cookiename"><?php _e("Cookie Name:", 'google-analytics-dashboard-for-wp'); ?></label></td>
|
560 |
+
<td><input type="text" id="ga_cookiename" name="options[ga_cookiename]" value="<?php echo esc_attr($options['ga_cookiename']); ?>" size="50"></td>
|
561 |
+
</tr>
|
562 |
+
<tr>
|
563 |
+
<td class="gadwp-settings-title"><label for="ga_cookieexpires"><?php _e("Cookie Expires:", 'google-analytics-dashboard-for-wp'); ?></label></td>
|
564 |
+
<td><input type="text" id="ga_cookieexpires" name="options[ga_cookieexpires]" value="<?php echo esc_attr($options['ga_cookieexpires']); ?>" size="10"> seconds</td>
|
565 |
+
</tr>
|
566 |
</table>
|
567 |
</div>
|
568 |
<div id="gadwp-exclude">
|
755 |
if ( ! $gadwp->config->options['ga_dash_tableid_jail'] ) {
|
756 |
$profile = GADWP_Tools::guess_default_domain( $profiles );
|
757 |
$gadwp->config->options['ga_dash_tableid_jail'] = $profile;
|
758 |
+
//$gadwp->config->options['ga_dash_tableid'] = $profile;
|
759 |
}
|
760 |
$gadwp->config->set_plugin_options();
|
761 |
$options = self::update_options( 'general' );
|
1027 |
if ( isset( $gadwp->config->options['ga_dash_tableid_jail'] ) && ! $gadwp->config->options['ga_dash_tableid_jail'] ) {
|
1028 |
$profile = GADWP_Tools::guess_default_domain( $profiles );
|
1029 |
$gadwp->config->options['ga_dash_tableid_jail'] = $profile;
|
1030 |
+
//$gadwp->config->options['ga_dash_tableid'] = $profile;
|
1031 |
}
|
1032 |
$gadwp->config->set_plugin_options( true );
|
1033 |
$options = self::update_options( 'network' );
|
1064 |
if ( isset( $gadwp->config->options['ga_dash_tableid_jail'] ) && ! $gadwp->config->options['ga_dash_tableid_jail'] ) {
|
1065 |
$profile = GADWP_Tools::guess_default_domain( $profiles );
|
1066 |
$gadwp->config->options['ga_dash_tableid_jail'] = $profile;
|
1067 |
+
//$gadwp->config->options['ga_dash_tableid'] = $profile;
|
1068 |
}
|
1069 |
$gadwp->config->set_plugin_options( true );
|
1070 |
$options = self::update_options( 'network' );
|
admin/setup.php
CHANGED
@@ -90,10 +90,10 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
|
|
90 |
$ed_bubble = '';
|
91 |
}
|
92 |
|
93 |
-
wp_enqueue_script( '
|
94 |
|
95 |
/* @formatter:off */
|
96 |
-
wp_localize_script( '
|
97 |
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
98 |
'security' => wp_create_nonce( 'gadwp_dismiss_notices' ),
|
99 |
'ed_bubble' => $ed_bubble,
|
@@ -101,24 +101,115 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
|
|
101 |
);
|
102 |
/* @formatter:on */
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
/*
|
105 |
-
* Dashboard Widgets Styles & Scripts
|
106 |
*/
|
107 |
$widgets_hooks = array( 'index.php' );
|
108 |
|
109 |
if ( in_array( $new_hook, $widgets_hooks ) ) {
|
110 |
if ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) && $this->gadwp->config->options['dashboard_widget'] ) {
|
111 |
|
112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
|
114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
|
116 |
if ( ! wp_script_is( 'googlejsapi' ) ) {
|
117 |
wp_register_script( 'googlejsapi', 'https://www.google.com/jsapi' );
|
118 |
-
wp_enqueue_script( 'googlejsapi' );
|
119 |
}
|
120 |
|
121 |
-
wp_enqueue_script( 'gadwp-nprogress', GADWP_URL . '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
}
|
123 |
}
|
124 |
|
@@ -129,30 +220,33 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
|
|
129 |
if ( in_array( $hook, $contentstats_hooks ) ) {
|
130 |
if ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) && $this->gadwp->config->options['backend_item_reports'] ) {
|
131 |
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
$region = $this->gadwp->config->options['ga_target_geomap'];
|
140 |
} else {
|
141 |
$region = false;
|
142 |
}
|
143 |
|
|
|
|
|
|
|
|
|
144 |
wp_enqueue_style( "wp-jquery-ui-dialog" );
|
145 |
|
146 |
if ( ! wp_script_is( 'googlejsapi' ) ) {
|
147 |
wp_register_script( 'googlejsapi', 'https://www.google.com/jsapi' );
|
148 |
}
|
149 |
|
150 |
-
wp_enqueue_script( 'gadwp-nprogress', GADWP_URL . '
|
151 |
|
152 |
-
wp_enqueue_script( '
|
153 |
|
154 |
/* @formatter:off */
|
155 |
-
wp_localize_script( '
|
156 |
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
157 |
'security' => wp_create_nonce( 'gadwp_backend_item_reports' ),
|
158 |
'dateList' => array(
|
@@ -197,6 +291,7 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
|
|
197 |
'colorVariations' => GADWP_Tools::variations( $this->gadwp->config->options['ga_dash_style'] ),
|
198 |
'region' => $region,
|
199 |
'language' => get_bloginfo( 'language' ),
|
|
|
200 |
'scope' => 'admin-item',
|
201 |
)
|
202 |
);
|
@@ -234,13 +329,19 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
|
|
234 |
* Add an admin notice after a manual or atuomatic update
|
235 |
*/
|
236 |
function admin_notice() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
if ( get_option( 'gadwp_got_updated' ) ) :
|
238 |
?>
|
239 |
-
<div id="gadwp-notice" class="notice is-dismissible">
|
240 |
-
|
241 |
-
</div>
|
242 |
-
|
243 |
-
<?php
|
244 |
endif;
|
245 |
}
|
246 |
}
|
90 |
$ed_bubble = '';
|
91 |
}
|
92 |
|
93 |
+
wp_enqueue_script( 'gadwp-backend-ui', plugins_url( 'js/ui.js', __FILE__ ), array( 'jquery' ), GADWP_CURRENT_VERSION, true );
|
94 |
|
95 |
/* @formatter:off */
|
96 |
+
wp_localize_script( 'gadwp-backend-ui', 'gadwp_ui_data', array(
|
97 |
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
98 |
'security' => wp_create_nonce( 'gadwp_dismiss_notices' ),
|
99 |
'ed_bubble' => $ed_bubble,
|
101 |
);
|
102 |
/* @formatter:on */
|
103 |
|
104 |
+
if ( $this->gadwp->config->options['switch_profile'] && count($this->gadwp->config->options['ga_dash_profile_list']) > 1 ) {
|
105 |
+
$views = array();
|
106 |
+
foreach ( $this->gadwp->config->options['ga_dash_profile_list'] as $items ) {
|
107 |
+
if ( $items[3] ) {
|
108 |
+
$views[$items[1]] = esc_js( GADWP_Tools::strip_protocol( $items[3] ) ); // . ' ⇒ ' . $items[0] );
|
109 |
+
}
|
110 |
+
}
|
111 |
+
} else {
|
112 |
+
$views = false;
|
113 |
+
}
|
114 |
+
|
115 |
/*
|
116 |
+
* Main Dashboard Widgets Styles & Scripts
|
117 |
*/
|
118 |
$widgets_hooks = array( 'index.php' );
|
119 |
|
120 |
if ( in_array( $new_hook, $widgets_hooks ) ) {
|
121 |
if ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) && $this->gadwp->config->options['dashboard_widget'] ) {
|
122 |
|
123 |
+
if ( $this->gadwp->config->options['ga_target_geomap'] ) {
|
124 |
+
$country_codes = GADWP_Tools::get_countrycodes();
|
125 |
+
if ( isset( $country_codes[$this->gadwp->config->options['ga_target_geomap']] ) ){
|
126 |
+
$region = $this->gadwp->config->options['ga_target_geomap'];
|
127 |
+
} else {
|
128 |
+
$region = false;
|
129 |
+
}
|
130 |
+
} else {
|
131 |
+
$region = false;
|
132 |
+
}
|
133 |
+
|
134 |
+
wp_enqueue_style( 'gadwp-nprogress', GADWP_URL . 'common/nprogress/nprogress.css', null, GADWP_CURRENT_VERSION );
|
135 |
|
136 |
+
wp_enqueue_style( 'gadwp-backend-item-reports', GADWP_URL . 'admin/css/admin-widgets.css', null, GADWP_CURRENT_VERSION );
|
137 |
+
|
138 |
+
wp_register_style( 'jquery-ui-tooltip-html', GADWP_URL . 'common/realtime/jquery.ui.tooltip.html.css' );
|
139 |
+
|
140 |
+
wp_enqueue_style( 'jquery-ui-tooltip-html' );
|
141 |
+
|
142 |
+
wp_register_script( 'jquery-ui-tooltip-html', GADWP_URL . 'common/realtime/jquery.ui.tooltip.html.js' );
|
143 |
|
144 |
if ( ! wp_script_is( 'googlejsapi' ) ) {
|
145 |
wp_register_script( 'googlejsapi', 'https://www.google.com/jsapi' );
|
|
|
146 |
}
|
147 |
|
148 |
+
wp_enqueue_script( 'gadwp-nprogress', GADWP_URL . 'common/nprogress/nprogress.js', array( 'jquery' ), GADWP_CURRENT_VERSION );
|
149 |
+
|
150 |
+
wp_enqueue_script( 'gadwp-backend-dashboard-reports', GADWP_URL . 'common/js/reports.js', array( 'jquery', 'googlejsapi', 'gadwp-nprogress', 'jquery-ui-tooltip', 'jquery-ui-core', 'jquery-ui-position', 'jquery-ui-tooltip-html' ), GADWP_CURRENT_VERSION );
|
151 |
+
|
152 |
+
/* @formatter:off */
|
153 |
+
wp_localize_script( 'gadwp-backend-dashboard-reports', 'gadwp_item_data', array(
|
154 |
+
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
155 |
+
'security' => wp_create_nonce( 'gadwp_backend_item_reports' ),
|
156 |
+
'dateList' => array(
|
157 |
+
'realtime' => __( "Real-Time", 'google-analytics-dashboard-for-wp' ),
|
158 |
+
'today' => __( "Today", 'google-analytics-dashboard-for-wp' ),
|
159 |
+
'yesterday' => __( "Yesterday", 'google-analytics-dashboard-for-wp' ),
|
160 |
+
'7daysAgo' => sprintf( __( "Last %d Days", 'google-analytics-dashboard-for-wp' ), 7 ),
|
161 |
+
'14daysAgo' => sprintf( __( "Last %d Days", 'google-analytics-dashboard-for-wp' ), 14 ),
|
162 |
+
'30daysAgo' => sprintf( __( "Last %d Days", 'google-analytics-dashboard-for-wp' ), 30 ),
|
163 |
+
'90daysAgo' => sprintf( __( "Last %d Days", 'google-analytics-dashboard-for-wp' ), 90 ),
|
164 |
+
'365daysAgo' => sprintf( _n( "%s Year", "%s Years", 1, 'google-analytics-dashboard-for-wp' ), __('One', 'google-analytics-dashboard-for-wp') ),
|
165 |
+
'1095daysAgo' => sprintf( _n( "%s Year", "%s Years", 3, 'google-analytics-dashboard-for-wp' ), __('Three', 'google-analytics-dashboard-for-wp') ),
|
166 |
+
),
|
167 |
+
'reportList' => array(
|
168 |
+
'sessions' => __( "Sessions", 'google-analytics-dashboard-for-wp' ),
|
169 |
+
'users' => __( "Users", 'google-analytics-dashboard-for-wp' ),
|
170 |
+
'organicSearches' => __( "Organic", 'google-analytics-dashboard-for-wp' ),
|
171 |
+
'pageviews' => __( "Page Views", 'google-analytics-dashboard-for-wp' ),
|
172 |
+
'visitBounceRate' => __( "Bounce Rate", 'google-analytics-dashboard-for-wp' ),
|
173 |
+
'locations' => __( "Location", 'google-analytics-dashboard-for-wp' ),
|
174 |
+
'referrers' => __( "Referrers", 'google-analytics-dashboard-for-wp' ),
|
175 |
+
'searches' => __( "Searches", 'google-analytics-dashboard-for-wp' ),
|
176 |
+
'trafficdetails' => __( "Traffic Details", 'google-analytics-dashboard-for-wp' )
|
177 |
+
),
|
178 |
+
'i18n' => array(
|
179 |
+
__( "A JavaScript Error is blocking plugin resources!", 'google-analytics-dashboard-for-wp' ), //0
|
180 |
+
__( "Traffic Mediums", 'google-analytics-dashboard-for-wp' ),
|
181 |
+
__( "Visitor Type", 'google-analytics-dashboard-for-wp' ),
|
182 |
+
__( "Social Networks", 'google-analytics-dashboard-for-wp' ),
|
183 |
+
__( "Search Engines", 'google-analytics-dashboard-for-wp' ),
|
184 |
+
__( "Sessions", 'google-analytics-dashboard-for-wp' ),
|
185 |
+
__( "Users", 'google-analytics-dashboard-for-wp' ),
|
186 |
+
__( "Page Views", 'google-analytics-dashboard-for-wp' ),
|
187 |
+
__( "Bounce Rate", 'google-analytics-dashboard-for-wp' ),
|
188 |
+
__( "Organic Search", 'google-analytics-dashboard-for-wp' ),
|
189 |
+
__( "Pages/Session", 'google-analytics-dashboard-for-wp' ),
|
190 |
+
__( "Invalid response, more details in JavaScript Console (F12).", 'google-analytics-dashboard-for-wp' ),
|
191 |
+
__( "Not enough data collected", 'google-analytics-dashboard-for-wp' ),
|
192 |
+
__( "This report is unavailable", 'google-analytics-dashboard-for-wp' ),
|
193 |
+
__( "report generated by", 'google-analytics-dashboard-for-wp' ), //14
|
194 |
+
__( "This plugin needs an authorization:", 'google-analytics-dashboard-for-wp' ) . ' <a href="' . menu_page_url( 'gadash_settings', false ) . '">' . __( "authorize the plugin", 'google-analytics-dashboard-for-wp' ) . '</a>.',
|
195 |
+
),
|
196 |
+
'i18n_realtime' => array(
|
197 |
+
__( "REFERRALS", 'google-analytics-dashboard-for-wp' ), //0
|
198 |
+
__( "KEYWORDS", 'google-analytics-dashboard-for-wp' ),
|
199 |
+
__( "SOCIAL", 'google-analytics-dashboard-for-wp' ),
|
200 |
+
__( "CAMPAIGN", 'google-analytics-dashboard-for-wp' ),
|
201 |
+
__( "DIRECT", 'google-analytics-dashboard-for-wp' ),
|
202 |
+
__( "NEW", 'google-analytics-dashboard-for-wp' ), //5
|
203 |
+
),
|
204 |
+
'realtime_maxpages' => $this->gadwp->config->options['ga_realtime_pages'],
|
205 |
+
'colorVariations' => GADWP_Tools::variations( $this->gadwp->config->options['ga_dash_style'] ),
|
206 |
+
'region' => $region,
|
207 |
+
'language' => get_bloginfo( 'language' ),
|
208 |
+
'viewList' => $views,
|
209 |
+
'scope' => 'admin-widgets',
|
210 |
+
)
|
211 |
+
);
|
212 |
+
/* @formatter:on */
|
213 |
}
|
214 |
}
|
215 |
|
220 |
if ( in_array( $hook, $contentstats_hooks ) ) {
|
221 |
if ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) && $this->gadwp->config->options['backend_item_reports'] ) {
|
222 |
|
223 |
+
if ( $this->gadwp->config->options['ga_target_geomap'] ) {
|
224 |
+
$country_codes = GADWP_Tools::get_countrycodes();
|
225 |
+
if ( isset( $country_codes[$this->gadwp->config->options['ga_target_geomap']] ) ){
|
226 |
+
$region = $this->gadwp->config->options['ga_target_geomap'];
|
227 |
+
} else {
|
228 |
+
$region = false;
|
229 |
+
}
|
|
|
230 |
} else {
|
231 |
$region = false;
|
232 |
}
|
233 |
|
234 |
+
wp_enqueue_style( 'gadwp-nprogress', GADWP_URL . 'common/nprogress/nprogress.css', null, GADWP_CURRENT_VERSION );
|
235 |
+
|
236 |
+
wp_enqueue_style( 'gadwp-backend-item-reports', GADWP_URL . 'admin/css/item-reports.css', null, GADWP_CURRENT_VERSION );
|
237 |
+
|
238 |
wp_enqueue_style( "wp-jquery-ui-dialog" );
|
239 |
|
240 |
if ( ! wp_script_is( 'googlejsapi' ) ) {
|
241 |
wp_register_script( 'googlejsapi', 'https://www.google.com/jsapi' );
|
242 |
}
|
243 |
|
244 |
+
wp_enqueue_script( 'gadwp-nprogress', GADWP_URL . 'common/nprogress/nprogress.js', array( 'jquery' ), GADWP_CURRENT_VERSION );
|
245 |
|
246 |
+
wp_enqueue_script( 'gadwp-backend-item-reports', GADWP_URL . 'common/js/reports.js', array( 'gadwp-nprogress', 'googlejsapi', 'jquery', 'jquery-ui-dialog' ), GADWP_CURRENT_VERSION );
|
247 |
|
248 |
/* @formatter:off */
|
249 |
+
wp_localize_script( 'gadwp-backend-item-reports', 'gadwp_item_data', array(
|
250 |
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
251 |
'security' => wp_create_nonce( 'gadwp_backend_item_reports' ),
|
252 |
'dateList' => array(
|
291 |
'colorVariations' => GADWP_Tools::variations( $this->gadwp->config->options['ga_dash_style'] ),
|
292 |
'region' => $region,
|
293 |
'language' => get_bloginfo( 'language' ),
|
294 |
+
'viewList' => false,
|
295 |
'scope' => 'admin-item',
|
296 |
)
|
297 |
);
|
329 |
* Add an admin notice after a manual or atuomatic update
|
330 |
*/
|
331 |
function admin_notice() {
|
332 |
+
|
333 |
+
$currentScreen = get_current_screen();
|
334 |
+
|
335 |
+
if ( ! current_user_can( 'manage_options' ) || $currentScreen->base != 'dashboard') {
|
336 |
+
return;
|
337 |
+
}
|
338 |
+
|
339 |
if ( get_option( 'gadwp_got_updated' ) ) :
|
340 |
?>
|
341 |
+
<div id="gadwp-notice" class="notice is-dismissible">
|
342 |
+
<p><?php echo sprintf( __('Google Analytics Dashboard for WP has been updated to version %s.', 'google-analytics-dashboard-for-wp' ), GADWP_CURRENT_VERSION).' '.sprintf( __('For details, check out %1$s and %2$s.', 'google-analytics-dashboard-for-wp' ), sprintf(' <a href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_notice&utm_medium=link&utm_content=release_notice&utm_campaign=gadwp">%s</a> ', __('the documentation page', 'google-analytics-dashboard-for-wp') ), sprintf(' <a href="%1$s">%2$s</a>', esc_url( get_admin_url( null, 'admin.php?page=gadash_settings' ) ), __('the plugin's settings page', 'google-analytics-dashboard-for-wp') ) ); ?></p>
|
343 |
+
</div>
|
344 |
+
<?php
|
|
|
345 |
endif;
|
346 |
}
|
347 |
}
|
admin/widgets.php
CHANGED
@@ -24,65 +24,24 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
|
|
24 |
}
|
25 |
|
26 |
public function add_widget() {
|
27 |
-
wp_add_dashboard_widget( '
|
28 |
}
|
29 |
|
30 |
public function dashboard_widget() {
|
|
|
|
|
31 |
if ( empty( $this->gadwp->config->options['ga_dash_token'] ) ) {
|
32 |
echo '<p>' . __( "This plugin needs an authorization:", 'google-analytics-dashboard-for-wp' ) . '</p><form action="' . menu_page_url( 'gadash_settings', false ) . '" method="POST">' . get_submit_button( __( "Authorize Plugin", 'google-analytics-dashboard-for-wp' ), 'secondary' ) . '</form>';
|
33 |
return;
|
34 |
}
|
35 |
|
36 |
if ( current_user_can( 'manage_options' ) ) {
|
37 |
-
if (
|
38 |
-
$this->gadwp->config->options['
|
39 |
-
}
|
40 |
-
$profiles = $this->gadwp->config->options['ga_dash_profile_list'];
|
41 |
-
$profile_switch = '';
|
42 |
-
if ( ! empty( $profiles ) ) {
|
43 |
-
if ( ! $this->gadwp->config->options['ga_dash_tableid'] ) {
|
44 |
-
if ( $this->gadwp->config->options['ga_dash_tableid_jail'] ) {
|
45 |
-
$this->gadwp->config->options['ga_dash_tableid'] = $this->gadwp->config->options['ga_dash_tableid_jail'];
|
46 |
-
} else {
|
47 |
-
$this->gadwp->config->options['ga_dash_tableid'] = GADWP_Tools::guess_default_domain( $profiles );
|
48 |
-
}
|
49 |
-
} else
|
50 |
-
if ( $this->gadwp->config->options['switch_profile'] == 0 && $this->gadwp->config->options['ga_dash_tableid_jail'] ) {
|
51 |
-
$this->gadwp->config->options['ga_dash_tableid'] = $this->gadwp->config->options['ga_dash_tableid_jail'];
|
52 |
-
}
|
53 |
-
$profile_switch .= '<select id="gadwp_selected_profile" name="gadwp_selected_profile" onchange="this.form.submit()">';
|
54 |
-
foreach ( $profiles as $profile ) {
|
55 |
-
if ( ! $this->gadwp->config->options['ga_dash_tableid'] ) {
|
56 |
-
$this->gadwp->config->options['ga_dash_tableid'] = $profile[1];
|
57 |
-
}
|
58 |
-
if ( isset( $profile[3] ) ) {
|
59 |
-
$profile_switch .= '<option value="' . esc_attr( $profile[1] ) . '" ';
|
60 |
-
$profile_switch .= selected( $profile[1], $this->gadwp->config->options['ga_dash_tableid'], false );
|
61 |
-
$profile_switch .= ' title="' . __( "View Name:", 'google-analytics-dashboard-for-wp' ) . ' ' . esc_attr( $profile[0] ) . '">' . esc_attr( GADWP_Tools::strip_protocol( $profile[3] ) ) . '</option>';
|
62 |
-
}
|
63 |
-
}
|
64 |
-
$profile_switch .= "</select>";
|
65 |
} else {
|
66 |
-
echo '<p>' . __( "
|
67 |
return;
|
68 |
}
|
69 |
-
}
|
70 |
-
$this->gadwp->config->set_plugin_options();
|
71 |
-
?>
|
72 |
-
<form id="ga-dash" method="POST">
|
73 |
-
<?php
|
74 |
-
if ( current_user_can( 'manage_options' ) ) {
|
75 |
-
if ( $this->gadwp->config->options['switch_profile'] == 0 ) {
|
76 |
-
if ( $this->gadwp->config->options['ga_dash_tableid_jail'] ) {
|
77 |
-
$projectId = $this->gadwp->config->options['ga_dash_tableid_jail'];
|
78 |
-
} else {
|
79 |
-
echo '<p>' . __( "An admin should asign a default Google Analytics Profile.", 'google-analytics-dashboard-for-wp' ) . '</p><form action="' . menu_page_url( 'gadash_settings', false ) . '" method="POST">' . get_submit_button( __( "Select Domain", 'google-analytics-dashboard-for-wp' ), 'secondary' ) . '</form>';
|
80 |
-
return;
|
81 |
-
}
|
82 |
-
} else {
|
83 |
-
echo $profile_switch;
|
84 |
-
$projectId = $this->gadwp->config->options['ga_dash_tableid'];
|
85 |
-
}
|
86 |
} else {
|
87 |
if ( $this->gadwp->config->options['ga_dash_tableid_jail'] ) {
|
88 |
$projectId = $this->gadwp->config->options['ga_dash_tableid_jail'];
|
@@ -91,839 +50,15 @@ if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
|
|
91 |
return;
|
92 |
}
|
93 |
}
|
|
|
94 |
if ( ! ( $projectId ) ) {
|
95 |
echo '<p>' . __( "Something went wrong while retrieving property data. You need to create and properly configure a Google Analytics account:", 'google-analytics-dashboard-for-wp' ) . '</p> <form action="https://deconf.com/how-to-set-up-google-analytics-on-your-website/" method="POST">' . get_submit_button( __( "Find out more!", 'google-analytics-dashboard-for-wp' ), 'secondary' ) . '</form>';
|
96 |
return;
|
97 |
}
|
98 |
-
if ( isset( $_REQUEST['gadwpquery'] ) ) {
|
99 |
-
$query = $_REQUEST['gadwpquery'];
|
100 |
-
} else {
|
101 |
-
$default_metric = GADWP_Tools::get_cookie( 'default_metric' );
|
102 |
-
$query = $default_metric ? $default_metric : 'sessions';
|
103 |
-
}
|
104 |
-
if ( isset( $_REQUEST['gadwpperiod'] ) ) {
|
105 |
-
$period = $_REQUEST['gadwpperiod'];
|
106 |
-
} else {
|
107 |
-
$default_dimension = GADWP_Tools::get_cookie( 'default_dimension' );
|
108 |
-
$period = $default_dimension ? $default_dimension : '30daysAgo';
|
109 |
-
}
|
110 |
|
111 |
?>
|
112 |
-
|
113 |
-
<option value="realtime" <?php selected ( "realtime", $period, true ); ?>><?php _e("Real-Time",'google-analytics-dashboard-for-wp'); ?></option>
|
114 |
-
<option value="today" <?php selected ( "today", $period, true ); ?>><?php _e("Today",'google-analytics-dashboard-for-wp'); ?></option>
|
115 |
-
<option value="yesterday" <?php selected ( "yesterday", $period, true ); ?>><?php _e("Yesterday",'google-analytics-dashboard-for-wp'); ?></option>
|
116 |
-
<option value="7daysAgo" <?php selected ( "7daysAgo", $period, true ); ?>><?php printf( __( "Last %d Days", 'google-analytics-dashboard-for-wp' ), 7 ); ?></option>
|
117 |
-
<option value="14daysAgo" <?php selected ( "14daysAgo", $period, true ); ?>><?php printf( __( "Last %d Days", 'google-analytics-dashboard-for-wp' ), 14 ); ?></option>
|
118 |
-
<option value="30daysAgo" <?php selected ( "30daysAgo", $period, true ); ?>><?php printf( __( "Last %d Days", 'google-analytics-dashboard-for-wp' ), 30 ); ?></option>
|
119 |
-
<option value="90daysAgo" <?php selected ( "90daysAgo", $period, true ); ?>><?php printf( __( "Last %d Days", 'google-analytics-dashboard-for-wp' ), 90 ); ?></option>
|
120 |
-
<option value="365daysAgo" <?php selected ( "365daysAgo", $period, true ); ?>><?php printf( _n( "%s Year", "%s Years", 1, 'google-analytics-dashboard-for-wp' ), __('One', 'google-analytics-dashboard-for-wp') ); ?></option>
|
121 |
-
<option value="1095daysAgo" <?php selected ( "1095daysAgo", $period, true ); ?>><?php printf( _n( "%s Year", "%s Years", 3, 'google-analytics-dashboard-for-wp' ), __('Three', 'google-analytics-dashboard-for-wp') ); ?></option>
|
122 |
-
</select>
|
123 |
-
|
124 |
-
<?php if ($period != 'realtime') {?>
|
125 |
-
<select id="ga_dash_query" name="gadwpquery" onchange="this.form.submit()">
|
126 |
-
<option value="sessions" <?php selected ( "sessions", $query, true ); ?>><?php _e("Sessions",'google-analytics-dashboard-for-wp'); ?></option>
|
127 |
-
<option value="users" <?php selected ( "users", $query, true ); ?>><?php _e("Users",'google-analytics-dashboard-for-wp'); ?></option>
|
128 |
-
<option value="organicSearches" <?php selected ( "organicSearches", $query, true ); ?>><?php _e("Organic",'google-analytics-dashboard-for-wp'); ?></option>
|
129 |
-
<option value="pageviews" <?php selected ( "pageviews", $query, true ); ?>><?php _e("Page Views",'google-analytics-dashboard-for-wp'); ?></option>
|
130 |
-
<option value="visitBounceRate" <?php selected ( "visitBounceRate", $query, true ); ?>><?php _e("Bounce Rate",'google-analytics-dashboard-for-wp'); ?></option>
|
131 |
-
<option value="locations" <?php selected ( "locations", $query, true ); ?>><?php _e("Location",'google-analytics-dashboard-for-wp'); ?></option>
|
132 |
-
<option value="contentpages" <?php selected ( "contentpages", $query, true ); ?>><?php _e("Pages",'google-analytics-dashboard-for-wp'); ?></option>
|
133 |
-
<option value="referrers" <?php selected ( "referrers", $query, true ); ?>><?php _e("Referrers",'google-analytics-dashboard-for-wp'); ?></option>
|
134 |
-
<option value="searches" <?php selected ( "searches", $query, true ); ?>><?php _e("Searches",'google-analytics-dashboard-for-wp'); ?></option>
|
135 |
-
<option value="trafficdetails" <?php selected ( "trafficdetails", $query, true ); ?>><?php _e("Traffic Details",'google-analytics-dashboard-for-wp'); ?></option>
|
136 |
-
</select>
|
137 |
-
<?php }?>
|
138 |
-
</form>
|
139 |
-
<div id="gadash-progressbar"></div>
|
140 |
-
<?php
|
141 |
-
switch ( $period ) {
|
142 |
-
case 'today' :
|
143 |
-
$from = 'today';
|
144 |
-
$to = 'today';
|
145 |
-
$haxis = 4;
|
146 |
-
break;
|
147 |
-
case 'yesterday' :
|
148 |
-
$from = 'yesterday';
|
149 |
-
$to = 'yesterday';
|
150 |
-
$haxis = 4;
|
151 |
-
break;
|
152 |
-
case '7daysAgo' :
|
153 |
-
$from = '7daysAgo';
|
154 |
-
$to = 'yesterday';
|
155 |
-
$haxis = 2;
|
156 |
-
break;
|
157 |
-
case '14daysAgo' :
|
158 |
-
$from = '14daysAgo';
|
159 |
-
$to = 'yesterday';
|
160 |
-
$haxis = 3;
|
161 |
-
break;
|
162 |
-
case '90daysAgo' :
|
163 |
-
$from = '90daysAgo';
|
164 |
-
$to = 'yesterday';
|
165 |
-
$haxis = 16;
|
166 |
-
break;
|
167 |
-
case '365daysAgo' :
|
168 |
-
$from = '365daysAgo';
|
169 |
-
$to = 'yesterday';
|
170 |
-
$haxis = 5;
|
171 |
-
break;
|
172 |
-
case '1095daysAgo' :
|
173 |
-
$from = '1095daysAgo';
|
174 |
-
$to = 'yesterday';
|
175 |
-
$haxis = 5;
|
176 |
-
break;
|
177 |
-
default :
|
178 |
-
$from = '30daysAgo';
|
179 |
-
$to = 'yesterday';
|
180 |
-
$haxis = 5;
|
181 |
-
break;
|
182 |
-
}
|
183 |
-
if ( $query == 'visitBounceRate' ) {
|
184 |
-
$formater = "var formatter = new google.visualization.NumberFormat({
|
185 |
-
suffix: '%',
|
186 |
-
fractionDigits: 2
|
187 |
-
});
|
188 |
-
|
189 |
-
formatter.format(data, 1); ";
|
190 |
-
} else {
|
191 |
-
$formater = '';
|
192 |
-
}
|
193 |
-
|
194 |
-
if ( isset( $this->gadwp->config->options['ga_dash_style'] ) ) {
|
195 |
-
$light_color = GADWP_Tools::colourVariator( $this->gadwp->config->options['ga_dash_style'], 40 );
|
196 |
-
$dark_color = GADWP_Tools::colourVariator( $this->gadwp->config->options['ga_dash_style'], - 20 );
|
197 |
-
$css = "colors:['" . $this->gadwp->config->options['ga_dash_style'] . "','" . GADWP_Tools::colourVariator( $this->gadwp->config->options['ga_dash_style'], - 20 ) . "'],";
|
198 |
-
$color = $this->gadwp->config->options['ga_dash_style'];
|
199 |
-
} else {
|
200 |
-
$css = "";
|
201 |
-
$color = "#3366CC";
|
202 |
-
}
|
203 |
-
if ( $period == 'realtime' ) {
|
204 |
-
wp_register_style( 'jquery-ui-tooltip-html', GADWP_URL . 'realtime/jquery/jquery.ui.tooltip.html.css' );
|
205 |
-
wp_enqueue_style( 'jquery-ui-tooltip-html' );
|
206 |
-
if ( ! wp_script_is( 'jquery' ) ) {
|
207 |
-
wp_enqueue_script( 'jquery' );
|
208 |
-
}
|
209 |
-
if ( ! wp_script_is( 'jquery-ui-tooltip' ) ) {
|
210 |
-
wp_enqueue_script( "jquery-ui-tooltip" );
|
211 |
-
}
|
212 |
-
if ( ! wp_script_is( 'jquery-ui-core' ) ) {
|
213 |
-
wp_enqueue_script( "jquery-ui-core" );
|
214 |
-
}
|
215 |
-
if ( ! wp_script_is( 'jquery-ui-position' ) ) {
|
216 |
-
wp_enqueue_script( "jquery-ui-position" );
|
217 |
-
}
|
218 |
-
if ( ! wp_script_is( 'jquery-ui-position' ) ) {
|
219 |
-
wp_enqueue_script( "jquery-ui-position" );
|
220 |
-
}
|
221 |
-
wp_register_script( "jquery-ui-tooltip-html", GADWP_URL . 'realtime/jquery/jquery.ui.tooltip.html.js' );
|
222 |
-
wp_enqueue_script( "jquery-ui-tooltip-html" );
|
223 |
-
}
|
224 |
-
if ( $period == 'realtime' ) {
|
225 |
-
?>
|
226 |
-
<div class="realtime">
|
227 |
-
<div class="gadash-rt-box">
|
228 |
-
<div class='gadash-tdo-left'>
|
229 |
-
<div class='gadash-online' id='gadash-online'>0</div>
|
230 |
-
</div>
|
231 |
-
<div class='gadash-tdo-right' id='gadash-tdo-right'>
|
232 |
-
<div class="gadash-bigtext">
|
233 |
-
<div class="gadash-bleft"><?php _e( "REFERRAL", 'google-analytics-dashboard-for-wp' );?></div>
|
234 |
-
<div class="gadash-bright">0</div>
|
235 |
-
</div>
|
236 |
-
<div class="gadash-bigtext">
|
237 |
-
<div class="gadash-bleft"><?php _e( "ORGANIC", 'google-analytics-dashboard-for-wp' );?></div>
|
238 |
-
<div class="gadash-bright">0</div>
|
239 |
-
</div>
|
240 |
-
<div class="gadash-bigtext">
|
241 |
-
<div class="gadash-bleft"><?php _e( "SOCIAL", 'google-analytics-dashboard-for-wp' );?></div>
|
242 |
-
<div class="gadash-bright">0</div>
|
243 |
-
</div>
|
244 |
-
<div class="gadash-bigtext">
|
245 |
-
<div class="gadash-bleft"><?php _e( "CAMPAIGN", 'google-analytics-dashboard-for-wp' );?></div>
|
246 |
-
<div class="gadash-bright">0</div>
|
247 |
-
</div>
|
248 |
-
<div class="gadash-bigtext">
|
249 |
-
<div class="gadash-bleft"><?php _e( "DIRECT", 'google-analytics-dashboard-for-wp' );?></div>
|
250 |
-
<div class="gadash-bright">0</div>
|
251 |
-
</div>
|
252 |
-
<div class="gadash-bigtext">
|
253 |
-
<div class="gadash-bleft"><?php _e( "NEW", 'google-analytics-dashboard-for-wp' );?></div>
|
254 |
-
<div class="gadash-bright">0</div>
|
255 |
-
</div>
|
256 |
-
</div>
|
257 |
-
</div>
|
258 |
-
<div>
|
259 |
-
<div id='gadash-pages' class='gadash-pages'> </div>
|
260 |
-
</div>
|
261 |
-
</div>
|
262 |
-
<script type="text/javascript">
|
263 |
-
|
264 |
-
var focusFlag = 1;
|
265 |
-
|
266 |
-
jQuery(document).ready(function(){
|
267 |
-
jQuery(window).bind("focus",function(event){
|
268 |
-
focusFlag = 1;
|
269 |
-
}).bind("blur", function(event){
|
270 |
-
focusFlag = 0;
|
271 |
-
});
|
272 |
-
});
|
273 |
-
|
274 |
-
jQuery(function() {
|
275 |
-
jQuery('#gadash-widget *').tooltip();
|
276 |
-
});
|
277 |
-
|
278 |
-
function onlyUniqueValues(value, index, self) {
|
279 |
-
return self.indexOf(value) === index;
|
280 |
-
}
|
281 |
-
|
282 |
-
function countsessions(data, searchvalue) {
|
283 |
-
var count = 0;
|
284 |
-
for ( var i = 0; i < data["rows"].length; i = i + 1 ) {
|
285 |
-
if (jQuery.inArray(searchvalue, data["rows"][ i ])>-1){
|
286 |
-
count += parseInt(data["rows"][ i ][6]);
|
287 |
-
}
|
288 |
-
}
|
289 |
-
return count;
|
290 |
-
}
|
291 |
-
|
292 |
-
function gadash_generatetooltip(data) {
|
293 |
-
var count = 0;
|
294 |
-
var table = "";
|
295 |
-
for ( var i = 0; i < data.length; i = i + 1 ) {
|
296 |
-
count += parseInt(data[ i ].count);
|
297 |
-
table += "<tr><td class='gadash-pgdetailsl'>"+data[i].value+"</td><td class='gadash-pgdetailsr'>"+data[ i ].count+"</td></tr>";
|
298 |
-
};
|
299 |
-
if (count){
|
300 |
-
return("<table>"+table+"</table>");
|
301 |
-
}else{
|
302 |
-
return("");
|
303 |
-
}
|
304 |
-
}
|
305 |
-
|
306 |
-
function gadash_pagedetails(data, searchvalue) {
|
307 |
-
var newdata = [];
|
308 |
-
for ( var i = 0; i < data["rows"].length; i = i + 1 ){
|
309 |
-
var sant=1;
|
310 |
-
for ( var j = 0; j < newdata.length; j = j + 1 ){
|
311 |
-
if (data["rows"][i][0]+data["rows"][i][1]+data["rows"][i][2]+data["rows"][i][3]==newdata[j][0]+newdata[j][1]+newdata[j][2]+newdata[j][3]){
|
312 |
-
newdata[j][6] = parseInt(newdata[j][6]) + parseInt(data["rows"][i][6]);
|
313 |
-
sant = 0;
|
314 |
-
}
|
315 |
-
}
|
316 |
-
if (sant){
|
317 |
-
newdata.push(data["rows"][i].slice());
|
318 |
-
}
|
319 |
-
}
|
320 |
-
|
321 |
-
var countrfr = 0;
|
322 |
-
var countkwd = 0;
|
323 |
-
var countdrt = 0;
|
324 |
-
var countscl = 0;
|
325 |
-
var countcpg = 0;
|
326 |
-
var tablerfr = "";
|
327 |
-
var tablekwd = "";
|
328 |
-
var tablescl = "";
|
329 |
-
var tablecpg = "";
|
330 |
-
var tabledrt = "";
|
331 |
-
for ( var i = 0; i < newdata.length; i = i + 1 ) {
|
332 |
-
if (newdata[i][0] == searchvalue){
|
333 |
-
var pagetitle = newdata[i][5];
|
334 |
-
|
335 |
-
switch (newdata[i][3]){
|
336 |
-
|
337 |
-
case "REFERRAL": countrfr += parseInt(newdata[ i ][6]);
|
338 |
-
tablerfr += "<tr><td class='gadash-pgdetailsl'>"+newdata[i][1]+"</td><td class='gadash-pgdetailsr'>"+newdata[ i ][6]+"</td></tr>";
|
339 |
-
break;
|
340 |
-
case "ORGANIC": countkwd += parseInt(newdata[ i ][6]);
|
341 |
-
tablekwd += "<tr><td class='gadash-pgdetailsl'>"+newdata[i][2]+"</td><td class='gadash-pgdetailsr'>"+newdata[ i ][6]+"</td></tr>";
|
342 |
-
break;
|
343 |
-
case "SOCIAL": countscl += parseInt(newdata[ i ][6]);
|
344 |
-
tablescl += "<tr><td class='gadash-pgdetailsl'>"+newdata[i][1]+"</td><td class='gadash-pgdetailsr'>"+newdata[ i ][6]+"</td></tr>";
|
345 |
-
break;
|
346 |
-
case "CUSTOM": countcpg += parseInt(newdata[ i ][6]);
|
347 |
-
tablecpg += "<tr><td class='gadash-pgdetailsl'>"+newdata[i][1]+"</td><td class='gadash-pgdetailsr'>"+newdata[ i ][6]+"</td></tr>";
|
348 |
-
break;
|
349 |
-
case "DIRECT": countdrt += parseInt(newdata[ i ][6]);
|
350 |
-
break;
|
351 |
-
};
|
352 |
-
};
|
353 |
-
};
|
354 |
-
if (countrfr){
|
355 |
-
tablerfr = "<table><tr><td><?php _e("REFERRALS", 'google-analytics-dashboard-for-wp');?> ("+countrfr+")</td></tr>"+tablerfr+"</table><br />";
|
356 |
-
}
|
357 |
-
if (countkwd){
|
358 |
-
tablekwd = "<table><tr><td><?php _e("KEYWORDS", 'google-analytics-dashboard-for-wp');?> ("+countkwd+")</td></tr>"+tablekwd+"</table><br />";
|
359 |
-
}
|
360 |
-
if (countscl){
|
361 |
-
tablescl = "<table><tr><td><?php _e("SOCIAL", 'google-analytics-dashboard-for-wp');?> ("+countscl+")</td></tr>"+tablescl+"</table><br />";
|
362 |
-
}
|
363 |
-
if (countcpg){
|
364 |
-
tablecpg = "<table><tr><td><?php _e("CAMPAIGN", 'google-analytics-dashboard-for-wp');?> ("+countcpg+")</td></tr>"+tablecpg+"</table><br />";
|
365 |
-
}
|
366 |
-
if (countdrt){
|
367 |
-
tabledrt = "<table><tr><td><?php _e("DIRECT", 'google-analytics-dashboard-for-wp');?> ("+countdrt+")</td></tr></table><br />";
|
368 |
-
}
|
369 |
-
return ("<p><center><strong>"+pagetitle+"</strong></center></p>"+tablerfr+tablekwd+tablescl+tablecpg+tabledrt);
|
370 |
-
}
|
371 |
-
|
372 |
-
function online_refresh(){
|
373 |
-
if (focusFlag){
|
374 |
-
|
375 |
-
jQuery.post(ajaxurl, {action: "gadash_get_widgetreports",projectId: "<?php echo $projectId; ?>",from: false,to: false,query: "realtime",gadash_security_widget_reports: "<?php echo wp_create_nonce('gadash_get_widgetreports'); ?>"}, function(results){
|
376 |
-
|
377 |
-
data = results[0];
|
378 |
-
|
379 |
-
if (jQuery.isNumeric(data) || typeof data === "undefined"){
|
380 |
-
data = [];
|
381 |
-
data["totalsForAllResults"] = []
|
382 |
-
data["totalsForAllResults"]["rt:activeUsers"] = "0";
|
383 |
-
data["rows"]= [];
|
384 |
-
}
|
385 |
-
|
386 |
-
if (data["totalsForAllResults"]["rt:activeUsers"]!==document.getElementById("gadash-online").innerHTML){
|
387 |
-
jQuery("#gadash-online").fadeOut("slow");
|
388 |
-
jQuery("#gadash-online").fadeOut(500);
|
389 |
-
jQuery("#gadash-online").fadeOut("slow", function() {
|
390 |
-
if ((parseInt(data["totalsForAllResults"]["rt:activeUsers"]))<(parseInt(document.getElementById("gadash-online").innerHTML))){
|
391 |
-
jQuery("#gadash-online").css({'background-color' : '#FFE8E8'});
|
392 |
-
}else{
|
393 |
-
jQuery("#gadash-online").css({'background-color' : '#E0FFEC'});
|
394 |
-
}
|
395 |
-
document.getElementById("gadash-online").innerHTML = data["totalsForAllResults"]["rt:activeUsers"];
|
396 |
-
});
|
397 |
-
jQuery("#gadash-online").fadeIn("slow");
|
398 |
-
jQuery("#gadash-online").fadeIn(500);
|
399 |
-
jQuery("#gadash-online").fadeIn("slow", function() {
|
400 |
-
jQuery("#gadash-online").css({'background-color' : '#FFFFFF'});
|
401 |
-
});
|
402 |
-
};
|
403 |
-
|
404 |
-
if (data["totalsForAllResults"]["rt:activeUsers"] == 0){
|
405 |
-
data["rows"]= [];
|
406 |
-
};
|
407 |
-
|
408 |
-
var pagepath = [];
|
409 |
-
var referrals = [];
|
410 |
-
var keywords = [];
|
411 |
-
var social = [];
|
412 |
-
var visittype = [];
|
413 |
-
var custom = [];
|
414 |
-
for ( var i = 0; i < data["rows"].length; i = i + 1 ) {
|
415 |
-
pagepath.push( data["rows"][ i ][0] );
|
416 |
-
if (data["rows"][i][3]=="REFERRAL"){
|
417 |
-
referrals.push( data["rows"][ i ][1] );
|
418 |
-
}
|
419 |
-
if (data["rows"][i][3]=="ORGANIC"){
|
420 |
-
keywords.push( data["rows"][ i ][2] );
|
421 |
-
}
|
422 |
-
if (data["rows"][i][3]=="SOCIAL"){
|
423 |
-
social.push( data["rows"][ i ][1] );
|
424 |
-
}
|
425 |
-
if (data["rows"][i][3]=="CUSTOM"){
|
426 |
-
custom.push( data["rows"][ i ][1] );
|
427 |
-
}
|
428 |
-
visittype.push( data["rows"][ i ][3] );
|
429 |
-
}
|
430 |
-
|
431 |
-
var upagepathstats = [];
|
432 |
-
var upagepath = pagepath.filter(onlyUniqueValues);
|
433 |
-
for ( var i = 0; i < upagepath.length; i = i + 1 ) {
|
434 |
-
upagepathstats[i]={"pagepath":upagepath[i],"count":countsessions(data,upagepath[i])};
|
435 |
-
}
|
436 |
-
upagepathstats.sort( function(a,b){ return b.count - a.count } );
|
437 |
-
|
438 |
-
var pgstatstable = "";
|
439 |
-
for ( var i = 0; i < upagepathstats.length; i = i + 1 ) {
|
440 |
-
if (i < <?php echo $this->gadwp->config->options['ga_realtime_pages']; ?>){
|
441 |
-
pgstatstable += '<div class="gadash-pline"><div class="gadash-pleft"><a href="#" data-tooltip="'+gadash_pagedetails(data, upagepathstats[i].pagepath)+'">'+upagepathstats[i].pagepath.substring(0,70)+'</a></div><div class="gadash-pright">'+upagepathstats[i].count+'</div></div>';
|
442 |
-
}
|
443 |
-
}
|
444 |
-
document.getElementById("gadash-pages").innerHTML='<br /><div class="gadash-pg">'+pgstatstable+'</div>';
|
445 |
-
|
446 |
-
var ureferralsstats = [];
|
447 |
-
var ureferrals = referrals.filter(onlyUniqueValues);
|
448 |
-
for ( var i = 0; i < ureferrals.length; i = i + 1 ) {
|
449 |
-
ureferralsstats[i]={"value":ureferrals[i],"count":countsessions(data,ureferrals[i])};
|
450 |
-
}
|
451 |
-
ureferralsstats.sort( function(a,b){ return b.count - a.count } );
|
452 |
-
|
453 |
-
var ukeywordsstats = [];
|
454 |
-
var ukeywords = keywords.filter(onlyUniqueValues);
|
455 |
-
for ( var i = 0; i < ukeywords.length; i = i + 1 ) {
|
456 |
-
ukeywordsstats[i]={"value":ukeywords[i],"count":countsessions(data,ukeywords[i])};
|
457 |
-
}
|
458 |
-
ukeywordsstats.sort( function(a,b){ return b.count - a.count } );
|
459 |
-
|
460 |
-
var usocialstats = [];
|
461 |
-
var usocial = social.filter(onlyUniqueValues);
|
462 |
-
for ( var i = 0; i < usocial.length; i = i + 1 ) {
|
463 |
-
usocialstats[i]={"value":usocial[i],"count":countsessions(data,usocial[i])};
|
464 |
-
}
|
465 |
-
usocialstats.sort( function(a,b){ return b.count - a.count } );
|
466 |
-
|
467 |
-
var ucustomstats = [];
|
468 |
-
var ucustom = custom.filter(onlyUniqueValues);
|
469 |
-
for ( var i = 0; i < ucustom.length; i = i + 1 ) {
|
470 |
-
ucustomstats[i]={"value":ucustom[i],"count":countsessions(data,ucustom[i])};
|
471 |
-
}
|
472 |
-
ucustomstats.sort( function(a,b){ return b.count - a.count } );
|
473 |
-
|
474 |
-
var uvisittype = ["REFERRAL","ORGANIC","SOCIAL","CUSTOM"];
|
475 |
-
document.getElementById("gadash-tdo-right").innerHTML = '<div class="gadash-bigtext"><a href="#" data-tooltip="'+gadash_generatetooltip(ureferralsstats)+'"><div class="gadash-bleft">'+'<?php _e("REFERRAL", 'google-analytics-dashboard-for-wp');?>'+'</a></div><div class="gadash-bright">'+countsessions(data,uvisittype[0])+'</div></div>';
|
476 |
-
document.getElementById("gadash-tdo-right").innerHTML += '<div class="gadash-bigtext"><a href="#" data-tooltip="'+gadash_generatetooltip(ukeywordsstats)+'"><div class="gadash-bleft">'+'<?php _e("ORGANIC", 'google-analytics-dashboard-for-wp');?>'+'</a></div><div class="gadash-bright">'+countsessions(data,uvisittype[1])+'</div></div>';
|
477 |
-
document.getElementById("gadash-tdo-right").innerHTML += '<div class="gadash-bigtext"><a href="#" data-tooltip="'+gadash_generatetooltip(usocialstats)+'"><div class="gadash-bleft">'+'<?php _e("SOCIAL", 'google-analytics-dashboard-for-wp');?>'+'</a></div><div class="gadash-bright">'+countsessions(data,uvisittype[2])+'</div></div>';
|
478 |
-
document.getElementById("gadash-tdo-right").innerHTML += '<div class="gadash-bigtext"><a href="#" data-tooltip="'+gadash_generatetooltip(ucustomstats)+'"><div class="gadash-bleft">'+'<?php _e("CAMPAIGN", 'google-analytics-dashboard-for-wp');?>'+'</a></div><div class="gadash-bright">'+countsessions(data,uvisittype[3])+'</div></div>';
|
479 |
-
|
480 |
-
var uvisitortype = ["DIRECT","NEW"];
|
481 |
-
document.getElementById("gadash-tdo-right").innerHTML += '<div class="gadash-bigtext"><div class="gadash-bleft">'+'<?php _e("DIRECT", 'google-analytics-dashboard-for-wp');?>'+'</div><div class="gadash-bright">'+countsessions(data,uvisitortype[0])+'</div></div>';
|
482 |
-
document.getElementById("gadash-tdo-right").innerHTML += '<div class="gadash-bigtext"><div class="gadash-bleft">'+'<?php _e("NEW", 'google-analytics-dashboard-for-wp');?>'+'</div><div class="gadash-bright">'+countsessions(data,uvisitortype[1])+'</div></div>';
|
483 |
-
|
484 |
-
});
|
485 |
-
};
|
486 |
-
};
|
487 |
-
online_refresh();
|
488 |
-
setInterval(online_refresh, 60000);
|
489 |
-
</script>
|
490 |
-
<?php } else if (array_search($query, array('referrers','contentpages','searches')) !== false) {?>
|
491 |
-
<div id="gadash-trafficchannels"></div>
|
492 |
-
<div id="gadash-prs"></div>
|
493 |
-
<script type="text/javascript">
|
494 |
-
google.load("visualization", "1", {packages:["table","orgchart"]});
|
495 |
-
|
496 |
-
try {
|
497 |
-
NProgress.configure({ parent: "#gadash-progressbar" });
|
498 |
-
NProgress.configure({ showSpinner: false });
|
499 |
-
NProgress.start();
|
500 |
-
} catch(e) {
|
501 |
-
jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
|
502 |
-
jQuery("#gadash-progressbar").html("<?php _e("A JavaScript Error is blocking plugin resources!", 'google-analytics-dashboard-for-wp'); ?>");
|
503 |
-
}
|
504 |
-
|
505 |
-
jQuery.post(ajaxurl, {action: "gadash_get_widgetreports",projectId: "<?php echo $projectId; ?>",from: "<?php echo $from; ?>",to: "<?php echo $to; ?>",query: "<?php echo 'trafficchannels,' . $query; ?>",gadash_security_widget_reports: "<?php echo wp_create_nonce('gadash_get_widgetreports'); ?>"}, function(response){
|
506 |
-
if ( jQuery.isArray( response ) ) {
|
507 |
-
|
508 |
-
if (!jQuery.isNumeric(response[0])){
|
509 |
-
if (jQuery.isArray(response[0])){
|
510 |
-
gadash_trafficchannels=response[0];
|
511 |
-
google.setOnLoadCallback(ga_dash_drawtrafficchannels(gadash_trafficchannels));
|
512 |
-
} else {
|
513 |
-
jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
|
514 |
-
jQuery("#gadash-progressbar").html("<?php _e("Invalid response, more details in JavaScript Console (F12).", 'google-analytics-dashboard-for-wp'); ?>");
|
515 |
-
console.log("\n********************* GADWP Log ********************* \n\n"+response[0]);
|
516 |
-
}
|
517 |
-
}else{
|
518 |
-
jQuery("#gadash-trafficchannels").css({"background-color":"#F7F7F7","height":"auto","padding-top":"125px","padding-bottom":"125px","color":"#000","text-align":"center"});
|
519 |
-
jQuery("#gadash-trafficchannels").html("<?php _e("This report is unavailable", 'google-analytics-dashboard-for-wp'); ?> ("+response[0]+")");
|
520 |
-
}
|
521 |
-
|
522 |
-
if (!jQuery.isNumeric(response[1])){
|
523 |
-
if (jQuery.isArray(response[1])){
|
524 |
-
gadash_prs=response[1];
|
525 |
-
google.setOnLoadCallback(ga_dash_drawprs(gadash_prs));
|
526 |
-
} else {
|
527 |
-
jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
|
528 |
-
jQuery("#gadash-progressbar").html("<?php _e("Invalid response, more details in JavaScript Console (F12).", 'google-analytics-dashboard-for-wp'); ?>");
|
529 |
-
console.log("\n********************* GADWP Log ********************* \n\n"+response[1]);
|
530 |
-
}
|
531 |
-
}else{
|
532 |
-
jQuery("#gadash-prs").css({"background-color":"#F7F7F7","height":"auto","padding-top":"125px","padding-bottom":"125px","color":"#000","text-align":"center"});
|
533 |
-
jQuery("#gadash-prs").html("<?php _e("This report is unavailable", 'google-analytics-dashboard-for-wp'); ?> ("+response[1]+")");
|
534 |
-
}
|
535 |
-
|
536 |
-
}else{
|
537 |
-
jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
|
538 |
-
jQuery("#gadash-progressbar").html("<?php _e("Invalid response, more details in JavaScript Console (F12).", 'google-analytics-dashboard-for-wp'); ?>");
|
539 |
-
console.log("\n********************* GADWP Log ********************* \n\n"+response);
|
540 |
-
}
|
541 |
-
NProgress.done();
|
542 |
-
});
|
543 |
-
|
544 |
-
function ga_dash_drawprs(gadash_prs) {
|
545 |
-
var data = google.visualization.arrayToDataTable(gadash_prs);
|
546 |
-
var options = {
|
547 |
-
page: 'enable',
|
548 |
-
pageSize: 10,
|
549 |
-
width: '100%',
|
550 |
-
allowHtml: true
|
551 |
-
};
|
552 |
-
|
553 |
-
var chart = new google.visualization.Table(document.getElementById('gadash-prs'));
|
554 |
-
chart.draw(data, options);
|
555 |
-
};
|
556 |
-
|
557 |
-
function ga_dash_drawtrafficchannels(gadash_trafficchannels) {
|
558 |
-
var data = google.visualization.arrayToDataTable(gadash_trafficchannels);
|
559 |
-
var options = {
|
560 |
-
allowCollapse:true,
|
561 |
-
allowHtml:true
|
562 |
-
};
|
563 |
-
|
564 |
-
var chart = new google.visualization.OrgChart(document.getElementById('gadash-trafficchannels'));
|
565 |
-
chart.draw(data, options);
|
566 |
-
};
|
567 |
-
</script>
|
568 |
-
<?php } else if ($query == 'trafficdetails') {?>
|
569 |
-
<div id="gadash-trafficchannels"></div>
|
570 |
-
<div class="gadash-floatwraper">
|
571 |
-
<div id="gadash-trafficmediums"></div>
|
572 |
-
<div id="gadash-traffictype"></div>
|
573 |
-
</div>
|
574 |
-
<div class="gadash-floatwraper">
|
575 |
-
<div id="gadash-trafficorganic"></div>
|
576 |
-
<div id="gadash-socialnetworks"></div>
|
577 |
-
</div>
|
578 |
-
<script type="text/javascript">
|
579 |
-
google.load("visualization", "1", {packages:["corechart","orgchart"]});
|
580 |
-
|
581 |
-
try {
|
582 |
-
NProgress.configure({ parent: "#gadash-progressbar" });
|
583 |
-
NProgress.configure({ showSpinner: false });
|
584 |
-
NProgress.start();
|
585 |
-
} catch(e) {
|
586 |
-
jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
|
587 |
-
jQuery("#gadash-progressbar").html("<?php _e("A JavaScript Error is blocking plugin resources!", 'google-analytics-dashboard-for-wp'); ?>");
|
588 |
-
}
|
589 |
-
|
590 |
-
jQuery.post(ajaxurl, {action: "gadash_get_widgetreports",projectId: "<?php echo $projectId; ?>",from: "<?php echo $from; ?>",to: "<?php echo $to; ?>",query: "trafficchannels,medium,visitorType,source,socialNetwork",gadash_security_widget_reports: "<?php echo wp_create_nonce('gadash_get_widgetreports'); ?>"}, function(response){
|
591 |
-
if ( jQuery.isArray( response ) ) {
|
592 |
-
|
593 |
-
if (!jQuery.isNumeric(response[0])){
|
594 |
-
if (jQuery.isArray(response[0])){
|
595 |
-
gadash_trafficchannels=response[0];
|
596 |
-
google.setOnLoadCallback(ga_dash_drawtrafficchannels(gadash_trafficchannels));
|
597 |
-
} else {
|
598 |
-
jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
|
599 |
-
jQuery("#gadash-progressbar").html("<?php _e("Invalid response, more details in JavaScript Console (F12).", 'google-analytics-dashboard-for-wp'); ?>");
|
600 |
-
console.log("\n********************* GADWP Log ********************* \n\n"+response[0]);
|
601 |
-
}
|
602 |
-
}else{
|
603 |
-
jQuery("#gadash-trafficchannels").css({"background-color":"#F7F7F7","height":"auto","padding-top":"125px","padding-bottom":"125px","color":"#000","text-align":"center"});
|
604 |
-
jQuery("#gadash-trafficchannels").html("<?php _e("This report is unavailable", 'google-analytics-dashboard-for-wp'); ?> ("+response[0]+")");
|
605 |
-
}
|
606 |
-
|
607 |
-
if (!jQuery.isNumeric(response[1])){
|
608 |
-
if (jQuery.isArray(response[1])){
|
609 |
-
gadash_trafficmediums=response[1];
|
610 |
-
google.setOnLoadCallback(ga_dash_drawtrafficmediums(gadash_trafficmediums));
|
611 |
-
} else {
|
612 |
-
jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
|
613 |
-
jQuery("#gadash-progressbar").html("<?php _e("Invalid response, more details in JavaScript Console (F12).", 'google-analytics-dashboard-for-wp'); ?>");
|
614 |
-
console.log("\n********************* GADWP Log ********************* \n\n"+response[1]);
|
615 |
-
}
|
616 |
-
}else{
|
617 |
-
jQuery("#gadash-trafficmediums").css({"background-color":"#F7F7F7","height":"auto","padding-top":"80px","padding-bottom":"80px","color":"#000","text-align":"center"});
|
618 |
-
jQuery("#gadash-trafficmediums").html("<?php _e("This report is unavailable", 'google-analytics-dashboard-for-wp'); ?> ("+response[1]+")");
|
619 |
-
}
|
620 |
-
|
621 |
-
if (!jQuery.isNumeric(response[2])){
|
622 |
-
if (jQuery.isArray(response[2])){
|
623 |
-
gadash_traffictype=response[2];
|
624 |
-
google.setOnLoadCallback(ga_dash_drawtraffictype(gadash_traffictype));
|
625 |
-
} else {
|
626 |
-
jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
|
627 |
-
jQuery("#gadash-progressbar").html("<?php _e("Invalid response, more details in JavaScript Console (F12).", 'google-analytics-dashboard-for-wp'); ?>");
|
628 |
-
console.log("\n********************* GADWP Log ********************* \n\n"+response[2]);
|
629 |
-
}
|
630 |
-
}else{
|
631 |
-
jQuery("#gadash-traffictype").css({"background-color":"#F7F7F7","height":"auto","padding-top":"80px","padding-bottom":"80px","color":"#000","text-align":"center"});
|
632 |
-
jQuery("#gadash-traffictype").html("<?php _e("This report is unavailable", 'google-analytics-dashboard-for-wp'); ?> ("+response[2]+")");
|
633 |
-
}
|
634 |
-
|
635 |
-
if (!jQuery.isNumeric(response[3])){
|
636 |
-
if (jQuery.isArray(response[3])){
|
637 |
-
gadash_trafficorganic=response[3];
|
638 |
-
google.setOnLoadCallback(ga_dash_drawtrafficorganic(gadash_trafficorganic));
|
639 |
-
} else {
|
640 |
-
jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
|
641 |
-
jQuery("#gadash-progressbar").html("<?php _e("Invalid response, more details in JavaScript Console (F12).", 'google-analytics-dashboard-for-wp'); ?>");
|
642 |
-
console.log("\n********************* GADWP Log ********************* \n\n"+response[3]);
|
643 |
-
}
|
644 |
-
}else{
|
645 |
-
jQuery("#gadash-trafficorganic").css({"background-color":"#F7F7F7","height":"auto","padding-top":"80px","padding-bottom":"80px","color":"#000","text-align":"center"});
|
646 |
-
jQuery("#gadash-trafficorganic").html("<?php _e("This report is unavailable", 'google-analytics-dashboard-for-wp'); ?> ("+response[3]+")");
|
647 |
-
}
|
648 |
-
|
649 |
-
if (!jQuery.isNumeric(response[4])){
|
650 |
-
if (jQuery.isArray(response[4])){
|
651 |
-
gadash_socialnetworks=response[4];
|
652 |
-
google.setOnLoadCallback(ga_dash_drawsocialnetworks(gadash_socialnetworks));
|
653 |
-
} else {
|
654 |
-
jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
|
655 |
-
jQuery("#gadash-progressbar").html("<?php _e("Invalid response, more details in JavaScript Console (F12).", 'google-analytics-dashboard-for-wp'); ?>");
|
656 |
-
console.log("\n********************* GADWP Log ********************* \n\n"+response[4]);
|
657 |
-
}
|
658 |
-
}else{
|
659 |
-
jQuery("#gadash-socialnetworks").css({"background-color":"#F7F7F7","height":"auto","padding-top":"80px","padding-bottom":"80px","color":"#000","text-align":"center"});
|
660 |
-
jQuery("#gadash-socialnetworks").html("<?php _e("This report is unavailable", 'google-analytics-dashboard-for-wp'); ?> ("+response[4]+")");
|
661 |
-
}
|
662 |
-
|
663 |
-
}else{
|
664 |
-
jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
|
665 |
-
jQuery("#gadash-progressbar").html("<?php _e("Invalid response, more details in JavaScript Console (F12).", 'google-analytics-dashboard-for-wp'); ?>");
|
666 |
-
console.log("\n********************* GADWP Log ********************* \n\n"+response);
|
667 |
-
}
|
668 |
-
NProgress.done();
|
669 |
-
});
|
670 |
-
|
671 |
-
function ga_dash_drawtrafficmediums(gadash_trafficmediums) {
|
672 |
-
var data = google.visualization.arrayToDataTable(gadash_trafficmediums);
|
673 |
-
var options = {
|
674 |
-
is3D: false,
|
675 |
-
tooltipText: 'percentage',
|
676 |
-
legend: 'none',
|
677 |
-
chartArea: {width: '99%',height: '80%'},
|
678 |
-
title: '<?php _e( "Traffic Mediums", 'google-analytics-dashboard-for-wp' ); ?>',
|
679 |
-
colors:['<?php echo esc_html($this->gadwp->config->options ['ga_dash_style']); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], - 10 )); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], + 20 )); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], + 10 )); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], - 20 )); ?>']
|
680 |
-
};
|
681 |
-
|
682 |
-
var chart = new google.visualization.PieChart(document.getElementById('gadash-trafficmediums'));
|
683 |
-
chart.draw(data, options);
|
684 |
-
};
|
685 |
-
|
686 |
-
function ga_dash_drawtraffictype(gadash_traffictype) {
|
687 |
-
var data = google.visualization.arrayToDataTable(gadash_traffictype);
|
688 |
-
var options = {
|
689 |
-
is3D: false,
|
690 |
-
tooltipText: 'percentage',
|
691 |
-
legend: 'none',
|
692 |
-
chartArea: {width: '99%',height: '80%'},
|
693 |
-
title: '<?php _e( "Visitor Type", 'google-analytics-dashboard-for-wp' ); ?>',
|
694 |
-
colors:['<?php echo esc_html($this->gadwp->config->options ['ga_dash_style']); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], - 10 )); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], + 20 )); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], + 10 )); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], - 20 )); ?>']
|
695 |
-
};
|
696 |
-
|
697 |
-
var chart = new google.visualization.PieChart(document.getElementById('gadash-traffictype'));
|
698 |
-
chart.draw(data, options);
|
699 |
-
};
|
700 |
-
|
701 |
-
function ga_dash_drawsocialnetworks(gadash_socialnetworks) {
|
702 |
-
var data = google.visualization.arrayToDataTable(gadash_socialnetworks);
|
703 |
-
var options = {
|
704 |
-
is3D: false,
|
705 |
-
tooltipText: 'percentage',
|
706 |
-
legend: 'none',
|
707 |
-
chartArea: {width: '99%',height: '80%'},
|
708 |
-
title: '<?php _e( "Social Networks", 'google-analytics-dashboard-for-wp' ); ?>',
|
709 |
-
colors:['<?php echo esc_html($this->gadwp->config->options ['ga_dash_style']); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], - 10 )); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], + 20 )); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], + 10 )); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], - 20 )); ?>']
|
710 |
-
};
|
711 |
-
|
712 |
-
var chart = new google.visualization.PieChart(document.getElementById('gadash-socialnetworks'));
|
713 |
-
chart.draw(data, options);
|
714 |
-
};
|
715 |
-
|
716 |
-
function ga_dash_drawtrafficorganic(gadash_trafficorganic) {
|
717 |
-
var data = google.visualization.arrayToDataTable(gadash_trafficorganic);
|
718 |
-
var options = {
|
719 |
-
is3D: false,
|
720 |
-
tooltipText: 'percentage',
|
721 |
-
legend: 'none',
|
722 |
-
chartArea: {width: '99%',height: '80%'},
|
723 |
-
title: '<?php _e( "Search Engines", 'google-analytics-dashboard-for-wp' ); ?>',
|
724 |
-
colors:['<?php echo esc_html($this->gadwp->config->options ['ga_dash_style']); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], - 10 )); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], + 20 )); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], + 10 )); ?>','<?php echo esc_html(GADWP_Tools::colourVariator ( $this->gadwp->config->options ['ga_dash_style'], - 20 )); ?>']
|
725 |
-
};
|
726 |
-
|
727 |
-
var chart = new google.visualization.PieChart(document.getElementById('gadash-trafficorganic'));
|
728 |
-
chart.draw(data, options);
|
729 |
-
};
|
730 |
-
|
731 |
-
function ga_dash_drawtrafficchannels(gadash_trafficchannels) {
|
732 |
-
var data = google.visualization.arrayToDataTable(gadash_trafficchannels);
|
733 |
-
var options = {
|
734 |
-
allowCollapse:true,
|
735 |
-
allowHtml:true
|
736 |
-
};
|
737 |
-
|
738 |
-
var chart = new google.visualization.OrgChart(document.getElementById('gadash-trafficchannels'));
|
739 |
-
chart.draw(data, options);
|
740 |
-
};
|
741 |
-
</script>
|
742 |
-
<?php } else if ($query == 'locations') {?>
|
743 |
-
<div id="gadash-map"></div>
|
744 |
-
<div id="gadash-locations"></div>
|
745 |
-
<script type="text/javascript">
|
746 |
-
google.load("visualization", "1", {packages:["geochart","table"]});
|
747 |
-
|
748 |
-
try {
|
749 |
-
NProgress.configure({ parent: "#gadash-progressbar" });
|
750 |
-
NProgress.configure({ showSpinner: false });
|
751 |
-
NProgress.start();
|
752 |
-
} catch(e) {
|
753 |
-
jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
|
754 |
-
jQuery("#gadash-progressbar").html("<?php _e("A JavaScript Error is blocking plugin resources!", 'google-analytics-dashboard-for-wp'); ?>");
|
755 |
-
}
|
756 |
-
|
757 |
-
jQuery.post(ajaxurl, {action: "gadash_get_widgetreports",projectId: "<?php echo $projectId; ?>",from: "<?php echo $from; ?>",to: "<?php echo $to; ?>",query: "<?php echo $query; ?>",gadash_security_widget_reports: "<?php echo wp_create_nonce('gadash_get_widgetreports'); ?>"}, function(response){
|
758 |
-
|
759 |
-
if ( jQuery.isArray( response ) ) {
|
760 |
-
if (!jQuery.isNumeric(response[0])){
|
761 |
-
if (jQuery.isArray(response[0])){
|
762 |
-
gadash_locations=response[0];
|
763 |
-
google.setOnLoadCallback(ga_dash_drawmaplocations(gadash_locations));
|
764 |
-
google.setOnLoadCallback(ga_dash_drawlocations(gadash_locations));
|
765 |
-
} else {
|
766 |
-
jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
|
767 |
-
jQuery("#gadash-progressbar").html("<?php _e("Invalid response, more details in JavaScript Console (F12).", 'google-analytics-dashboard-for-wp'); ?>");
|
768 |
-
console.log("\n********************* GADWP Log ********************* \n\n"+response[0]);
|
769 |
-
}
|
770 |
-
}else{
|
771 |
-
jQuery("#gadash-map").css({"background-color":"#F7F7F7","height":"auto","padding-top":"125px","padding-bottom":"125px","color":"#000","text-align":"center"});
|
772 |
-
jQuery("#gadash-map").html("<?php _e("This report is unavailable", 'google-analytics-dashboard-for-wp'); ?> ("+response[0]+")");
|
773 |
-
jQuery("#gadash-locations").css({"background-color":"#F7F7F7","height":"auto","padding-top":"125px","padding-bottom":"125px","color":"#000","text-align":"center"});
|
774 |
-
jQuery("#gadash-locations").html("<?php _e("This report is unavailable", 'google-analytics-dashboard-for-wp'); ?> ("+response[0]+")");
|
775 |
-
}
|
776 |
-
|
777 |
-
}else{
|
778 |
-
jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
|
779 |
-
jQuery("#gadash-progressbar").html("<?php _e("Invalid response, more details in JavaScript Console (F12).", 'google-analytics-dashboard-for-wp'); ?>");
|
780 |
-
console.log("\n********************* GADWP Log ********************* \n\n"+response);
|
781 |
-
}
|
782 |
-
NProgress.done();
|
783 |
-
});
|
784 |
-
|
785 |
-
function ga_dash_drawmaplocations(gadash_locations) {
|
786 |
-
|
787 |
-
var data = google.visualization.arrayToDataTable(gadash_locations);
|
788 |
-
|
789 |
-
var options = {
|
790 |
-
chartArea: {width: '99%',height: '90%'},
|
791 |
-
colors: ['<?php echo $light_color; ?>', '<?php echo $dark_color; ?>'],
|
792 |
-
<?php
|
793 |
-
|
794 |
-
$country_codes = GADWP_Tools::get_countrycodes();
|
795 |
-
if ( $this->gadwp->config->options['ga_target_geomap'] && isset( $country_codes[$this->gadwp->config->options['ga_target_geomap']] ) ) {
|
796 |
-
?>
|
797 |
-
region : '<?php echo esc_html($this->gadwp->config->options ['ga_target_geomap']); ?>',
|
798 |
-
displayMode : 'markers',
|
799 |
-
datalessRegionColor : 'EFEFEF'
|
800 |
-
<?php } ?>
|
801 |
-
}
|
802 |
-
var chart = new google.visualization.GeoChart(document.getElementById('gadash-map'));
|
803 |
-
chart.draw(data, options);
|
804 |
-
}
|
805 |
-
|
806 |
-
function ga_dash_drawlocations(gadash_locations) {
|
807 |
-
var data = google.visualization.arrayToDataTable(gadash_locations);
|
808 |
-
var options = {
|
809 |
-
page: 'enable',
|
810 |
-
pageSize: 10,
|
811 |
-
width: '100%'
|
812 |
-
};
|
813 |
-
|
814 |
-
var chart = new google.visualization.Table(document.getElementById('gadash-locations'));
|
815 |
-
chart.draw(data, options);
|
816 |
-
};
|
817 |
-
</script>
|
818 |
-
<?php } else {?>
|
819 |
-
<div id="gadash-mainchart"></div>
|
820 |
-
<div id="gadash-bottomstats" class="gadash-wrapper">
|
821 |
-
<div class="inside">
|
822 |
-
<div class="small-box">
|
823 |
-
<h3><?php _e( "Sessions", 'google-analytics-dashboard-for-wp' );?></h3>
|
824 |
-
<p id="gdsessions"> </p>
|
825 |
-
</div>
|
826 |
-
<div class="small-box">
|
827 |
-
<h3><?php _e( "Users", 'google-analytics-dashboard-for-wp' );?></h3>
|
828 |
-
<p id="gdusers"> </p>
|
829 |
-
</div>
|
830 |
-
<div class="small-box">
|
831 |
-
<h3><?php _e( "Page Views", 'google-analytics-dashboard-for-wp' );?></h3>
|
832 |
-
<p id="gdpageviews"> </p>
|
833 |
-
</div>
|
834 |
-
<div class="small-box">
|
835 |
-
<h3><?php _e( "Bounce Rate", 'google-analytics-dashboard-for-wp' );?></h3>
|
836 |
-
<p id="gdbouncerate"> </p>
|
837 |
-
</div>
|
838 |
-
<div class="small-box">
|
839 |
-
<h3><?php _e( "Organic Search", 'google-analytics-dashboard-for-wp' );?></h3>
|
840 |
-
<p id="gdorganicsearch"> </p>
|
841 |
-
</div>
|
842 |
-
<div class="small-box">
|
843 |
-
<h3><?php _e( "Pages/Session", 'google-analytics-dashboard-for-wp' );?></h3>
|
844 |
-
<p id="gdpagespervisit"> </p>
|
845 |
-
</div>
|
846 |
-
</div>
|
847 |
-
</div>
|
848 |
-
<script type="text/javascript">
|
849 |
-
|
850 |
-
google.load("visualization", "1", {packages:["corechart"], 'language': '<?php echo get_bloginfo( 'language' ); ?>'});
|
851 |
-
|
852 |
-
try {
|
853 |
-
NProgress.configure({ parent: "#gadash-progressbar" });
|
854 |
-
NProgress.configure({ showSpinner: false });
|
855 |
-
NProgress.start();
|
856 |
-
} catch(e) {
|
857 |
-
jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
|
858 |
-
jQuery("#gadash-progressbar").html("<?php _e("A JavaScript Error is blocking plugin resources!", 'google-analytics-dashboard-for-wp'); ?>");
|
859 |
-
}
|
860 |
-
|
861 |
-
jQuery.post(ajaxurl, {action: "gadash_get_widgetreports",projectId: "<?php echo $projectId; ?>",from: "<?php echo $from; ?>",to: "<?php echo $to; ?>",query: "<?php echo $query . ',bottomstats'; ?>",gadash_security_widget_reports: "<?php echo wp_create_nonce('gadash_get_widgetreports'); ?>"}, function(response){
|
862 |
-
if ( jQuery.isArray( response ) ) {
|
863 |
-
|
864 |
-
if (!jQuery.isNumeric(response[0])){
|
865 |
-
if (jQuery.isArray(response[0])){
|
866 |
-
gadash_mainchart=response[0];
|
867 |
-
google.setOnLoadCallback(ga_dash_drawmainchart(gadash_mainchart));
|
868 |
-
} else {
|
869 |
-
jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
|
870 |
-
jQuery("#gadash-progressbar").html("<?php _e("Invalid response, more details in JavaScript Console (F12).", 'google-analytics-dashboard-for-wp'); ?>");
|
871 |
-
console.log("\n********************* GADWP Log ********************* \n\n"+response[0]);
|
872 |
-
}
|
873 |
-
}else{
|
874 |
-
jQuery("#gadash-mainchart").css({"background-color":"#F7F7F7","height":"auto","padding-top":"125px","padding-bottom":"125px","color":"#000","text-align":"center"});
|
875 |
-
jQuery("#gadash-mainchart").html("<?php _e("This report is unavailable", 'google-analytics-dashboard-for-wp'); ?> ("+response[0]+")");
|
876 |
-
}
|
877 |
-
|
878 |
-
if (!jQuery.isNumeric(response[1])){
|
879 |
-
if (jQuery.isArray(response[1])){
|
880 |
-
gadash_bottomstats=response[1];
|
881 |
-
ga_dash_drawbottomstats(gadash_bottomstats);
|
882 |
-
} else {
|
883 |
-
jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
|
884 |
-
jQuery("#gadash-progressbar").html("<?php _e("Invalid response, more details in JavaScript Console (F12).", 'google-analytics-dashboard-for-wp'); ?>");
|
885 |
-
console.log("\n********************* GADWP Log ********************* \n\n"+response[1]);
|
886 |
-
}
|
887 |
-
}else{
|
888 |
-
jQuery("#gadash-bottomstats").css({"background-color":"#F7F7F7","height":"auto","padding-top":"40px","padding-bottom":"40px","color":"#000","text-align":"center","width": "98%"});
|
889 |
-
jQuery("#gadash-bottomstats").html("<?php _e("This report is unavailable", 'google-analytics-dashboard-for-wp'); ?> ("+response[1]+")");
|
890 |
-
}
|
891 |
-
|
892 |
-
}else{
|
893 |
-
jQuery("#gadash-progressbar").css({"margin-top":"3px","padding-left":"5px","height":"auto","color":"#000","border-left":"5px solid red"});
|
894 |
-
jQuery("#gadash-progressbar").html("<?php _e("Invalid response, more details in JavaScript Console (F12).", 'google-analytics-dashboard-for-wp'); ?>");
|
895 |
-
console.log("\n********************* GADWP Log ********************* \n\n"+response);
|
896 |
-
}
|
897 |
-
NProgress.done();
|
898 |
-
});
|
899 |
-
|
900 |
-
function ga_dash_drawbottomstats(gadash_bottomstats) {
|
901 |
-
jQuery("#gadash-bottomstats #gdsessions").text(gadash_bottomstats[0]);
|
902 |
-
jQuery("#gadash-bottomstats #gdusers").text(gadash_bottomstats[1]);
|
903 |
-
jQuery("#gadash-bottomstats #gdpageviews").text(gadash_bottomstats[2]);
|
904 |
-
jQuery("#gadash-bottomstats #gdbouncerate").text(gadash_bottomstats[3] + "%");
|
905 |
-
jQuery("#gadash-bottomstats #gdorganicsearch").text(gadash_bottomstats[4]);
|
906 |
-
jQuery("#gadash-bottomstats #gdpagespervisit").text(gadash_bottomstats[5]);
|
907 |
-
}
|
908 |
-
|
909 |
-
function ga_dash_drawmainchart(gadash_mainchart) {
|
910 |
-
|
911 |
-
var data = google.visualization.arrayToDataTable(gadash_mainchart);
|
912 |
-
|
913 |
-
var options = {
|
914 |
-
legend: {position: 'none'},
|
915 |
-
pointSize: 3,<?php echo $css;?>
|
916 |
-
chartArea: {width: '99%',height: '90%'},
|
917 |
-
vAxis: { textPosition: "in", minValue: 0},
|
918 |
-
hAxis: { textPosition: 'none' }
|
919 |
-
};
|
920 |
-
<?php echo $formater?>
|
921 |
-
var chart = new google.visualization.AreaChart(document.getElementById('gadash-mainchart'));
|
922 |
-
chart.draw(data, options);
|
923 |
-
};
|
924 |
-
</script>
|
925 |
<?php
|
926 |
-
}
|
927 |
}
|
928 |
}
|
929 |
}
|
24 |
}
|
25 |
|
26 |
public function add_widget() {
|
27 |
+
wp_add_dashboard_widget( 'gadwp-widget', __( "Google Analytics Dashboard", 'google-analytics-dashboard-for-wp' ), array( $this, 'dashboard_widget' ), $control_callback = null );
|
28 |
}
|
29 |
|
30 |
public function dashboard_widget() {
|
31 |
+
$projectId = 0;
|
32 |
+
|
33 |
if ( empty( $this->gadwp->config->options['ga_dash_token'] ) ) {
|
34 |
echo '<p>' . __( "This plugin needs an authorization:", 'google-analytics-dashboard-for-wp' ) . '</p><form action="' . menu_page_url( 'gadash_settings', false ) . '" method="POST">' . get_submit_button( __( "Authorize Plugin", 'google-analytics-dashboard-for-wp' ), 'secondary' ) . '</form>';
|
35 |
return;
|
36 |
}
|
37 |
|
38 |
if ( current_user_can( 'manage_options' ) ) {
|
39 |
+
if ( $this->gadwp->config->options['ga_dash_tableid_jail'] ) {
|
40 |
+
$projectId = $this->gadwp->config->options['ga_dash_tableid_jail'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
} else {
|
42 |
+
echo '<p>' . __( "An admin should asign a default Google Analytics Profile.", 'google-analytics-dashboard-for-wp' ) . '</p><form action="' . menu_page_url( 'gadash_settings', false ) . '" method="POST">' . get_submit_button( __( "Select Domain", 'google-analytics-dashboard-for-wp' ), 'secondary' ) . '</form>';
|
43 |
return;
|
44 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
} else {
|
46 |
if ( $this->gadwp->config->options['ga_dash_tableid_jail'] ) {
|
47 |
$projectId = $this->gadwp->config->options['ga_dash_tableid_jail'];
|
50 |
return;
|
51 |
}
|
52 |
}
|
53 |
+
|
54 |
if ( ! ( $projectId ) ) {
|
55 |
echo '<p>' . __( "Something went wrong while retrieving property data. You need to create and properly configure a Google Analytics account:", 'google-analytics-dashboard-for-wp' ) . '</p> <form action="https://deconf.com/how-to-set-up-google-analytics-on-your-website/" method="POST">' . get_submit_button( __( "Find out more!", 'google-analytics-dashboard-for-wp' ), 'secondary' ) . '</form>';
|
56 |
return;
|
57 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
?>
|
60 |
+
<div id="gadwp-window-1"></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
<?php
|
|
|
62 |
}
|
63 |
}
|
64 |
}
|
common/js/reports.js
ADDED
@@ -0,0 +1,1199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"use strict";
|
2 |
+
|
3 |
+
google.load( "visualization", "1", {
|
4 |
+
packages : [ "corechart", "table", "orgchart", "geochart" ],
|
5 |
+
'language' : gadwp_item_data.language
|
6 |
+
} );
|
7 |
+
|
8 |
+
// Get the numeric ID
|
9 |
+
gadwp_item_data.getID = function ( item ) {
|
10 |
+
if ( gadwp_item_data.scope == 'admin-item' ) {
|
11 |
+
if ( typeof item.id == "undefined" ) {
|
12 |
+
return 0
|
13 |
+
}
|
14 |
+
if ( item.id.split( '-' )[ 1 ] == "undefined" ) {
|
15 |
+
return 0;
|
16 |
+
} else {
|
17 |
+
return item.id.split( '-' )[ 1 ];
|
18 |
+
}
|
19 |
+
} else {
|
20 |
+
if ( typeof item.id == "undefined" ) {
|
21 |
+
return 1;
|
22 |
+
}
|
23 |
+
if ( item.id.split( '-' )[ 4 ] == "undefined" ) {
|
24 |
+
return 1;
|
25 |
+
} else {
|
26 |
+
return item.id.split( '-' )[ 4 ];
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
// Get the selector
|
32 |
+
gadwp_item_data.getSelector = function ( scope ) {
|
33 |
+
if ( scope == 'admin-item' ) {
|
34 |
+
return 'a[id^="gadwp-"]';
|
35 |
+
} else {
|
36 |
+
return 'li[id^="wp-admin-bar-gadwp"]';
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
gadwp_item_data.responsiveDialog = function () {
|
41 |
+
var dialog;
|
42 |
+
var wWidth;
|
43 |
+
var visible = jQuery( ".ui-dialog:visible" );
|
44 |
+
|
45 |
+
// on each visible dialog
|
46 |
+
visible.each( function () {
|
47 |
+
dialog = jQuery( this ).find( ".ui-dialog-content" ).data( "ui-dialog" );
|
48 |
+
// on each fluid dialog
|
49 |
+
if ( dialog.options.fluid ) {
|
50 |
+
wWidth = jQuery( window ).width();
|
51 |
+
// window width vs dialog width
|
52 |
+
if ( wWidth < ( parseInt( dialog.options.maxWidth ) + 50 ) ) {
|
53 |
+
// don't fill the entire screen
|
54 |
+
jQuery( this ).css( "max-width", "90%" );
|
55 |
+
} else {
|
56 |
+
// maxWidth bug fix
|
57 |
+
jQuery( this ).css( "max-width", dialog.options.maxWidth + "px" );
|
58 |
+
}
|
59 |
+
// change dialog position
|
60 |
+
dialog.option( "position", dialog.options.position );
|
61 |
+
}
|
62 |
+
} );
|
63 |
+
}
|
64 |
+
|
65 |
+
jQuery( document ).ready( function () {
|
66 |
+
|
67 |
+
if ( gadwp_item_data.scope == 'admin-widgets' ) {
|
68 |
+
jQuery( '#gadwp-window-1' ).gadwpItemReport( 1 );
|
69 |
+
} else {
|
70 |
+
jQuery( gadwp_item_data.getSelector( gadwp_item_data.scope ) ).click( function () {
|
71 |
+
if ( !jQuery( "#gadwp-window-" + gadwp_item_data.getID( this ) ).length > 0 ) {
|
72 |
+
jQuery( "body" ).append( '<div id="gadwp-window-' + gadwp_item_data.getID( this ) + '"></div>' );
|
73 |
+
}
|
74 |
+
jQuery( '#gadwp-window-' + gadwp_item_data.getID( this ) ).gadwpItemReport( gadwp_item_data.getID( this ) );
|
75 |
+
} );
|
76 |
+
}
|
77 |
+
|
78 |
+
// on window resize
|
79 |
+
jQuery( window ).resize( function () {
|
80 |
+
gadwp_item_data.responsiveDialog();
|
81 |
+
} );
|
82 |
+
|
83 |
+
// dialog width larger than viewport
|
84 |
+
jQuery( document ).on( "dialogopen", ".ui-dialog", function ( event, ui ) {
|
85 |
+
gadwp_item_data.responsiveDialog();
|
86 |
+
} );
|
87 |
+
} );
|
88 |
+
|
89 |
+
jQuery.fn.extend( {
|
90 |
+
gadwpItemReport : function ( item_id ) {
|
91 |
+
var post_data;
|
92 |
+
var slug = "-" + item_id;
|
93 |
+
var dialog_title;
|
94 |
+
var tools = {
|
95 |
+
set_cookie : function ( name, value ) {
|
96 |
+
var expires;
|
97 |
+
var date_item = new Date();
|
98 |
+
|
99 |
+
if ( gadwp_item_data.scope == 'admin-widgets' ) {
|
100 |
+
name = "gadwp_wg_" + name;
|
101 |
+
} else {
|
102 |
+
name = "gadwp_ir_" + name;
|
103 |
+
}
|
104 |
+
date_item.setTime( date_item.getTime() + ( 24 * 60 * 60 * 1000 * 7 ) );
|
105 |
+
expires = "expires=" + date_item.toUTCString();
|
106 |
+
document.cookie = name + "=" + value + "; " + expires + "; path=/";
|
107 |
+
},
|
108 |
+
get_cookie : function ( name ) {
|
109 |
+
var i = 0;
|
110 |
+
var cookie;
|
111 |
+
var cookies_array;
|
112 |
+
var div;
|
113 |
+
|
114 |
+
if ( gadwp_item_data.scope == 'admin-widgets' ) {
|
115 |
+
name = "gadwp_wg_" + name + "=";
|
116 |
+
} else {
|
117 |
+
name = "gadwp_ir_" + name + "=";
|
118 |
+
}
|
119 |
+
cookies_array = document.cookie.split( ';' );
|
120 |
+
for ( i = 0; i < cookies_array.length; i++ ) {
|
121 |
+
cookie = cookies_array[ i ];
|
122 |
+
while ( cookie.charAt( 0 ) == ' ' )
|
123 |
+
cookie = cookie.substring( 1 );
|
124 |
+
if ( cookie.indexOf( name ) == 0 )
|
125 |
+
return cookie.substring( name.length, cookie.length );
|
126 |
+
}
|
127 |
+
return false;
|
128 |
+
},
|
129 |
+
escape : function ( str ) {
|
130 |
+
div = document.createElement( 'div' );
|
131 |
+
div.appendChild( document.createTextNode( str ) );
|
132 |
+
return div.innerHTML;
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
var template = {
|
137 |
+
|
138 |
+
addOptions : function ( id, list ) {
|
139 |
+
var default_metric;
|
140 |
+
var default_dimension;
|
141 |
+
var default_view;
|
142 |
+
var output = [];
|
143 |
+
|
144 |
+
if ( list == false ) {
|
145 |
+
return;
|
146 |
+
}
|
147 |
+
|
148 |
+
if ( !tools.get_cookie( 'default_metric' ) || !tools.get_cookie( 'default_dimension' ) ) {
|
149 |
+
if ( gadwp_item_data.scope == 'admin-widgets' ) {
|
150 |
+
default_metric = 'sessions';
|
151 |
+
} else {
|
152 |
+
default_metric = 'uniquePageviews';
|
153 |
+
}
|
154 |
+
default_dimension = '30daysAgo';
|
155 |
+
} else {
|
156 |
+
default_metric = tools.get_cookie( 'default_metric' );
|
157 |
+
default_dimension = tools.get_cookie( 'default_dimension' );
|
158 |
+
default_view = tools.get_cookie( 'default_view' );
|
159 |
+
}
|
160 |
+
|
161 |
+
jQuery.each( list, function ( key, value ) {
|
162 |
+
if ( key == default_metric || key == default_dimension || key == default_view ) {
|
163 |
+
output.push( '<option value="' + key + '" selected="selected">' + value + '</option>' );
|
164 |
+
} else {
|
165 |
+
output.push( '<option value="' + key + '">' + value + '</option>' );
|
166 |
+
}
|
167 |
+
} );
|
168 |
+
jQuery( id ).html( output.join( '' ) );
|
169 |
+
},
|
170 |
+
|
171 |
+
init : function () {
|
172 |
+
var tpl;
|
173 |
+
|
174 |
+
if ( !jQuery( '#gadwp-window' + slug ).length ) {
|
175 |
+
return;
|
176 |
+
}
|
177 |
+
|
178 |
+
if ( jQuery( '#gadwp-window' + slug ).html().length ) { // add main template once
|
179 |
+
return;
|
180 |
+
}
|
181 |
+
|
182 |
+
tpl = '<div id="gadwp-container' + slug + '">';
|
183 |
+
if ( gadwp_item_data.viewList != false ) {
|
184 |
+
tpl += '<select id="gadwp-sel-view' + slug + '"></select>';
|
185 |
+
}
|
186 |
+
tpl += '<select id="gadwp-sel-period' + slug + '"></select> ';
|
187 |
+
tpl += '<select id="gadwp-sel-report' + slug + '"></select>';
|
188 |
+
tpl += '<div id="gadwp-progressbar' + slug + '"></div>';
|
189 |
+
tpl += '<div id="gadwp-status' + slug + '"></div>';
|
190 |
+
tpl += '<div id="gadwp-reports' + slug + '"></div>';
|
191 |
+
tpl += '<div style="text-align:right;width:100%;font-size:0.8em;clear:both;margin-right:5px;margin-top:10px;">';
|
192 |
+
tpl += gadwp_item_data.i18n[ 14 ];
|
193 |
+
tpl += ' <a href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_report&utm_medium=link&utm_content=back_report&utm_campaign=gadwp" rel="nofollow" style="text-decoration:none;font-size:1em;">GADWP</a> ';
|
194 |
+
tpl += '</div>';
|
195 |
+
tpl += '</div>',
|
196 |
+
|
197 |
+
jQuery( '#gadwp-window' + slug ).append( tpl );
|
198 |
+
|
199 |
+
template.addOptions( '#gadwp-sel-view' + slug, gadwp_item_data.viewList );
|
200 |
+
template.addOptions( '#gadwp-sel-period' + slug, gadwp_item_data.dateList );
|
201 |
+
template.addOptions( '#gadwp-sel-report' + slug, gadwp_item_data.reportList );
|
202 |
+
|
203 |
+
}
|
204 |
+
}
|
205 |
+
|
206 |
+
var reports = {
|
207 |
+
npcounter : 0,
|
208 |
+
prs : '',
|
209 |
+
trafficchannels : '',
|
210 |
+
trafficmediums : '',
|
211 |
+
traffictype : '',
|
212 |
+
trafficorganic : '',
|
213 |
+
socialnetworks : '',
|
214 |
+
locations : '',
|
215 |
+
mainchart : '',
|
216 |
+
bottomstats : '',
|
217 |
+
realtime : '',
|
218 |
+
realtime_running : null,
|
219 |
+
|
220 |
+
getTitle : function ( scope ) {
|
221 |
+
if ( scope == 'admin-item' ) {
|
222 |
+
return jQuery( '#gadwp' + slug ).attr( "title" );
|
223 |
+
} else {
|
224 |
+
return document.getElementsByTagName( "title" )[ 0 ].innerHTML;
|
225 |
+
}
|
226 |
+
},
|
227 |
+
|
228 |
+
alertMessage : function ( msg ) {
|
229 |
+
jQuery( "#gadwp-status" + slug ).css( {
|
230 |
+
"margin-top" : "3px",
|
231 |
+
"padding-left" : "5px",
|
232 |
+
"height" : "auto",
|
233 |
+
"color" : "#000",
|
234 |
+
"border-left" : "5px solid red"
|
235 |
+
} );
|
236 |
+
jQuery( "#gadwp-status" + slug ).html( msg );
|
237 |
+
},
|
238 |
+
|
239 |
+
drawprs : function ( gadwp_prs ) {
|
240 |
+
var chart_data= google.visualization.arrayToDataTable( gadwp_prs );
|
241 |
+
var options = {
|
242 |
+
page : 'enable',
|
243 |
+
pageSize : 10,
|
244 |
+
width : '100%',
|
245 |
+
allowHtml : true
|
246 |
+
};
|
247 |
+
var chart = new google.visualization.Table( document.getElementById( 'gadwp-prs' + slug ) );
|
248 |
+
|
249 |
+
chart.draw( chart_data, options );
|
250 |
+
},
|
251 |
+
|
252 |
+
drawtrafficchannels : function ( gadwp_trafficchannels ) {
|
253 |
+
var chart_data = google.visualization.arrayToDataTable( gadwp_trafficchannels );
|
254 |
+
var options = {
|
255 |
+
allowCollapse : true,
|
256 |
+
allowHtml : true,
|
257 |
+
height : '100%'
|
258 |
+
};
|
259 |
+
var chart = new google.visualization.OrgChart( document.getElementById( 'gadwp-trafficchannels' + slug ) );
|
260 |
+
|
261 |
+
chart.draw( chart_data, options );
|
262 |
+
},
|
263 |
+
|
264 |
+
drawtrafficmediums : function ( gadwp_trafficmediums ) {
|
265 |
+
var chart_data = google.visualization.arrayToDataTable( gadwp_trafficmediums );
|
266 |
+
var options = {
|
267 |
+
is3D : false,
|
268 |
+
tooltipText : 'percentage',
|
269 |
+
legend : 'none',
|
270 |
+
chartArea : {
|
271 |
+
width : '99%',
|
272 |
+
height : '80%'
|
273 |
+
},
|
274 |
+
title : gadwp_item_data.i18n[ 1 ],
|
275 |
+
colors : gadwp_item_data.colorVariations
|
276 |
+
};
|
277 |
+
var chart = new google.visualization.PieChart( document.getElementById( 'gadwp-trafficmediums' + slug ) );
|
278 |
+
|
279 |
+
chart.draw( chart_data, options );
|
280 |
+
},
|
281 |
+
|
282 |
+
drawtraffictype : function ( gadwp_traffictype ) {
|
283 |
+
var chart_data = google.visualization.arrayToDataTable( gadwp_traffictype );
|
284 |
+
var options = {
|
285 |
+
is3D : false,
|
286 |
+
tooltipText : 'percentage',
|
287 |
+
legend : 'none',
|
288 |
+
chartArea : {
|
289 |
+
width : '99%',
|
290 |
+
height : '80%'
|
291 |
+
},
|
292 |
+
title : gadwp_item_data.i18n[ 2 ],
|
293 |
+
colors : gadwp_item_data.colorVariations
|
294 |
+
};
|
295 |
+
var chart = new google.visualization.PieChart( document.getElementById( 'gadwp-traffictype' + slug ) );
|
296 |
+
|
297 |
+
chart.draw( chart_data, options );
|
298 |
+
},
|
299 |
+
|
300 |
+
drawsocialnetworks : function ( gadwp_socialnetworks ) {
|
301 |
+
var chart_data = google.visualization.arrayToDataTable( gadwp_socialnetworks );
|
302 |
+
var options = {
|
303 |
+
is3D : false,
|
304 |
+
tooltipText : 'percentage',
|
305 |
+
legend : 'none',
|
306 |
+
chartArea : {
|
307 |
+
width : '99%',
|
308 |
+
height : '80%'
|
309 |
+
},
|
310 |
+
title : gadwp_item_data.i18n[ 3 ],
|
311 |
+
colors : gadwp_item_data.colorVariations
|
312 |
+
};
|
313 |
+
var chart = new google.visualization.PieChart( document.getElementById( 'gadwp-socialnetworks' + slug ) );
|
314 |
+
|
315 |
+
chart.draw( chart_data, options );
|
316 |
+
},
|
317 |
+
|
318 |
+
drawtrafficorganic : function ( gadwp_trafficorganic ) {
|
319 |
+
var chart_data = google.visualization.arrayToDataTable( gadwp_trafficorganic );
|
320 |
+
var options = {
|
321 |
+
is3D : false,
|
322 |
+
tooltipText : 'percentage',
|
323 |
+
legend : 'none',
|
324 |
+
chartArea : {
|
325 |
+
width : '99%',
|
326 |
+
height : '80%'
|
327 |
+
},
|
328 |
+
title : gadwp_item_data.i18n[ 4 ],
|
329 |
+
colors : gadwp_item_data.colorVariations
|
330 |
+
};
|
331 |
+
var chart = new google.visualization.PieChart( document.getElementById( 'gadwp-trafficorganic' + slug ) );
|
332 |
+
|
333 |
+
chart.draw( chart_data, options );
|
334 |
+
},
|
335 |
+
|
336 |
+
drawlocations : function ( gadwp_locations ) {
|
337 |
+
var chart_data = google.visualization.arrayToDataTable( gadwp_locations );
|
338 |
+
var options = {
|
339 |
+
page : 'enable',
|
340 |
+
pageSize : 10,
|
341 |
+
width : '100%'
|
342 |
+
};
|
343 |
+
var chart = new google.visualization.Table( document.getElementById( 'gadwp-locations' + slug ) );
|
344 |
+
|
345 |
+
chart.draw( chart_data, options );
|
346 |
+
},
|
347 |
+
|
348 |
+
drawmaplocations : function ( gadwp_locations ) {
|
349 |
+
var chart_data = google.visualization.arrayToDataTable( gadwp_locations );
|
350 |
+
var options = {
|
351 |
+
chartArea : {
|
352 |
+
width : '99%',
|
353 |
+
height : '90%'
|
354 |
+
},
|
355 |
+
colors : [ gadwp_item_data.colorVariations[ 5 ], gadwp_item_data.colorVariations[ 4 ] ]
|
356 |
+
}
|
357 |
+
if ( gadwp_item_data.region ) {
|
358 |
+
options.region = gadwp_item_data.region;
|
359 |
+
options.displayMode = 'markers';
|
360 |
+
options.datalessRegionColor = 'EFEFEF';
|
361 |
+
}
|
362 |
+
var chart = new google.visualization.GeoChart( document.getElementById( 'gadwp-map' + slug ) );
|
363 |
+
|
364 |
+
chart.draw( chart_data, options );
|
365 |
+
},
|
366 |
+
|
367 |
+
drawmainchart : function ( gadwp_mainchart, format ) {
|
368 |
+
var chart_data = google.visualization.arrayToDataTable( gadwp_mainchart );
|
369 |
+
var formatter;
|
370 |
+
|
371 |
+
if ( format ) {
|
372 |
+
formatter = new google.visualization.NumberFormat( {
|
373 |
+
suffix : '%',
|
374 |
+
fractionDigits : 2
|
375 |
+
} );
|
376 |
+
|
377 |
+
formatter.format( chart_data, 1 );
|
378 |
+
}
|
379 |
+
|
380 |
+
var options = {
|
381 |
+
legend : {
|
382 |
+
position : 'none'
|
383 |
+
},
|
384 |
+
pointSize : 3,
|
385 |
+
colors : [ gadwp_item_data.colorVariations[ 0 ], gadwp_item_data.colorVariations[ 4 ] ],
|
386 |
+
chartArea : {
|
387 |
+
width : '99%',
|
388 |
+
height : '90%'
|
389 |
+
},
|
390 |
+
vAxis : {
|
391 |
+
textPosition : "in",
|
392 |
+
minValue : 0
|
393 |
+
},
|
394 |
+
hAxis : {
|
395 |
+
textPosition : 'none'
|
396 |
+
}
|
397 |
+
};
|
398 |
+
var chart = new google.visualization.AreaChart( document.getElementById( 'gadwp-mainchart' + slug ) );
|
399 |
+
|
400 |
+
chart.draw( chart_data, options );
|
401 |
+
},
|
402 |
+
|
403 |
+
drawbottomstats : function ( gadwp_bottomstats ) {
|
404 |
+
jQuery( "#gdsessions" + slug ).text( gadwp_bottomstats[ 0 ] );
|
405 |
+
jQuery( "#gdusers" + slug ).text( gadwp_bottomstats[ 1 ] );
|
406 |
+
jQuery( "#gdpageviews" + slug ).text( gadwp_bottomstats[ 2 ] );
|
407 |
+
jQuery( "#gdbouncerate" + slug ).text( gadwp_bottomstats[ 3 ] + "%" );
|
408 |
+
jQuery( "#gdorganicsearch" + slug ).text( gadwp_bottomstats[ 4 ] );
|
409 |
+
jQuery( "#gdpagespervisit" + slug ).text( gadwp_bottomstats[ 5 ] );
|
410 |
+
},
|
411 |
+
|
412 |
+
rt_onlyUniqueValues : function ( value, index, self ) {
|
413 |
+
return self.indexOf( value ) === index;
|
414 |
+
},
|
415 |
+
|
416 |
+
rt_countsessions : function ( gadwp_realtime, searchvalue ) {
|
417 |
+
var count = 0;
|
418 |
+
var i = 0;
|
419 |
+
|
420 |
+
for ( i = 0; i < gadwp_realtime[ "rows" ].length; i = i + 1 ) {
|
421 |
+
if ( jQuery.inArray( searchvalue, gadwp_realtime[ "rows" ][ i ] ) > -1 ) {
|
422 |
+
count += parseInt( gadwp_realtime[ "rows" ][ i ][ 6 ] );
|
423 |
+
}
|
424 |
+
}
|
425 |
+
return count;
|
426 |
+
},
|
427 |
+
|
428 |
+
rt_generatetooltip : function ( gadwp_realtime ) {
|
429 |
+
var count = 0;
|
430 |
+
var table = "";
|
431 |
+
var i = 0;
|
432 |
+
|
433 |
+
for ( i = 0; i < gadwp_realtime.length; i = i + 1 ) {
|
434 |
+
count += parseInt( gadwp_realtime[ i ].count );
|
435 |
+
table += "<tr><td class='gadwp-pgdetailsl'>" + gadwp_realtime[ i ].value + "</td><td class='gadwp-pgdetailsr'>" + gadwp_realtime[ i ].count + "</td></tr>";
|
436 |
+
}
|
437 |
+
;
|
438 |
+
if ( count ) {
|
439 |
+
return ( "<table>" + table + "</table>" );
|
440 |
+
} else {
|
441 |
+
return ( "" );
|
442 |
+
}
|
443 |
+
},
|
444 |
+
|
445 |
+
rt_pagedetails : function ( gadwp_realtime, searchvalue ) {
|
446 |
+
var sant;
|
447 |
+
var i = 0;
|
448 |
+
var j = 0;
|
449 |
+
var sum = 0;
|
450 |
+
var newsum = 0;
|
451 |
+
var newgadwp_realtime = [];
|
452 |
+
var countrfr = 0;
|
453 |
+
var countkwd = 0;
|
454 |
+
var countdrt = 0;
|
455 |
+
var countscl = 0;
|
456 |
+
var countcpg = 0;
|
457 |
+
var tablerfr = "";
|
458 |
+
var tablekwd = "";
|
459 |
+
var tablescl = "";
|
460 |
+
var tablecpg = "";
|
461 |
+
var tabledrt = "";
|
462 |
+
var pagetitle;
|
463 |
+
var pgstatstable;
|
464 |
+
|
465 |
+
for ( i = 0; i < gadwp_realtime[ "rows" ].length; i = i + 1 ) {
|
466 |
+
sant = 1;
|
467 |
+
for ( j = 0; j < newgadwp_realtime.length; j = j + 1 ) {
|
468 |
+
jQuery.each(gadwp_realtime[ "rows" ][ i ],function(){sum+=parseFloat(this) || 0; });
|
469 |
+
jQuery.each(newgadwp_realtime[ j ],function(){newsum+=parseFloat(this) || 0; });
|
470 |
+
if ( sum == newsum ) {
|
471 |
+
newgadwp_realtime[ j ][ 6 ] = parseInt( newgadwp_realtime[ j ][ 6 ] ) + parseInt( gadwp_realtime[ "rows" ][ i ][ 6 ] );
|
472 |
+
sant = 0;
|
473 |
+
}
|
474 |
+
}
|
475 |
+
if ( sant ) {
|
476 |
+
newgadwp_realtime.push( gadwp_realtime[ "rows" ][ i ].slice() );
|
477 |
+
}
|
478 |
+
}
|
479 |
+
|
480 |
+
for ( i = 0; i < newgadwp_realtime.length; i = i + 1 ) {
|
481 |
+
if ( newgadwp_realtime[ i ][ 0 ] == searchvalue ) {
|
482 |
+
pagetitle = newgadwp_realtime[ i ][ 5 ];
|
483 |
+
|
484 |
+
switch ( newgadwp_realtime[ i ][ 3 ] ) {
|
485 |
+
|
486 |
+
case "REFERRAL":
|
487 |
+
countrfr += parseInt( newgadwp_realtime[ i ][ 6 ] );
|
488 |
+
tablerfr += "<tr><td class='gadwp-pgdetailsl'>" + newgadwp_realtime[ i ][ 1 ] + "</td><td class='gadwp-pgdetailsr'>" + newgadwp_realtime[ i ][ 6 ] + "</td></tr>";
|
489 |
+
break;
|
490 |
+
case "ORGANIC":
|
491 |
+
countkwd += parseInt( newgadwp_realtime[ i ][ 6 ] );
|
492 |
+
tablekwd += "<tr><td class='gadwp-pgdetailsl'>" + newgadwp_realtime[ i ][ 2 ] + "</td><td class='gadwp-pgdetailsr'>" + newgadwp_realtime[ i ][ 6 ] + "</td></tr>";
|
493 |
+
break;
|
494 |
+
case "SOCIAL":
|
495 |
+
countscl += parseInt( newgadwp_realtime[ i ][ 6 ] );
|
496 |
+
tablescl += "<tr><td class='gadwp-pgdetailsl'>" + newgadwp_realtime[ i ][ 1 ] + "</td><td class='gadwp-pgdetailsr'>" + newgadwp_realtime[ i ][ 6 ] + "</td></tr>";
|
497 |
+
break;
|
498 |
+
case "CUSTOM":
|
499 |
+
countcpg += parseInt( newgadwp_realtime[ i ][ 6 ] );
|
500 |
+
tablecpg += "<tr><td class='gadwp-pgdetailsl'>" + newgadwp_realtime[ i ][ 1 ] + "</td><td class='gadwp-pgdetailsr'>" + newgadwp_realtime[ i ][ 6 ] + "</td></tr>";
|
501 |
+
break;
|
502 |
+
case "DIRECT":
|
503 |
+
countdrt += parseInt( newgadwp_realtime[ i ][ 6 ] );
|
504 |
+
break;
|
505 |
+
}
|
506 |
+
}
|
507 |
+
}
|
508 |
+
|
509 |
+
if ( countrfr ) {
|
510 |
+
tablerfr = "<table><tr><td>" + gadwp_item_data.i18n_realtime[ 0 ] + "(" + countrfr + ")</td></tr>" + tablerfr + "</table><br />";
|
511 |
+
}
|
512 |
+
if ( countkwd ) {
|
513 |
+
tablekwd = "<table><tr><td>" + gadwp_item_data.i18n_realtime[ 1 ] + "(" + countkwd + ")</td></tr>" + tablekwd + "</table><br />";
|
514 |
+
}
|
515 |
+
if ( countscl ) {
|
516 |
+
tablescl = "<table><tr><td>" + gadwp_item_data.i18n_realtime[ 2 ] + "(" + countscl + ")</td></tr>" + tablescl + "</table><br />";
|
517 |
+
}
|
518 |
+
if ( countcpg ) {
|
519 |
+
tablecpg = "<table><tr><td>" + gadwp_item_data.i18n_realtime[ 3 ] + "(" + countcpg + ")</td></tr>" + tablecpg + "</table><br />";
|
520 |
+
}
|
521 |
+
if ( countdrt ) {
|
522 |
+
tabledrt = "<table><tr><td>" + gadwp_item_data.i18n_realtime[ 4 ] + "(" + countdrt + ")</td></tr></table><br />";
|
523 |
+
}
|
524 |
+
return ( "<p><center><strong>" + pagetitle + "</strong></center></p>" + tablerfr + tablekwd + tablescl + tablecpg + tabledrt );
|
525 |
+
},
|
526 |
+
|
527 |
+
rt_refresh : function ( focusFlag ) {
|
528 |
+
if ( focusFlag ) {
|
529 |
+
post_data.from = false;
|
530 |
+
post_data.to = false;
|
531 |
+
post_data.query = 'realtime';
|
532 |
+
jQuery.post( gadwp_item_data.ajaxurl, post_data, function ( response ) {
|
533 |
+
if ( jQuery.isArray( response ) ) {
|
534 |
+
jQuery( '#gadwp-reports' + slug ).show();
|
535 |
+
reports.realtime = response[ 0 ];
|
536 |
+
reports.drawrealtime( reports.realtime );
|
537 |
+
} else {
|
538 |
+
reports.throwDebug( response );
|
539 |
+
}
|
540 |
+
|
541 |
+
NProgress.done();
|
542 |
+
|
543 |
+
} );
|
544 |
+
|
545 |
+
}
|
546 |
+
},
|
547 |
+
|
548 |
+
|
549 |
+
drawrealtime : function ( gadwp_realtime ) {
|
550 |
+
var i = 0;
|
551 |
+
var pagepath = [];
|
552 |
+
var referrals = [];
|
553 |
+
var keywords = [];
|
554 |
+
var social = [];
|
555 |
+
var visittype = [];
|
556 |
+
var custom = [];
|
557 |
+
var upagepathstats = [];
|
558 |
+
var upagepath;
|
559 |
+
var pgstatstable = "";
|
560 |
+
var ureferralsstats = [];
|
561 |
+
var ureferrals;
|
562 |
+
var ukeywordsstats = [];
|
563 |
+
var ukeywords;
|
564 |
+
var usocialstats = [];
|
565 |
+
var usocial;
|
566 |
+
var ucustomstats = [];
|
567 |
+
var ucustom;
|
568 |
+
var uvisittype = [ "REFERRAL", "ORGANIC", "SOCIAL", "CUSTOM" ];
|
569 |
+
var uvisitortype = [ "DIRECT", "NEW" ];
|
570 |
+
|
571 |
+
jQuery( function () {
|
572 |
+
jQuery( '#gadwp-widget *' ).tooltip( {
|
573 |
+
tooltipClass : "gadwp"
|
574 |
+
} );
|
575 |
+
} );
|
576 |
+
|
577 |
+
|
578 |
+
gadwp_realtime = gadwp_realtime[ 0 ];
|
579 |
+
|
580 |
+
if ( jQuery.isNumeric( gadwp_realtime ) || typeof gadwp_realtime === "undefined" ) {
|
581 |
+
gadwp_realtime = [];
|
582 |
+
gadwp_realtime[ "totalsForAllResults" ] = []
|
583 |
+
gadwp_realtime[ "totalsForAllResults" ][ "rt:activeUsers" ] = "0";
|
584 |
+
gadwp_realtime[ "rows" ] = [];
|
585 |
+
}
|
586 |
+
|
587 |
+
if ( gadwp_realtime[ "totalsForAllResults" ][ "rt:activeUsers" ] !== document.getElementById( "gadwp-online" ).innerHTML ) {
|
588 |
+
jQuery( "#gadwp-online" ).fadeOut( "slow" );
|
589 |
+
jQuery( "#gadwp-online" ).fadeOut( 500 );
|
590 |
+
jQuery( "#gadwp-online" ).fadeOut( "slow", function () {
|
591 |
+
if ( ( parseInt( gadwp_realtime[ "totalsForAllResults" ][ "rt:activeUsers" ] ) ) < ( parseInt( document.getElementById( "gadwp-online" ).innerHTML ) ) ) {
|
592 |
+
jQuery( "#gadwp-online" ).css( {
|
593 |
+
'background-color' : '#FFE8E8'
|
594 |
+
} );
|
595 |
+
} else {
|
596 |
+
jQuery( "#gadwp-online" ).css( {
|
597 |
+
'background-color' : '#E0FFEC'
|
598 |
+
} );
|
599 |
+
}
|
600 |
+
document.getElementById( "gadwp-online" ).innerHTML = gadwp_realtime[ "totalsForAllResults" ][ "rt:activeUsers" ];
|
601 |
+
} );
|
602 |
+
jQuery( "#gadwp-online" ).fadeIn( "slow" );
|
603 |
+
jQuery( "#gadwp-online" ).fadeIn( 500 );
|
604 |
+
jQuery( "#gadwp-online" ).fadeIn( "slow", function () {
|
605 |
+
jQuery( "#gadwp-online" ).css( {
|
606 |
+
'background-color' : '#FFFFFF'
|
607 |
+
} );
|
608 |
+
} );
|
609 |
+
}
|
610 |
+
|
611 |
+
if ( gadwp_realtime[ "totalsForAllResults" ][ "rt:activeUsers" ] == 0 ) {
|
612 |
+
gadwp_realtime[ "rows" ] = [];
|
613 |
+
}
|
614 |
+
|
615 |
+
for ( i = 0; i < gadwp_realtime[ "rows" ].length; i = i + 1 ) {
|
616 |
+
pagepath.push( gadwp_realtime[ "rows" ][ i ][ 0 ] );
|
617 |
+
if ( gadwp_realtime[ "rows" ][ i ][ 3 ] == "REFERRAL" ) {
|
618 |
+
referrals.push( gadwp_realtime[ "rows" ][ i ][ 1 ] );
|
619 |
+
}
|
620 |
+
if ( gadwp_realtime[ "rows" ][ i ][ 3 ] == "ORGANIC" ) {
|
621 |
+
keywords.push( gadwp_realtime[ "rows" ][ i ][ 2 ] );
|
622 |
+
}
|
623 |
+
if ( gadwp_realtime[ "rows" ][ i ][ 3 ] == "SOCIAL" ) {
|
624 |
+
social.push( gadwp_realtime[ "rows" ][ i ][ 1 ] );
|
625 |
+
}
|
626 |
+
if ( gadwp_realtime[ "rows" ][ i ][ 3 ] == "CUSTOM" ) {
|
627 |
+
custom.push( gadwp_realtime[ "rows" ][ i ][ 1 ] );
|
628 |
+
}
|
629 |
+
visittype.push( gadwp_realtime[ "rows" ][ i ][ 3 ] );
|
630 |
+
}
|
631 |
+
|
632 |
+
upagepath = pagepath.filter( reports.rt_onlyUniqueValues );
|
633 |
+
for ( i = 0; i < upagepath.length; i = i + 1 ) {
|
634 |
+
upagepathstats[ i ] = {
|
635 |
+
"pagepath" : upagepath[ i ],
|
636 |
+
"count" : reports.rt_countsessions( gadwp_realtime, upagepath[ i ] )
|
637 |
+
}
|
638 |
+
}
|
639 |
+
upagepathstats.sort( function ( a, b ) {
|
640 |
+
return b.count - a.count
|
641 |
+
} );
|
642 |
+
|
643 |
+
pgstatstable = "";
|
644 |
+
for ( i = 0; i < upagepathstats.length; i = i + 1 ) {
|
645 |
+
if ( i < gadwp_item_data.realtime_maxpages ) {
|
646 |
+
pgstatstable += '<div class="gadwp-pline"><div class="gadwp-pleft"><a href="#" data-gadwp="' + reports.rt_pagedetails( gadwp_realtime, upagepathstats[ i ].pagepath ) + '">' + upagepathstats[ i ].pagepath.substring( 0, 70 ) + '</a></div><div class="gadwp-pright">' + upagepathstats[ i ].count + '</div></div>';
|
647 |
+
}
|
648 |
+
}
|
649 |
+
document.getElementById( "gadwp-pages" ).innerHTML = '<br /><div class="gadwp-pg">' + pgstatstable + '</div>';
|
650 |
+
|
651 |
+
ureferrals = referrals.filter( reports.rt_onlyUniqueValues );
|
652 |
+
for ( i = 0; i < ureferrals.length; i = i + 1 ) {
|
653 |
+
ureferralsstats[ i ] = {
|
654 |
+
"value" : ureferrals[ i ],
|
655 |
+
"count" : reports.rt_countsessions( gadwp_realtime, ureferrals[ i ] )
|
656 |
+
};
|
657 |
+
}
|
658 |
+
ureferralsstats.sort( function ( a, b ) {
|
659 |
+
return b.count - a.count
|
660 |
+
} );
|
661 |
+
|
662 |
+
ukeywords = keywords.filter( reports.rt_onlyUniqueValues );
|
663 |
+
for ( i = 0; i < ukeywords.length; i = i + 1 ) {
|
664 |
+
ukeywordsstats[ i ] = {
|
665 |
+
"value" : ukeywords[ i ],
|
666 |
+
"count" : reports.rt_countsessions( gadwp_realtime, ukeywords[ i ] )
|
667 |
+
};
|
668 |
+
}
|
669 |
+
ukeywordsstats.sort( function ( a, b ) {
|
670 |
+
return b.count - a.count
|
671 |
+
} );
|
672 |
+
|
673 |
+
usocial = social.filter( reports.rt_onlyUniqueValues );
|
674 |
+
for ( i = 0; i < usocial.length; i = i + 1 ) {
|
675 |
+
usocialstats[ i ] = {
|
676 |
+
"value" : usocial[ i ],
|
677 |
+
"count" : reports.rt_countsessions( gadwp_realtime, usocial[ i ] )
|
678 |
+
};
|
679 |
+
}
|
680 |
+
usocialstats.sort( function ( a, b ) {
|
681 |
+
return b.count - a.count
|
682 |
+
} );
|
683 |
+
|
684 |
+
ucustom = custom.filter( reports.rt_onlyUniqueValues );
|
685 |
+
for ( i = 0; i < ucustom.length; i = i + 1 ) {
|
686 |
+
ucustomstats[ i ] = {
|
687 |
+
"value" : ucustom[ i ],
|
688 |
+
"count" : reports.rt_countsessions( gadwp_realtime, ucustom[ i ] )
|
689 |
+
};
|
690 |
+
}
|
691 |
+
ucustomstats.sort( function ( a, b ) {
|
692 |
+
return b.count - a.count
|
693 |
+
} );
|
694 |
+
|
695 |
+
document.getElementById( "gadwp-tdo-right" ).innerHTML = '<div class="gadwp-bigtext"><a href="#" data-gadwp="' + reports.rt_generatetooltip( ureferralsstats ) + '"><div class="gadwp-bleft">' + gadwp_item_data.i18n_realtime[ 0 ] + '</a></div><div class="gadwp-bright">' + reports.rt_countsessions( gadwp_realtime, uvisittype[ 0 ] ) + '</div></div>';
|
696 |
+
document.getElementById( "gadwp-tdo-right" ).innerHTML += '<div class="gadwp-bigtext"><a href="#" data-gadwp="' + reports.rt_generatetooltip( ukeywordsstats ) + '"><div class="gadwp-bleft">' + gadwp_item_data.i18n_realtime[ 1 ] + '</a></div><div class="gadwp-bright">' + reports.rt_countsessions( gadwp_realtime, uvisittype[ 1 ] ) + '</div></div>';
|
697 |
+
document.getElementById( "gadwp-tdo-right" ).innerHTML += '<div class="gadwp-bigtext"><a href="#" data-gadwp="' + reports.rt_generatetooltip( usocialstats ) + '"><div class="gadwp-bleft">' + gadwp_item_data.i18n_realtime[ 2 ] + '</a></div><div class="gadwp-bright">' + reports.rt_countsessions( gadwp_realtime, uvisittype[ 2 ] ) + '</div></div>';
|
698 |
+
document.getElementById( "gadwp-tdo-right" ).innerHTML += '<div class="gadwp-bigtext"><a href="#" data-gadwp="' + reports.rt_generatetooltip( ucustomstats ) + '"><div class="gadwp-bleft">' + gadwp_item_data.i18n_realtime[ 3 ] + '</a></div><div class="gadwp-bright">' + reports.rt_countsessions( gadwp_realtime, uvisittype[ 3 ] ) + '</div></div>';
|
699 |
+
|
700 |
+
document.getElementById( "gadwp-tdo-right" ).innerHTML += '<div class="gadwp-bigtext"><div class="gadwp-bleft">' + gadwp_item_data.i18n_realtime[ 4 ] + '</div><div class="gadwp-bright">' + reports.rt_countsessions( gadwp_realtime, uvisitortype[ 0 ] ) + '</div></div>';
|
701 |
+
document.getElementById( "gadwp-tdo-right" ).innerHTML += '<div class="gadwp-bigtext"><div class="gadwp-bleft">' + gadwp_item_data.i18n_realtime[ 5 ] + '</div><div class="gadwp-bright">' + reports.rt_countsessions( gadwp_realtime, uvisitortype[ 1 ] ) + '</div></div>';
|
702 |
+
},
|
703 |
+
|
704 |
+
throwDebug : function ( response ) {
|
705 |
+
jQuery( "#gadwp-status" + slug ).css( {
|
706 |
+
"margin-top" : "3px",
|
707 |
+
"padding-left" : "5px",
|
708 |
+
"height" : "auto",
|
709 |
+
"color" : "#000",
|
710 |
+
"border-left" : "5px solid red"
|
711 |
+
} );
|
712 |
+
if ( response == '-24' ) {
|
713 |
+
jQuery( "#gadwp-status" + slug ).html( gadwp_item_data.i18n[ 15 ] );
|
714 |
+
} else {
|
715 |
+
jQuery( "#gadwp-status" + slug ).html( gadwp_item_data.i18n[ 11 ] );
|
716 |
+
console.log( "\n********************* GADWP Log ********************* \n\n" + response );
|
717 |
+
}
|
718 |
+
},
|
719 |
+
|
720 |
+
throwError : function ( target, response, p ) {
|
721 |
+
jQuery( target ).css( {
|
722 |
+
"background-color" : "#F7F7F7",
|
723 |
+
"height" : "auto",
|
724 |
+
"padding-top" : p,
|
725 |
+
"padding-bottom" : p,
|
726 |
+
"color" : "#000",
|
727 |
+
"text-align" : "center"
|
728 |
+
} );
|
729 |
+
if ( response == -21 ) {
|
730 |
+
jQuery( target ).html( gadwp_item_data.i18n[ 12 ] + ' (' + response + ')' );
|
731 |
+
} else {
|
732 |
+
jQuery( target ).html( gadwp_item_data.i18n[ 13 ] + ' (' + response + ')' );
|
733 |
+
}
|
734 |
+
},
|
735 |
+
|
736 |
+
render : function ( view, period, query ) {
|
737 |
+
var projectId;
|
738 |
+
var from;
|
739 |
+
var to;
|
740 |
+
var tpl;
|
741 |
+
var focusFlag;
|
742 |
+
|
743 |
+
if ( period == 'realtime' ) {
|
744 |
+
jQuery( '#gadwp-sel-report' + slug ).hide();
|
745 |
+
} else {
|
746 |
+
jQuery( '#gadwp-sel-report' + slug ).show();
|
747 |
+
clearInterval( reports.realtime_running );
|
748 |
+
}
|
749 |
+
|
750 |
+
jQuery( '#gadwp-status' + slug ).html( '' );
|
751 |
+
switch ( period ) {
|
752 |
+
case 'today':
|
753 |
+
from = 'today';
|
754 |
+
to = 'today';
|
755 |
+
break;
|
756 |
+
case 'yesterday':
|
757 |
+
from = 'yesterday';
|
758 |
+
to = 'yesterday';
|
759 |
+
break;
|
760 |
+
case '7daysAgo':
|
761 |
+
from = '7daysAgo';
|
762 |
+
to = 'yesterday';
|
763 |
+
break;
|
764 |
+
case '14daysAgo':
|
765 |
+
from = '14daysAgo';
|
766 |
+
to = 'yesterday';
|
767 |
+
break;
|
768 |
+
case '90daysAgo':
|
769 |
+
from = '90daysAgo';
|
770 |
+
to = 'yesterday';
|
771 |
+
break;
|
772 |
+
case '365daysAgo':
|
773 |
+
from = '365daysAgo';
|
774 |
+
to = 'yesterday';
|
775 |
+
break;
|
776 |
+
case '1095daysAgo':
|
777 |
+
from = '1095daysAgo';
|
778 |
+
to = 'yesterday';
|
779 |
+
break;
|
780 |
+
default:
|
781 |
+
from = '30daysAgo';
|
782 |
+
to = 'yesterday';
|
783 |
+
break;
|
784 |
+
}
|
785 |
+
|
786 |
+
tools.set_cookie( 'default_metric', query );
|
787 |
+
tools.set_cookie( 'default_dimension', period );
|
788 |
+
|
789 |
+
if ( typeof view !== 'undefined') {
|
790 |
+
tools.set_cookie( 'default_view', view );
|
791 |
+
projectId = view;
|
792 |
+
} else {
|
793 |
+
projectId = false;
|
794 |
+
}
|
795 |
+
|
796 |
+
if ( gadwp_item_data.scope == 'admin-item' ) {
|
797 |
+
post_data = {
|
798 |
+
action : 'gadwp_backend_item_reports',
|
799 |
+
gadwp_security_backend_item_reports : gadwp_item_data.security,
|
800 |
+
from : from,
|
801 |
+
to : to,
|
802 |
+
filter : item_id
|
803 |
+
}
|
804 |
+
} else if ( gadwp_item_data.scope == 'front-item' ) {
|
805 |
+
post_data = {
|
806 |
+
action : 'gadwp_frontend_item_reports',
|
807 |
+
gadwp_security_frontend_item_reports : gadwp_item_data.security,
|
808 |
+
from : from,
|
809 |
+
to : to,
|
810 |
+
filter : gadwp_item_data.filter
|
811 |
+
}
|
812 |
+
} else {
|
813 |
+
post_data = {
|
814 |
+
action : 'gadwp_backend_item_reports',
|
815 |
+
gadwp_security_backend_item_reports : gadwp_item_data.security,
|
816 |
+
projectId : projectId,
|
817 |
+
from : from,
|
818 |
+
to : to
|
819 |
+
}
|
820 |
+
}
|
821 |
+
if ( period == 'realtime' ) {
|
822 |
+
focusFlag = 1;
|
823 |
+
|
824 |
+
jQuery( document ).ready( function () {
|
825 |
+
jQuery( window ).bind( "focus", function ( event ) {
|
826 |
+
focusFlag = 1;
|
827 |
+
} ).bind( "blur", function ( event ) {
|
828 |
+
focusFlag = 0;
|
829 |
+
} );
|
830 |
+
} );
|
831 |
+
|
832 |
+
tpl = '<div id="gadwp-realtime' + slug + '">';
|
833 |
+
tpl += '<div class="gadwp-rt-box">';
|
834 |
+
tpl += '<div class="gadwp-tdo-left">';
|
835 |
+
tpl += '<div class="gadwp-online" id="gadwp-online">0</div>';
|
836 |
+
tpl += '</div>';
|
837 |
+
tpl += '<div class="gadwp-tdo-right" id="gadwp-tdo-right">';
|
838 |
+
tpl += '<div class="gadwp-bigtext">';
|
839 |
+
tpl += '<div class="gadwp-bleft">' + gadwp_item_data.i18n_realtime[ 0 ] + '</div>';
|
840 |
+
tpl += '<div class="gadwp-bright">0</div>';
|
841 |
+
tpl += '</div>';
|
842 |
+
tpl += '<div class="gadwp-bigtext">';
|
843 |
+
tpl += '<div class="gadwp-bleft">' + gadwp_item_data.i18n_realtime[ 1 ] + '</div>';
|
844 |
+
tpl += '<div class="gadwp-bright">0</div>';
|
845 |
+
tpl += '</div>';
|
846 |
+
tpl += '<div class="gadwp-bigtext">';
|
847 |
+
tpl += '<div class="gadwp-bleft">' + gadwp_item_data.i18n_realtime[ 2 ] + '</div>';
|
848 |
+
tpl += '<div class="gadwp-bright">0</div>';
|
849 |
+
tpl += '</div>';
|
850 |
+
tpl += '<div class="gadwp-bigtext">';
|
851 |
+
tpl += '<div class="gadwp-bleft">' + gadwp_item_data.i18n_realtime[ 3 ] + '</div>';
|
852 |
+
tpl += '<div class="gadwp-bright">0</div>';
|
853 |
+
tpl += '</div>';
|
854 |
+
tpl += '<div class="gadwp-bigtext">';
|
855 |
+
tpl += '<div class="gadwp-bleft">' + gadwp_item_data.i18n_realtime[ 4 ] + '</div>';
|
856 |
+
tpl += '<div class="gadwp-bright">0</div>';
|
857 |
+
tpl += '</div>';
|
858 |
+
tpl += '<div class="gadwp-bigtext">';
|
859 |
+
tpl += '<div class="gadwp-bleft">' + gadwp_item_data.i18n_realtime[ 5 ] + '</div>';
|
860 |
+
tpl += '<div class="gadwp-bright">0</div>';
|
861 |
+
tpl += '</div>';
|
862 |
+
tpl += '</div>';
|
863 |
+
tpl += '</div>';
|
864 |
+
tpl += '<div>';
|
865 |
+
tpl += '<div id="gadwp-pages" class="gadwp-pages"> </div>';
|
866 |
+
tpl += '</div>';
|
867 |
+
tpl += '</div>';
|
868 |
+
|
869 |
+
jQuery( '#gadwp-reports' + slug ).html( tpl );
|
870 |
+
|
871 |
+
reports.rt_refresh( focusFlag );
|
872 |
+
|
873 |
+
reports.realtime_running = setInterval( reports.rt_refresh.bind( focusFlag ), 6000 );
|
874 |
+
|
875 |
+
} else {
|
876 |
+
if ( jQuery.inArray( query, [ 'referrers', 'contentpages', 'searches' ] ) > -1 ) {
|
877 |
+
|
878 |
+
tpl = '<div id="gadwp-trafficchannels' + slug + '"></div>';
|
879 |
+
tpl += '<div id="gadwp-prs' + slug + '"></div>';
|
880 |
+
|
881 |
+
jQuery( '#gadwp-reports' + slug ).html( tpl );
|
882 |
+
jQuery( '#gadwp-reports' + slug ).hide();
|
883 |
+
|
884 |
+
post_data.query = 'trafficchannels,' + query;
|
885 |
+
|
886 |
+
jQuery.post( gadwp_item_data.ajaxurl, post_data, function ( response ) {
|
887 |
+
if ( jQuery.isArray( response ) ) {
|
888 |
+
if ( !jQuery.isNumeric( response[ 0 ] ) ) {
|
889 |
+
if ( jQuery.isArray( response[ 0 ] ) ) {
|
890 |
+
jQuery( '#gadwp-reports' + slug ).show();
|
891 |
+
reports.trafficchannels = response[ 0 ];
|
892 |
+
google.setOnLoadCallback( reports.drawtrafficchannels( reports.trafficchannels ) );
|
893 |
+
} else {
|
894 |
+
reports.throwDebug( response[ 0 ] );
|
895 |
+
}
|
896 |
+
} else {
|
897 |
+
jQuery( '#gadwp-reports' + slug ).show();
|
898 |
+
reports.throwError( '#gadwp-trafficchannels' + slug, response[ 0 ], "125px" );
|
899 |
+
}
|
900 |
+
|
901 |
+
if ( !jQuery.isNumeric( response[ 1 ] ) ) {
|
902 |
+
if ( jQuery.isArray( response[ 1 ] ) ) {
|
903 |
+
reports.prs = response[ 1 ];
|
904 |
+
google.setOnLoadCallback( reports.drawprs( reports.prs ) );
|
905 |
+
} else {
|
906 |
+
reports.throwDebug( response[ 1 ] );
|
907 |
+
}
|
908 |
+
} else {
|
909 |
+
reports.throwError( '#gadwp-prs' + slug, response[ 1 ], "125px" );
|
910 |
+
}
|
911 |
+
} else {
|
912 |
+
reports.throwDebug( response );
|
913 |
+
}
|
914 |
+
NProgress.done();
|
915 |
+
} );
|
916 |
+
|
917 |
+
} else if ( query == 'trafficdetails' ) {
|
918 |
+
|
919 |
+
tpl = '<div id="gadwp-trafficchannels' + slug + '"></div>';
|
920 |
+
tpl += '<div class="gadwp-floatwraper">';
|
921 |
+
tpl += '<div id="gadwp-trafficmediums' + slug + '"></div>';
|
922 |
+
tpl += '<div id="gadwp-traffictype' + slug + '"></div>';
|
923 |
+
tpl += '</div>';
|
924 |
+
tpl += '<div class="gadwp-floatwraper">';
|
925 |
+
tpl += '<div id="gadwp-trafficorganic' + slug + '"></div>';
|
926 |
+
tpl += '<div id="gadwp-socialnetworks' + slug + '"></div>';
|
927 |
+
tpl += '</div>';
|
928 |
+
|
929 |
+
jQuery( '#gadwp-reports' + slug ).html( tpl );
|
930 |
+
jQuery( '#gadwp-reports' + slug ).hide();
|
931 |
+
|
932 |
+
post_data.query = 'trafficchannels,medium,visitorType,source,socialNetwork';
|
933 |
+
|
934 |
+
jQuery.post( gadwp_item_data.ajaxurl, post_data, function ( response ) {
|
935 |
+
if ( jQuery.isArray( response ) ) {
|
936 |
+
if ( !jQuery.isNumeric( response[ 0 ] ) ) {
|
937 |
+
if ( jQuery.isArray( response[ 0 ] ) ) {
|
938 |
+
jQuery( '#gadwp-reports' + slug ).show();
|
939 |
+
reports.trafficchannels = response[ 0 ];
|
940 |
+
google.setOnLoadCallback( reports.drawtrafficchannels( reports.trafficchannels ) );
|
941 |
+
} else {
|
942 |
+
reports.throwDebug( response[ 0 ] );
|
943 |
+
}
|
944 |
+
} else {
|
945 |
+
jQuery( '#gadwp-reports' + slug ).show();
|
946 |
+
reports.throwError( '#gadwp-trafficchannels' + slug, response[ 0 ], "125px" );
|
947 |
+
}
|
948 |
+
|
949 |
+
if ( !jQuery.isNumeric( response[ 1 ] ) ) {
|
950 |
+
if ( jQuery.isArray( response[ 1 ] ) ) {
|
951 |
+
jQuery( '#gadwp-reports' + slug ).show();
|
952 |
+
reports.trafficmediums = response[ 1 ];
|
953 |
+
google.setOnLoadCallback( reports.drawtrafficmediums( reports.trafficmediums ) );
|
954 |
+
} else {
|
955 |
+
reports.throwDebug( response[ 1 ] );
|
956 |
+
}
|
957 |
+
} else {
|
958 |
+
jQuery( '#gadwp-reports' + slug ).show();
|
959 |
+
reports.throwError( '#gadwp-trafficmediums' + slug, response[ 1 ], "80px" );
|
960 |
+
}
|
961 |
+
|
962 |
+
if ( !jQuery.isNumeric( response[ 2 ] ) ) {
|
963 |
+
if ( jQuery.isArray( response[ 2 ] ) ) {
|
964 |
+
jQuery( '#gadwp-reports' + slug ).show();
|
965 |
+
reports.traffictype = response[ 2 ];
|
966 |
+
google.setOnLoadCallback( reports.drawtraffictype( reports.traffictype ) );
|
967 |
+
} else {
|
968 |
+
reports.throwDebug( response[ 2 ] );
|
969 |
+
}
|
970 |
+
} else {
|
971 |
+
jQuery( '#gadwp-reports' + slug ).show();
|
972 |
+
reports.throwError( '#gadwp-traffictype' + slug, response[ 2 ], "80px" );
|
973 |
+
}
|
974 |
+
|
975 |
+
if ( !jQuery.isNumeric( response[ 3 ] ) ) {
|
976 |
+
if ( jQuery.isArray( response[ 3 ] ) ) {
|
977 |
+
jQuery( '#gadwp-reports' + slug ).show();
|
978 |
+
reports.trafficorganic = response[ 3 ];
|
979 |
+
google.setOnLoadCallback( reports.drawtrafficorganic( reports.trafficorganic ) );
|
980 |
+
} else {
|
981 |
+
reports.throwDebug( response[ 3 ] );
|
982 |
+
}
|
983 |
+
} else {
|
984 |
+
jQuery( '#gadwp-reports' + slug ).show();
|
985 |
+
reports.throwError( '#gadwp-trafficorganic' + slug, response[ 3 ], "80px" );
|
986 |
+
}
|
987 |
+
|
988 |
+
if ( !jQuery.isNumeric( response[ 4 ] ) ) {
|
989 |
+
if ( jQuery.isArray( response[ 4 ] ) ) {
|
990 |
+
jQuery( '#gadwp-reports' + slug ).show();
|
991 |
+
reports.socialnetworks = response[ 4 ];
|
992 |
+
google.setOnLoadCallback( reports.drawsocialnetworks( reports.socialnetworks ) );
|
993 |
+
} else {
|
994 |
+
reports.throwDebug( response[ 4 ] );
|
995 |
+
}
|
996 |
+
} else {
|
997 |
+
jQuery( '#gadwp-reports' + slug ).show();
|
998 |
+
reports.throwError( '#gadwp-socialnetworks' + slug, response[ 4 ], "80px" );
|
999 |
+
}
|
1000 |
+
} else {
|
1001 |
+
reports.throwDebug( response );
|
1002 |
+
}
|
1003 |
+
NProgress.done();
|
1004 |
+
} );
|
1005 |
+
|
1006 |
+
} else if ( query == 'locations' ) {
|
1007 |
+
|
1008 |
+
tpl = '<div id="gadwp-map' + slug + '"></div>';
|
1009 |
+
tpl += '<div id="gadwp-locations' + slug + '"></div>';
|
1010 |
+
|
1011 |
+
jQuery( '#gadwp-reports' + slug ).html( tpl );
|
1012 |
+
jQuery( '#gadwp-reports' + slug ).hide();
|
1013 |
+
|
1014 |
+
post_data.query = query;
|
1015 |
+
|
1016 |
+
jQuery.post( gadwp_item_data.ajaxurl, post_data, function ( response ) {
|
1017 |
+
if ( jQuery.isArray( response ) ) {
|
1018 |
+
if ( !jQuery.isNumeric( response[ 0 ] ) ) {
|
1019 |
+
if ( jQuery.isArray( response[ 0 ] ) ) {
|
1020 |
+
jQuery( '#gadwp-reports' + slug ).show();
|
1021 |
+
reports.locations = response[ 0 ];
|
1022 |
+
google.setOnLoadCallback( reports.drawmaplocations( reports.locations ) );
|
1023 |
+
google.setOnLoadCallback( reports.drawlocations( reports.locations ) );
|
1024 |
+
} else {
|
1025 |
+
reports.throwDebug( response[ 0 ] );
|
1026 |
+
}
|
1027 |
+
} else {
|
1028 |
+
jQuery( '#gadwp-reports' + slug ).show();
|
1029 |
+
reports.throwError( '#gadwp-map' + slug, response[ 0 ], "125px" );
|
1030 |
+
reports.throwError( '#gadwp-locations' + slug, response[ 0 ], "125px" );
|
1031 |
+
}
|
1032 |
+
} else {
|
1033 |
+
reports.throwDebug( response );
|
1034 |
+
}
|
1035 |
+
NProgress.done();
|
1036 |
+
} );
|
1037 |
+
|
1038 |
+
} else {
|
1039 |
+
|
1040 |
+
tpl = '<div id="gadwp-mainchart' + slug + '"></div>';
|
1041 |
+
tpl += '<div id="gadwp-bottomstats' + slug + '" class="gadwp-wrapper">';
|
1042 |
+
tpl += '<div class="inside">';
|
1043 |
+
tpl += '<div class="small-box"><h3>' + gadwp_item_data.i18n[ 5 ] + '</h3><p id="gdsessions' + slug + '"> </p></div>';
|
1044 |
+
tpl += '<div class="small-box"><h3>' + gadwp_item_data.i18n[ 6 ] + '</h3><p id="gdusers' + slug + '"> </p></div>';
|
1045 |
+
tpl += '<div class="small-box"><h3>' + gadwp_item_data.i18n[ 7 ] + '</h3><p id="gdpageviews' + slug + '"> </p></div>';
|
1046 |
+
tpl += '<div class="small-box"><h3>' + gadwp_item_data.i18n[ 8 ] + '</h3><p id="gdbouncerate' + slug + '"> </p></div>';
|
1047 |
+
tpl += '<div class="small-box"><h3>' + gadwp_item_data.i18n[ 9 ] + '</h3><p id="gdorganicsearch' + slug + '"> </p></div>';
|
1048 |
+
tpl += '<div class="small-box"><h3>' + gadwp_item_data.i18n[ 10 ] + '</h3><p id="gdpagespervisit' + slug + '"> </p></div>';
|
1049 |
+
tpl += '</div>';
|
1050 |
+
tpl += '</div>';
|
1051 |
+
|
1052 |
+
jQuery( '#gadwp-reports' + slug ).html( tpl );
|
1053 |
+
jQuery( '#gadwp-reports' + slug ).hide();
|
1054 |
+
|
1055 |
+
post_data.query = query + ',bottomstats';
|
1056 |
+
|
1057 |
+
jQuery.post( gadwp_item_data.ajaxurl, post_data, function ( response ) {
|
1058 |
+
if ( jQuery.isArray( response ) ) {
|
1059 |
+
if ( !jQuery.isNumeric( response[ 0 ] ) ) {
|
1060 |
+
if ( jQuery.isArray( response[ 0 ] ) ) {
|
1061 |
+
jQuery( '#gadwp-reports' + slug ).show();
|
1062 |
+
reports.mainchart = response[ 0 ];
|
1063 |
+
if ( query == 'visitBounceRate' ) {
|
1064 |
+
google.setOnLoadCallback( reports.drawmainchart( reports.mainchart, true ) );
|
1065 |
+
} else {
|
1066 |
+
google.setOnLoadCallback( reports.drawmainchart( reports.mainchart, false ) );
|
1067 |
+
}
|
1068 |
+
} else {
|
1069 |
+
reports.throwDebug( response[ 0 ] );
|
1070 |
+
}
|
1071 |
+
} else {
|
1072 |
+
jQuery( '#gadwp-reports' + slug ).show();
|
1073 |
+
reports.throwError( '#gadwp-mainchart' + slug, response[ 0 ], "125px" );
|
1074 |
+
}
|
1075 |
+
if ( !jQuery.isNumeric( response[ 1 ] ) ) {
|
1076 |
+
if ( jQuery.isArray( response[ 1 ] ) ) {
|
1077 |
+
jQuery( '#gadwp-reports' + slug ).show();
|
1078 |
+
reports.bottomstats = response[ 1 ];
|
1079 |
+
google.setOnLoadCallback( reports.drawbottomstats( reports.bottomstats ) );
|
1080 |
+
} else {
|
1081 |
+
reports.throwDebug( response[ 1 ] );
|
1082 |
+
}
|
1083 |
+
} else {
|
1084 |
+
jQuery( '#gadwp-reports' + slug ).show();
|
1085 |
+
reports.throwError( '#gadwp-bottomstats' + slug, response[ 1 ], "40px" );
|
1086 |
+
}
|
1087 |
+
} else {
|
1088 |
+
reports.throwDebug( response );
|
1089 |
+
}
|
1090 |
+
NProgress.done();
|
1091 |
+
} );
|
1092 |
+
|
1093 |
+
}
|
1094 |
+
|
1095 |
+
}
|
1096 |
+
|
1097 |
+
},
|
1098 |
+
|
1099 |
+
refresh : function () {
|
1100 |
+
if ( jQuery( '#gadwp-bottomstats' + slug ).length > 0 ) {
|
1101 |
+
reports.drawbottomstats( reports.bottomstats );
|
1102 |
+
}
|
1103 |
+
if ( jQuery( '#gadwp-mainchart' + slug ).length > 0 && jQuery.isArray( reports.mainchart ) ) {
|
1104 |
+
reports.drawmainchart( reports.mainchart );
|
1105 |
+
}
|
1106 |
+
if ( jQuery( '#gadwp-map' + slug ).length > 0 && jQuery.isArray( reports.locations ) ) {
|
1107 |
+
reports.drawmaplocations( reports.locations );
|
1108 |
+
}
|
1109 |
+
if ( jQuery( '#gadwp-locations' + slug ).length > 0 && jQuery.isArray( reports.locations ) ) {
|
1110 |
+
reports.drawlocations( reports.locations );
|
1111 |
+
}
|
1112 |
+
if ( jQuery( '#gadwp-socialnetworks' + slug ).length > 0 && jQuery.isArray( reports.socialnetworks ) ) {
|
1113 |
+
reports.drawsocialnetworks( reports.socialnetworks );
|
1114 |
+
}
|
1115 |
+
if ( jQuery( '#gadwp-trafficorganic' + slug ).length > 0 && jQuery.isArray( reports.trafficorganic ) ) {
|
1116 |
+
reports.drawtrafficorganic( reports.trafficorganic );
|
1117 |
+
}
|
1118 |
+
if ( jQuery( '#gadwp-traffictype' + slug ).length > 0 && jQuery.isArray( reports.traffictype ) ) {
|
1119 |
+
reports.drawtraffictype( reports.traffictype );
|
1120 |
+
}
|
1121 |
+
if ( jQuery( '#gadwp-trafficmediums' + slug ).length > 0 && jQuery.isArray( reports.trafficmediums ) ) {
|
1122 |
+
reports.drawtrafficmediums( reports.trafficmediums );
|
1123 |
+
}
|
1124 |
+
if ( jQuery( '#gadwp-trafficchannels' + slug ).length > 0 && jQuery.isArray( reports.trafficchannels ) ) {
|
1125 |
+
reports.drawtrafficchannels( reports.trafficchannels );
|
1126 |
+
}
|
1127 |
+
if ( jQuery( '#gadwp-prs' + slug ).length > 0 && jQuery.isArray( reports.prs ) ) {
|
1128 |
+
reports.drawprs( reports.prs );
|
1129 |
+
}
|
1130 |
+
},
|
1131 |
+
|
1132 |
+
init : function () {
|
1133 |
+
|
1134 |
+
if ( !jQuery( "#gadwp-reports" + slug ).length ) {
|
1135 |
+
return;
|
1136 |
+
}
|
1137 |
+
|
1138 |
+
if ( jQuery( "#gadwp-reports" + slug ).html().length ) { // only when report is empty
|
1139 |
+
return;
|
1140 |
+
}
|
1141 |
+
|
1142 |
+
try {
|
1143 |
+
NProgress.configure( {
|
1144 |
+
parent : "#gadwp-progressbar" + slug,
|
1145 |
+
showSpinner : false
|
1146 |
+
} );
|
1147 |
+
NProgress.start();
|
1148 |
+
} catch ( e ) {
|
1149 |
+
reports.alertMessage( gadwp_item_data.i18n[ 0 ] );
|
1150 |
+
}
|
1151 |
+
|
1152 |
+
reports.render( jQuery( '#gadwp-sel-view' + slug ).val(), jQuery( '#gadwp-sel-period' + slug ).val(), jQuery( '#gadwp-sel-report' + slug ).val() );
|
1153 |
+
|
1154 |
+
jQuery( window ).resize( function () {
|
1155 |
+
reports.refresh();
|
1156 |
+
} );
|
1157 |
+
}
|
1158 |
+
}
|
1159 |
+
|
1160 |
+
template.init();
|
1161 |
+
|
1162 |
+
reports.init();
|
1163 |
+
|
1164 |
+
jQuery( '#gadwp-sel-view' + slug ).change( function () {
|
1165 |
+
jQuery( '#gadwp-reports' + slug ).html( '' );
|
1166 |
+
reports.init();
|
1167 |
+
} );
|
1168 |
+
|
1169 |
+
jQuery( '#gadwp-sel-period' + slug ).change( function () {
|
1170 |
+
jQuery( '#gadwp-reports' + slug ).html( '' );
|
1171 |
+
reports.init();
|
1172 |
+
} );
|
1173 |
+
|
1174 |
+
jQuery( '#gadwp-sel-report' + slug ).change( function () {
|
1175 |
+
jQuery( '#gadwp-reports' + slug ).html( '' );
|
1176 |
+
reports.init();
|
1177 |
+
} );
|
1178 |
+
|
1179 |
+
if ( gadwp_item_data.scope == 'admin-widgets' ) {
|
1180 |
+
return;
|
1181 |
+
} else {
|
1182 |
+
return this.dialog( {
|
1183 |
+
width : 'auto',
|
1184 |
+
maxWidth : 510,
|
1185 |
+
height : 'auto',
|
1186 |
+
modal : true,
|
1187 |
+
fluid : true,
|
1188 |
+
dialogClass : 'gadwp wp-dialog',
|
1189 |
+
resizable : false,
|
1190 |
+
title : reports.getTitle( gadwp_item_data.scope ),
|
1191 |
+
position : {
|
1192 |
+
my : "top",
|
1193 |
+
at : "top+100",
|
1194 |
+
of : window
|
1195 |
+
}
|
1196 |
+
} );
|
1197 |
+
}
|
1198 |
+
}
|
1199 |
+
} );
|
common/nprogress/nprogress.css
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#nprogress {
|
2 |
+
pointer-events: none;
|
3 |
+
}
|
4 |
+
|
5 |
+
#nprogress .bar {
|
6 |
+
background: #29d;
|
7 |
+
position: fixed;
|
8 |
+
z-index: 1031;
|
9 |
+
top: 0;
|
10 |
+
left: 0;
|
11 |
+
width: 100%;
|
12 |
+
height: 2px;
|
13 |
+
}
|
14 |
+
|
15 |
+
/* Fancy blur effect */
|
16 |
+
#nprogress .peg {
|
17 |
+
display: block;
|
18 |
+
position: absolute;
|
19 |
+
right: 0px;
|
20 |
+
width: 100px;
|
21 |
+
height: 100%;
|
22 |
+
box-shadow: 0 0 10px #29d, 0 0 5px #29d;
|
23 |
+
opacity: 1.0;
|
24 |
+
-webkit-transform: rotate(3deg) translate(0px, -4px);
|
25 |
+
-ms-transform: rotate(3deg) translate(0px, -4px);
|
26 |
+
transform: rotate(3deg) translate(0px, -4px);
|
27 |
+
}
|
28 |
+
|
29 |
+
/* Remove these to get rid of the spinner */
|
30 |
+
#nprogress .spinner {
|
31 |
+
display: block;
|
32 |
+
position: fixed;
|
33 |
+
z-index: 1031;
|
34 |
+
top: 15px;
|
35 |
+
right: 15px;
|
36 |
+
}
|
37 |
+
|
38 |
+
#nprogress .spinner-icon {
|
39 |
+
width: 18px;
|
40 |
+
height: 18px;
|
41 |
+
box-sizing: border-box;
|
42 |
+
border: solid 2px transparent;
|
43 |
+
border-top-color: #29d;
|
44 |
+
border-left-color: #29d;
|
45 |
+
border-radius: 50%;
|
46 |
+
-webkit-animation: nprogress-spinner 400ms linear infinite;
|
47 |
+
animation: nprogress-spinner 400ms linear infinite;
|
48 |
+
}
|
49 |
+
|
50 |
+
.nprogress-custom-parent {
|
51 |
+
overflow: hidden;
|
52 |
+
position: relative;
|
53 |
+
}
|
54 |
+
|
55 |
+
.nprogress-custom-parent #nprogress .spinner, .nprogress-custom-parent #nprogress .bar
|
56 |
+
{
|
57 |
+
position: absolute;
|
58 |
+
}
|
59 |
+
|
60 |
+
@-webkit-keyframes nprogress-spinner {
|
61 |
+
0% { -webkit-transform: rotate(0deg); }
|
62 |
+
100% { -webkit-transform: rotate(360deg); }
|
63 |
+
}
|
64 |
+
@keyframes nprogress-spinner {
|
65 |
+
0% { transform: rotate(0deg); }
|
66 |
+
100% { transform: rotate(360deg); }
|
67 |
+
}
|
common/nprogress/nprogress.js
ADDED
@@ -0,0 +1,476 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress
|
2 |
+
* @license MIT */
|
3 |
+
|
4 |
+
;(function(root, factory) {
|
5 |
+
|
6 |
+
if (typeof define === 'function' && define.amd) {
|
7 |
+
define(factory);
|
8 |
+
} else if (typeof exports === 'object') {
|
9 |
+
module.exports = factory();
|
10 |
+
} else {
|
11 |
+
root.NProgress = factory();
|
12 |
+
}
|
13 |
+
|
14 |
+
})(this, function() {
|
15 |
+
var NProgress = {};
|
16 |
+
|
17 |
+
NProgress.version = '0.1.6';
|
18 |
+
|
19 |
+
var Settings = NProgress.settings = {
|
20 |
+
minimum: 0.08,
|
21 |
+
easing: 'ease',
|
22 |
+
positionUsing: '',
|
23 |
+
speed: 200,
|
24 |
+
trickle: true,
|
25 |
+
trickleRate: 0.02,
|
26 |
+
trickleSpeed: 800,
|
27 |
+
showSpinner: true,
|
28 |
+
barSelector: '[role="bar"]',
|
29 |
+
spinnerSelector: '[role="spinner"]',
|
30 |
+
parent: 'body',
|
31 |
+
template: '<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'
|
32 |
+
};
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Updates configuration.
|
36 |
+
*
|
37 |
+
* NProgress.configure({
|
38 |
+
* minimum: 0.1
|
39 |
+
* });
|
40 |
+
*/
|
41 |
+
NProgress.configure = function(options) {
|
42 |
+
var key, value;
|
43 |
+
for (key in options) {
|
44 |
+
value = options[key];
|
45 |
+
if (value !== undefined && options.hasOwnProperty(key)) Settings[key] = value;
|
46 |
+
}
|
47 |
+
|
48 |
+
return this;
|
49 |
+
};
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Last number.
|
53 |
+
*/
|
54 |
+
|
55 |
+
NProgress.status = null;
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Sets the progress bar status, where `n` is a number from `0.0` to `1.0`.
|
59 |
+
*
|
60 |
+
* NProgress.set(0.4);
|
61 |
+
* NProgress.set(1.0);
|
62 |
+
*/
|
63 |
+
|
64 |
+
NProgress.set = function(n) {
|
65 |
+
var started = NProgress.isStarted();
|
66 |
+
|
67 |
+
n = clamp(n, Settings.minimum, 1);
|
68 |
+
NProgress.status = (n === 1 ? null : n);
|
69 |
+
|
70 |
+
var progress = NProgress.render(!started),
|
71 |
+
bar = progress.querySelector(Settings.barSelector),
|
72 |
+
speed = Settings.speed,
|
73 |
+
ease = Settings.easing;
|
74 |
+
|
75 |
+
progress.offsetWidth; /* Repaint */
|
76 |
+
|
77 |
+
queue(function(next) {
|
78 |
+
// Set positionUsing if it hasn't already been set
|
79 |
+
if (Settings.positionUsing === '') Settings.positionUsing = NProgress.getPositioningCSS();
|
80 |
+
|
81 |
+
// Add transition
|
82 |
+
css(bar, barPositionCSS(n, speed, ease));
|
83 |
+
|
84 |
+
if (n === 1) {
|
85 |
+
// Fade out
|
86 |
+
css(progress, {
|
87 |
+
transition: 'none',
|
88 |
+
opacity: 1
|
89 |
+
});
|
90 |
+
progress.offsetWidth; /* Repaint */
|
91 |
+
|
92 |
+
setTimeout(function() {
|
93 |
+
css(progress, {
|
94 |
+
transition: 'all ' + speed + 'ms linear',
|
95 |
+
opacity: 0
|
96 |
+
});
|
97 |
+
setTimeout(function() {
|
98 |
+
NProgress.remove();
|
99 |
+
next();
|
100 |
+
}, speed);
|
101 |
+
}, speed);
|
102 |
+
} else {
|
103 |
+
setTimeout(next, speed);
|
104 |
+
}
|
105 |
+
});
|
106 |
+
|
107 |
+
return this;
|
108 |
+
};
|
109 |
+
|
110 |
+
NProgress.isStarted = function() {
|
111 |
+
return typeof NProgress.status === 'number';
|
112 |
+
};
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Shows the progress bar.
|
116 |
+
* This is the same as setting the status to 0%, except that it doesn't go backwards.
|
117 |
+
*
|
118 |
+
* NProgress.start();
|
119 |
+
*
|
120 |
+
*/
|
121 |
+
NProgress.start = function() {
|
122 |
+
if (!NProgress.status) NProgress.set(0);
|
123 |
+
|
124 |
+
var work = function() {
|
125 |
+
setTimeout(function() {
|
126 |
+
if (!NProgress.status) return;
|
127 |
+
NProgress.trickle();
|
128 |
+
work();
|
129 |
+
}, Settings.trickleSpeed);
|
130 |
+
};
|
131 |
+
|
132 |
+
if (Settings.trickle) work();
|
133 |
+
|
134 |
+
return this;
|
135 |
+
};
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Hides the progress bar.
|
139 |
+
* This is the *sort of* the same as setting the status to 100%, with the
|
140 |
+
* difference being `done()` makes some placebo effect of some realistic motion.
|
141 |
+
*
|
142 |
+
* NProgress.done();
|
143 |
+
*
|
144 |
+
* If `true` is passed, it will show the progress bar even if its hidden.
|
145 |
+
*
|
146 |
+
* NProgress.done(true);
|
147 |
+
*/
|
148 |
+
|
149 |
+
NProgress.done = function(force) {
|
150 |
+
if (!force && !NProgress.status) return this;
|
151 |
+
|
152 |
+
return NProgress.inc(0.3 + 0.5 * Math.random()).set(1);
|
153 |
+
};
|
154 |
+
|
155 |
+
/**
|
156 |
+
* Increments by a random amount.
|
157 |
+
*/
|
158 |
+
|
159 |
+
NProgress.inc = function(amount) {
|
160 |
+
var n = NProgress.status;
|
161 |
+
|
162 |
+
if (!n) {
|
163 |
+
return NProgress.start();
|
164 |
+
} else {
|
165 |
+
if (typeof amount !== 'number') {
|
166 |
+
amount = (1 - n) * clamp(Math.random() * n, 0.1, 0.95);
|
167 |
+
}
|
168 |
+
|
169 |
+
n = clamp(n + amount, 0, 0.994);
|
170 |
+
return NProgress.set(n);
|
171 |
+
}
|
172 |
+
};
|
173 |
+
|
174 |
+
NProgress.trickle = function() {
|
175 |
+
return NProgress.inc(Math.random() * Settings.trickleRate);
|
176 |
+
};
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Waits for all supplied jQuery promises and
|
180 |
+
* increases the progress as the promises resolve.
|
181 |
+
*
|
182 |
+
* @param $promise jQUery Promise
|
183 |
+
*/
|
184 |
+
(function() {
|
185 |
+
var initial = 0, current = 0;
|
186 |
+
|
187 |
+
NProgress.promise = function($promise) {
|
188 |
+
if (!$promise || $promise.state() == "resolved") {
|
189 |
+
return this;
|
190 |
+
}
|
191 |
+
|
192 |
+
if (current == 0) {
|
193 |
+
NProgress.start();
|
194 |
+
}
|
195 |
+
|
196 |
+
initial++;
|
197 |
+
current++;
|
198 |
+
|
199 |
+
$promise.always(function() {
|
200 |
+
current--;
|
201 |
+
if (current == 0) {
|
202 |
+
initial = 0;
|
203 |
+
NProgress.done();
|
204 |
+
} else {
|
205 |
+
NProgress.set((initial - current) / initial);
|
206 |
+
}
|
207 |
+
});
|
208 |
+
|
209 |
+
return this;
|
210 |
+
};
|
211 |
+
|
212 |
+
})();
|
213 |
+
|
214 |
+
/**
|
215 |
+
* (Internal) renders the progress bar markup based on the `template`
|
216 |
+
* setting.
|
217 |
+
*/
|
218 |
+
|
219 |
+
NProgress.render = function(fromStart) {
|
220 |
+
if (NProgress.isRendered()) return document.getElementById('nprogress');
|
221 |
+
|
222 |
+
addClass(document.documentElement, 'nprogress-busy');
|
223 |
+
|
224 |
+
var progress = document.createElement('div');
|
225 |
+
progress.id = 'nprogress';
|
226 |
+
progress.innerHTML = Settings.template;
|
227 |
+
|
228 |
+
var bar = progress.querySelector(Settings.barSelector),
|
229 |
+
perc = fromStart ? '-100' : toBarPerc(NProgress.status || 0),
|
230 |
+
parent = document.querySelector(Settings.parent),
|
231 |
+
spinner;
|
232 |
+
|
233 |
+
css(bar, {
|
234 |
+
transition: 'all 0 linear',
|
235 |
+
transform: 'translate3d(' + perc + '%,0,0)'
|
236 |
+
});
|
237 |
+
|
238 |
+
if (!Settings.showSpinner) {
|
239 |
+
spinner = progress.querySelector(Settings.spinnerSelector);
|
240 |
+
spinner && removeElement(spinner);
|
241 |
+
}
|
242 |
+
|
243 |
+
if (parent != document.body) {
|
244 |
+
addClass(parent, 'nprogress-custom-parent');
|
245 |
+
}
|
246 |
+
|
247 |
+
parent.appendChild(progress);
|
248 |
+
return progress;
|
249 |
+
};
|
250 |
+
|
251 |
+
/**
|
252 |
+
* Removes the element. Opposite of render().
|
253 |
+
*/
|
254 |
+
|
255 |
+
NProgress.remove = function() {
|
256 |
+
removeClass(document.documentElement, 'nprogress-busy');
|
257 |
+
removeClass(document.querySelector(Settings.parent), 'nprogress-custom-parent')
|
258 |
+
var progress = document.getElementById('nprogress');
|
259 |
+
progress && removeElement(progress);
|
260 |
+
};
|
261 |
+
|
262 |
+
/**
|
263 |
+
* Checks if the progress bar is rendered.
|
264 |
+
*/
|
265 |
+
|
266 |
+
NProgress.isRendered = function() {
|
267 |
+
return !!document.getElementById('nprogress');
|
268 |
+
};
|
269 |
+
|
270 |
+
/**
|
271 |
+
* Determine which positioning CSS rule to use.
|
272 |
+
*/
|
273 |
+
|
274 |
+
NProgress.getPositioningCSS = function() {
|
275 |
+
// Sniff on document.body.style
|
276 |
+
var bodyStyle = document.body.style;
|
277 |
+
|
278 |
+
// Sniff prefixes
|
279 |
+
var vendorPrefix = ('WebkitTransform' in bodyStyle) ? 'Webkit' :
|
280 |
+
('MozTransform' in bodyStyle) ? 'Moz' :
|
281 |
+
('msTransform' in bodyStyle) ? 'ms' :
|
282 |
+
('OTransform' in bodyStyle) ? 'O' : '';
|
283 |
+
|
284 |
+
if (vendorPrefix + 'Perspective' in bodyStyle) {
|
285 |
+
// Modern browsers with 3D support, e.g. Webkit, IE10
|
286 |
+
return 'translate3d';
|
287 |
+
} else if (vendorPrefix + 'Transform' in bodyStyle) {
|
288 |
+
// Browsers without 3D support, e.g. IE9
|
289 |
+
return 'translate';
|
290 |
+
} else {
|
291 |
+
// Browsers without translate() support, e.g. IE7-8
|
292 |
+
return 'margin';
|
293 |
+
}
|
294 |
+
};
|
295 |
+
|
296 |
+
/**
|
297 |
+
* Helpers
|
298 |
+
*/
|
299 |
+
|
300 |
+
function clamp(n, min, max) {
|
301 |
+
if (n < min) return min;
|
302 |
+
if (n > max) return max;
|
303 |
+
return n;
|
304 |
+
}
|
305 |
+
|
306 |
+
/**
|
307 |
+
* (Internal) converts a percentage (`0..1`) to a bar translateX
|
308 |
+
* percentage (`-100%..0%`).
|
309 |
+
*/
|
310 |
+
|
311 |
+
function toBarPerc(n) {
|
312 |
+
return (-1 + n) * 100;
|
313 |
+
}
|
314 |
+
|
315 |
+
|
316 |
+
/**
|
317 |
+
* (Internal) returns the correct CSS for changing the bar's
|
318 |
+
* position given an n percentage, and speed and ease from Settings
|
319 |
+
*/
|
320 |
+
|
321 |
+
function barPositionCSS(n, speed, ease) {
|
322 |
+
var barCSS;
|
323 |
+
|
324 |
+
if (Settings.positionUsing === 'translate3d') {
|
325 |
+
barCSS = { transform: 'translate3d('+toBarPerc(n)+'%,0,0)' };
|
326 |
+
} else if (Settings.positionUsing === 'translate') {
|
327 |
+
barCSS = { transform: 'translate('+toBarPerc(n)+'%,0)' };
|
328 |
+
} else {
|
329 |
+
barCSS = { 'margin-left': toBarPerc(n)+'%' };
|
330 |
+
}
|
331 |
+
|
332 |
+
barCSS.transition = 'all '+speed+'ms '+ease;
|
333 |
+
|
334 |
+
return barCSS;
|
335 |
+
}
|
336 |
+
|
337 |
+
/**
|
338 |
+
* (Internal) Queues a function to be executed.
|
339 |
+
*/
|
340 |
+
|
341 |
+
var queue = (function() {
|
342 |
+
var pending = [];
|
343 |
+
|
344 |
+
function next() {
|
345 |
+
var fn = pending.shift();
|
346 |
+
if (fn) {
|
347 |
+
fn(next);
|
348 |
+
}
|
349 |
+
}
|
350 |
+
|
351 |
+
return function(fn) {
|
352 |
+
pending.push(fn);
|
353 |
+
if (pending.length == 1) next();
|
354 |
+
};
|
355 |
+
})();
|
356 |
+
|
357 |
+
/**
|
358 |
+
* (Internal) Applies css properties to an element, similar to the jQuery
|
359 |
+
* css method.
|
360 |
+
*
|
361 |
+
* While this helper does assist with vendor prefixed property names, it
|
362 |
+
* does not perform any manipulation of values prior to setting styles.
|
363 |
+
*/
|
364 |
+
|
365 |
+
var css = (function() {
|
366 |
+
var cssPrefixes = [ 'Webkit', 'O', 'Moz', 'ms' ],
|
367 |
+
cssProps = {};
|
368 |
+
|
369 |
+
function camelCase(string) {
|
370 |
+
return string.replace(/^-ms-/, 'ms-').replace(/-([\da-z])/gi, function(match, letter) {
|
371 |
+
return letter.toUpperCase();
|
372 |
+
});
|
373 |
+
}
|
374 |
+
|
375 |
+
function getVendorProp(name) {
|
376 |
+
var style = document.body.style;
|
377 |
+
if (name in style) return name;
|
378 |
+
|
379 |
+
var i = cssPrefixes.length,
|
380 |
+
capName = name.charAt(0).toUpperCase() + name.slice(1),
|
381 |
+
vendorName;
|
382 |
+
while (i--) {
|
383 |
+
vendorName = cssPrefixes[i] + capName;
|
384 |
+
if (vendorName in style) return vendorName;
|
385 |
+
}
|
386 |
+
|
387 |
+
return name;
|
388 |
+
}
|
389 |
+
|
390 |
+
function getStyleProp(name) {
|
391 |
+
name = camelCase(name);
|
392 |
+
return cssProps[name] || (cssProps[name] = getVendorProp(name));
|
393 |
+
}
|
394 |
+
|
395 |
+
function applyCss(element, prop, value) {
|
396 |
+
prop = getStyleProp(prop);
|
397 |
+
element.style[prop] = value;
|
398 |
+
}
|
399 |
+
|
400 |
+
return function(element, properties) {
|
401 |
+
var args = arguments,
|
402 |
+
prop,
|
403 |
+
value;
|
404 |
+
|
405 |
+
if (args.length == 2) {
|
406 |
+
for (prop in properties) {
|
407 |
+
value = properties[prop];
|
408 |
+
if (value !== undefined && properties.hasOwnProperty(prop)) applyCss(element, prop, value);
|
409 |
+
}
|
410 |
+
} else {
|
411 |
+
applyCss(element, args[1], args[2]);
|
412 |
+
}
|
413 |
+
}
|
414 |
+
})();
|
415 |
+
|
416 |
+
/**
|
417 |
+
* (Internal) Determines if an element or space separated list of class names contains a class name.
|
418 |
+
*/
|
419 |
+
|
420 |
+
function hasClass(element, name) {
|
421 |
+
var list = typeof element == 'string' ? element : classList(element);
|
422 |
+
return list.indexOf(' ' + name + ' ') >= 0;
|
423 |
+
}
|
424 |
+
|
425 |
+
/**
|
426 |
+
* (Internal) Adds a class to an element.
|
427 |
+
*/
|
428 |
+
|
429 |
+
function addClass(element, name) {
|
430 |
+
var oldList = classList(element),
|
431 |
+
newList = oldList + name;
|
432 |
+
|
433 |
+
if (hasClass(oldList, name)) return;
|
434 |
+
|
435 |
+
// Trim the opening space.
|
436 |
+
element.className = newList.substring(1);
|
437 |
+
}
|
438 |
+
|
439 |
+
/**
|
440 |
+
* (Internal) Removes a class from an element.
|
441 |
+
*/
|
442 |
+
|
443 |
+
function removeClass(element, name) {
|
444 |
+
var oldList = classList(element),
|
445 |
+
newList;
|
446 |
+
|
447 |
+
if (!hasClass(element, name)) return;
|
448 |
+
|
449 |
+
// Replace the class name.
|
450 |
+
newList = oldList.replace(' ' + name + ' ', ' ');
|
451 |
+
|
452 |
+
// Trim the opening and closing spaces.
|
453 |
+
element.className = newList.substring(1, newList.length - 1);
|
454 |
+
}
|
455 |
+
|
456 |
+
/**
|
457 |
+
* (Internal) Gets a space separated list of the class names on the element.
|
458 |
+
* The list is wrapped with a single space on each end to facilitate finding
|
459 |
+
* matches within the list.
|
460 |
+
*/
|
461 |
+
|
462 |
+
function classList(element) {
|
463 |
+
return (' ' + (element.className || '') + ' ').replace(/\s+/gi, ' ');
|
464 |
+
}
|
465 |
+
|
466 |
+
/**
|
467 |
+
* (Internal) Removes an element from the DOM.
|
468 |
+
*/
|
469 |
+
|
470 |
+
function removeElement(element) {
|
471 |
+
element && element.parentNode && element.parentNode.removeChild(element);
|
472 |
+
}
|
473 |
+
|
474 |
+
return NProgress;
|
475 |
+
});
|
476 |
+
|
common/realtime/images/ui-bg_flat_0_aaaaaa_40x100.png
ADDED
Binary file
|
common/realtime/images/ui-bg_flat_75_ffffff_40x100.png
ADDED
Binary file
|
common/realtime/images/ui-bg_glass_55_fbf9ee_1x400.png
ADDED
Binary file
|
common/realtime/images/ui-bg_glass_65_ffffff_1x400.png
ADDED
Binary file
|
common/realtime/images/ui-bg_glass_75_dadada_1x400.png
ADDED
Binary file
|
common/realtime/images/ui-bg_glass_75_e6e6e6_1x400.png
ADDED
Binary file
|
common/realtime/images/ui-bg_glass_95_fef1ec_1x400.png
ADDED
Binary file
|
common/realtime/images/ui-bg_highlight-soft_75_cccccc_1x100.png
ADDED
Binary file
|
common/realtime/images/ui-icons_222222_256x240.png
ADDED
Binary file
|
common/realtime/images/ui-icons_2e83ff_256x240.png
ADDED
Binary file
|
common/realtime/images/ui-icons_454545_256x240.png
ADDED
Binary file
|
common/realtime/images/ui-icons_888888_256x240.png
ADDED
Binary file
|
common/realtime/images/ui-icons_cd0a0a_256x240.png
ADDED
Binary file
|
common/realtime/jquery.ui.tooltip.html.css
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*! jQuery UI - v1.9.2 - 2013-09-22
|
2 |
+
* http://jqueryui.com
|
3 |
+
* Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */
|
4 |
+
.ui-tooltip.gadwp {
|
5 |
+
padding: 8px;
|
6 |
+
position: absolute;
|
7 |
+
z-index: 9999;
|
8 |
+
max-width: 300px;
|
9 |
+
-webkit-box-shadow: 0 0 5px #aaa;
|
10 |
+
box-shadow: 0 0 5px #aaa
|
11 |
+
}
|
12 |
+
|
13 |
+
* html .ui-tooltip.gadwp {
|
14 |
+
background-image: none
|
15 |
+
}
|
16 |
+
|
17 |
+
body .ui-tooltip.gadwp {
|
18 |
+
border-width: 2px
|
19 |
+
}
|
20 |
+
|
21 |
+
.ui-widget.gadwp {
|
22 |
+
font-family: Verdana, Arial, sans-serif;
|
23 |
+
font-size: 1.1em;
|
24 |
+
}
|
25 |
+
|
26 |
+
.ui-widget.gadwp .ui-widget {
|
27 |
+
font-size: 1em;
|
28 |
+
}
|
29 |
+
|
30 |
+
.ui-widget.gadwp input, .ui-widget.gadwp select, .ui-widget.gadwp textarea, .ui-widget.gadwp button
|
31 |
+
{
|
32 |
+
font-family: Verdana, Arial, sans-serif;
|
33 |
+
font-size: 1em;
|
34 |
+
}
|
35 |
+
|
36 |
+
.ui-widget-content.gadwp {
|
37 |
+
border: 1px solid #aaaaaa;
|
38 |
+
background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50%
|
39 |
+
repeat-x;
|
40 |
+
color: #222222;
|
41 |
+
}
|
42 |
+
|
43 |
+
.ui-widget-content.gadwp a {
|
44 |
+
color: #222222;
|
45 |
+
}
|
46 |
+
|
47 |
+
.gadwp .ui-widget-header {
|
48 |
+
border: 1px solid #aaaaaa;
|
49 |
+
background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png)
|
50 |
+
50% 50% repeat-x;
|
51 |
+
color: #222222;
|
52 |
+
font-weight: bold;
|
53 |
+
}
|
54 |
+
|
55 |
+
.gadwp .ui-widget-header a {
|
56 |
+
color: #222222;
|
57 |
+
}
|
common/realtime/jquery.ui.tooltip.html.js
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(function () {
|
2 |
+
jQuery('#gadwp-widget *').tooltip({
|
3 |
+
items: "[data-gadwp]",
|
4 |
+
content: function () {
|
5 |
+
return jQuery(this).attr("data-gadwp");
|
6 |
+
}
|
7 |
+
});
|
8 |
+
});
|
config.php
CHANGED
@@ -17,26 +17,13 @@ if ( ! class_exists( 'GADWP_Config' ) ) {
|
|
17 |
public $options;
|
18 |
|
19 |
public function __construct() {
|
20 |
-
//
|
21 |
$this->get_plugin_options();
|
22 |
-
|
23 |
add_filter( 'auto_update_plugin', array( $this, 'automatic_update' ), 10, 2 );
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
* Stores the last requested dimension and metric in cookies
|
28 |
-
*/
|
29 |
-
private function last_requested_report() {
|
30 |
-
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { // Don't store queries while doing ajax
|
31 |
-
return;
|
32 |
-
}
|
33 |
-
|
34 |
-
if ( isset( $_REQUEST['gadwpperiod'] ) ) {
|
35 |
-
GADWP_Tools::set_cookie( 'default_dimension', $_REQUEST['gadwpperiod'] );
|
36 |
-
}
|
37 |
-
|
38 |
-
if ( isset( $_REQUEST['gadwpquery'] ) ) {
|
39 |
-
GADWP_Tools::set_cookie( 'default_metric', $_REQUEST['gadwpquery'] );
|
40 |
}
|
41 |
}
|
42 |
|
@@ -64,6 +51,11 @@ if ( ! class_exists( 'GADWP_Config' ) ) {
|
|
64 |
return $update;
|
65 |
}
|
66 |
|
|
|
|
|
|
|
|
|
|
|
67 |
// Validates data before storing
|
68 |
private static function validate_data( $options ) {
|
69 |
if ( isset( $options['ga_realtime_pages'] ) ) {
|
@@ -114,6 +106,15 @@ if ( ! class_exists( 'GADWP_Config' ) ) {
|
|
114 |
if ( isset( $options['ga_aff_tracking'] ) ) {
|
115 |
$options['ga_aff_tracking'] = (int) $options['ga_aff_tracking'];
|
116 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
if ( isset( $options['ga_event_affiliates'] ) ) {
|
118 |
if ( empty( $options['ga_event_affiliates'] ) ) {
|
119 |
$options['ga_event_affiliates'] = '/out/';
|
@@ -181,12 +182,13 @@ if ( ! class_exists( 'GADWP_Config' ) ) {
|
|
181 |
$get_network_options = get_site_option( 'gadash_network_options' );
|
182 |
$network_options = (array) json_decode( $get_network_options );
|
183 |
if ( isset( $network_options['ga_dash_network'] ) && ( $network_options['ga_dash_network'] ) ) {
|
184 |
-
$network_options = (array) json_decode( $get_network_options );
|
185 |
if ( ! is_network_admin() && ! empty( $network_options['ga_dash_profile_list'] ) && isset( $network_options['ga_dash_tableid_network']->$blog_id ) ) {
|
186 |
$network_options['ga_dash_profile_list'] = array( 0 => GADWP_Tools::get_selected_profile( $network_options['ga_dash_profile_list'], $network_options['ga_dash_tableid_network']->$blog_id ) );
|
187 |
$network_options['ga_dash_tableid_jail'] = $network_options['ga_dash_profile_list'][0][1];
|
188 |
}
|
189 |
$this->options = array_merge( $this->options, $network_options );
|
|
|
|
|
190 |
}
|
191 |
}
|
192 |
}
|
@@ -224,8 +226,6 @@ if ( ! class_exists( 'GADWP_Config' ) ) {
|
|
224 |
} else {
|
225 |
GADWP_Tools::delete_cache( 'gapi_errors' );
|
226 |
}
|
227 |
-
GADWP_Tools::unset_cookie( 'default_metric' );
|
228 |
-
GADWP_Tools::unset_cookie( 'default_dimension' );
|
229 |
}
|
230 |
if ( ! isset( $this->options['ga_enhanced_links'] ) ) {
|
231 |
$this->options['ga_enhanced_links'] = 0;
|
@@ -349,6 +349,10 @@ if ( ! class_exists( 'GADWP_Config' ) ) {
|
|
349 |
unset( $this->options['ga_tracking_code'] );
|
350 |
$flag = true;
|
351 |
}
|
|
|
|
|
|
|
|
|
352 |
if ( isset( $this->options['ga_dash_frontend_keywords'] ) ) { // v4.8
|
353 |
unset( $this->options['ga_dash_frontend_keywords'] );
|
354 |
$flag = true;
|
@@ -364,6 +368,23 @@ if ( ! class_exists( 'GADWP_Config' ) ) {
|
|
364 |
$flag = true;
|
365 |
}
|
366 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
367 |
if ( $flag ) {
|
368 |
$this->set_plugin_options( false );
|
369 |
}
|
17 |
public $options;
|
18 |
|
19 |
public function __construct() {
|
20 |
+
// Get plugin options
|
21 |
$this->get_plugin_options();
|
22 |
+
// Automatic updates
|
23 |
add_filter( 'auto_update_plugin', array( $this, 'automatic_update' ), 10, 2 );
|
24 |
+
// Provide language packs for all available Network languages
|
25 |
+
if ( is_multisite() ) {
|
26 |
+
add_filter( 'plugins_update_check_locales', array( $this, 'translation_updates' ), 10, 1 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
}
|
28 |
}
|
29 |
|
51 |
return $update;
|
52 |
}
|
53 |
|
54 |
+
public function translation_updates( $locales ) {
|
55 |
+
$languages = get_available_languages();
|
56 |
+
return array_values( $languages );
|
57 |
+
}
|
58 |
+
|
59 |
// Validates data before storing
|
60 |
private static function validate_data( $options ) {
|
61 |
if ( isset( $options['ga_realtime_pages'] ) ) {
|
106 |
if ( isset( $options['ga_aff_tracking'] ) ) {
|
107 |
$options['ga_aff_tracking'] = (int) $options['ga_aff_tracking'];
|
108 |
}
|
109 |
+
if ( isset( $options['ga_cookiedomain'] ) ) { // v4.9
|
110 |
+
$options['ga_cookiedomain'] = sanitize_text_field( $options['ga_cookiedomain'] );
|
111 |
+
}
|
112 |
+
if ( isset( $options['ga_cookiename'] ) ) { // v4.9
|
113 |
+
$options['ga_cookiename'] = sanitize_text_field( $options['ga_cookiename'] );
|
114 |
+
}
|
115 |
+
if ( isset( $options['ga_cookieexpires'] ) && $options['ga_cookieexpires'] ) { // v4.9
|
116 |
+
$options['ga_cookieexpires'] = (int) $options['ga_cookieexpires'];
|
117 |
+
}
|
118 |
if ( isset( $options['ga_event_affiliates'] ) ) {
|
119 |
if ( empty( $options['ga_event_affiliates'] ) ) {
|
120 |
$options['ga_event_affiliates'] = '/out/';
|
182 |
$get_network_options = get_site_option( 'gadash_network_options' );
|
183 |
$network_options = (array) json_decode( $get_network_options );
|
184 |
if ( isset( $network_options['ga_dash_network'] ) && ( $network_options['ga_dash_network'] ) ) {
|
|
|
185 |
if ( ! is_network_admin() && ! empty( $network_options['ga_dash_profile_list'] ) && isset( $network_options['ga_dash_tableid_network']->$blog_id ) ) {
|
186 |
$network_options['ga_dash_profile_list'] = array( 0 => GADWP_Tools::get_selected_profile( $network_options['ga_dash_profile_list'], $network_options['ga_dash_tableid_network']->$blog_id ) );
|
187 |
$network_options['ga_dash_tableid_jail'] = $network_options['ga_dash_profile_list'][0][1];
|
188 |
}
|
189 |
$this->options = array_merge( $this->options, $network_options );
|
190 |
+
} else {
|
191 |
+
$this->options['ga_dash_network'] = 0;
|
192 |
}
|
193 |
}
|
194 |
}
|
226 |
} else {
|
227 |
GADWP_Tools::delete_cache( 'gapi_errors' );
|
228 |
}
|
|
|
|
|
229 |
}
|
230 |
if ( ! isset( $this->options['ga_enhanced_links'] ) ) {
|
231 |
$this->options['ga_enhanced_links'] = 0;
|
349 |
unset( $this->options['ga_tracking_code'] );
|
350 |
$flag = true;
|
351 |
}
|
352 |
+
if ( isset( $this->options['ga_dash_tableid'] ) ) { // v4.9
|
353 |
+
unset( $this->options['ga_dash_tableid'] );
|
354 |
+
$flag = true;
|
355 |
+
}
|
356 |
if ( isset( $this->options['ga_dash_frontend_keywords'] ) ) { // v4.8
|
357 |
unset( $this->options['ga_dash_frontend_keywords'] );
|
358 |
$flag = true;
|
368 |
$flag = true;
|
369 |
}
|
370 |
}
|
371 |
+
if ( ! isset( $this->options['ga_cookiedomain'] ) ) {
|
372 |
+
$this->options['ga_cookiedomain'] = '';
|
373 |
+
$flag = true;
|
374 |
+
}
|
375 |
+
if ( ! isset( $this->options['ga_cookiedomain'] ) ) { // v4.9
|
376 |
+
$this->options['ga_cookiedomain'] = '';
|
377 |
+
$flag = true;
|
378 |
+
}
|
379 |
+
if ( ! isset( $this->options['ga_cookiename'] ) ) { // v4.9
|
380 |
+
$this->options['ga_cookiename'] = '';
|
381 |
+
$flag = true;
|
382 |
+
}
|
383 |
+
if ( ! isset( $this->options['ga_cookieexpires'] ) ) { // v4.9
|
384 |
+
$this->options['ga_cookieexpires'] = '';
|
385 |
+
$flag = true;
|
386 |
+
}
|
387 |
+
|
388 |
if ( $flag ) {
|
389 |
$this->set_plugin_options( false );
|
390 |
}
|
front/ajax-actions.php
CHANGED
@@ -36,16 +36,16 @@ if ( ! class_exists( 'GADWP_Frontend_Ajax' ) ) {
|
|
36 |
*/
|
37 |
public function ajax_item_reports() {
|
38 |
|
39 |
-
if ( ! isset( $
|
40 |
wp_die( - 30 );
|
41 |
}
|
42 |
|
43 |
-
$from = $
|
44 |
-
$to = $
|
45 |
-
$query = $
|
46 |
-
$uri = $
|
47 |
|
48 |
-
$query = $
|
49 |
if ( ob_get_length() ) {
|
50 |
ob_clean();
|
51 |
}
|
@@ -109,11 +109,11 @@ if ( ! class_exists( 'GADWP_Frontend_Ajax' ) ) {
|
|
109 |
* @return string|int
|
110 |
*/
|
111 |
public function ajax_frontend_widget() {
|
112 |
-
if ( ! isset( $
|
113 |
wp_die( - 30 );
|
114 |
}
|
115 |
-
$widget_index = $
|
116 |
-
$option_name = $
|
117 |
$options = get_option( $option_name );
|
118 |
if ( isset( $options[$widget_index] ) ) {
|
119 |
$instance = $options[$widget_index];
|
36 |
*/
|
37 |
public function ajax_item_reports() {
|
38 |
|
39 |
+
if ( ! isset( $_POST['gadwp_security_frontend_item_reports'] ) || ! wp_verify_nonce( $_POST['gadwp_security_frontend_item_reports'], 'gadwp_frontend_item_reports' ) ) {
|
40 |
wp_die( - 30 );
|
41 |
}
|
42 |
|
43 |
+
$from = $_POST['from'];
|
44 |
+
$to = $_POST['to'];
|
45 |
+
$query = $_POST['query'];
|
46 |
+
$uri = $_POST['filter'];
|
47 |
|
48 |
+
$query = $_POST['query'];
|
49 |
if ( ob_get_length() ) {
|
50 |
ob_clean();
|
51 |
}
|
109 |
* @return string|int
|
110 |
*/
|
111 |
public function ajax_frontend_widget() {
|
112 |
+
if ( ! isset( $_POST['gadash_number'] ) || ! isset( $_POST['gadash_optionname'] ) || ! is_active_widget( false, false, 'gadash_frontend_widget' ) ) {
|
113 |
wp_die( - 30 );
|
114 |
}
|
115 |
+
$widget_index = $_POST['gadash_number'];
|
116 |
+
$option_name = $_POST['gadash_optionname'];
|
117 |
$options = get_option( $option_name );
|
118 |
if ( isset( $options[$widget_index] ) ) {
|
119 |
$instance = $options[$widget_index];
|
front/setup.php
CHANGED
@@ -37,9 +37,9 @@ if ( ! class_exists( 'GADWP_Frontend_Setup' ) ) {
|
|
37 |
|
38 |
if ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_front'] ) && $this->gadwp->config->options['frontend_item_reports'] ) {
|
39 |
|
40 |
-
wp_enqueue_style( 'gadwp-nprogress', GADWP_URL . '
|
41 |
|
42 |
-
wp_enqueue_style( '
|
43 |
|
44 |
$country_codes = GADWP_Tools::get_countrycodes();
|
45 |
if ( $this->gadwp->config->options['ga_target_geomap'] && isset( $country_codes[$this->gadwp->config->options['ga_target_geomap']] ) ) {
|
@@ -54,12 +54,12 @@ if ( ! class_exists( 'GADWP_Frontend_Setup' ) ) {
|
|
54 |
wp_register_script( 'googlejsapi', 'https://www.google.com/jsapi' );
|
55 |
}
|
56 |
|
57 |
-
wp_enqueue_script( 'gadwp-nprogress', GADWP_URL . '
|
58 |
|
59 |
-
wp_enqueue_script( '
|
60 |
|
61 |
/* @formatter:off */
|
62 |
-
wp_localize_script( '
|
63 |
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
64 |
'security' => wp_create_nonce( 'gadwp_frontend_item_reports' ),
|
65 |
'dateList' => array(
|
@@ -105,6 +105,7 @@ if ( ! class_exists( 'GADWP_Frontend_Setup' ) ) {
|
|
105 |
'region' => $region,
|
106 |
'language' => get_bloginfo( 'language' ),
|
107 |
'filter' => $_SERVER["REQUEST_URI"],
|
|
|
108 |
'scope' => 'front-item',
|
109 |
)
|
110 |
);
|
37 |
|
38 |
if ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_front'] ) && $this->gadwp->config->options['frontend_item_reports'] ) {
|
39 |
|
40 |
+
wp_enqueue_style( 'gadwp-nprogress', GADWP_URL . 'common/nprogress/nprogress.css', null, GADWP_CURRENT_VERSION );
|
41 |
|
42 |
+
wp_enqueue_style( 'gadwp-frontend-item-reports', GADWP_URL . 'front/css/item-reports.css', null, GADWP_CURRENT_VERSION );
|
43 |
|
44 |
$country_codes = GADWP_Tools::get_countrycodes();
|
45 |
if ( $this->gadwp->config->options['ga_target_geomap'] && isset( $country_codes[$this->gadwp->config->options['ga_target_geomap']] ) ) {
|
54 |
wp_register_script( 'googlejsapi', 'https://www.google.com/jsapi' );
|
55 |
}
|
56 |
|
57 |
+
wp_enqueue_script( 'gadwp-nprogress', GADWP_URL . 'common/nprogress/nprogress.js', array( 'jquery' ), GADWP_CURRENT_VERSION );
|
58 |
|
59 |
+
wp_enqueue_script( 'gadwp-frontend-item-reports', GADWP_URL . 'common/js/reports.js', array( 'gadwp-nprogress', 'googlejsapi', 'jquery', 'jquery-ui-dialog' ), GADWP_CURRENT_VERSION );
|
60 |
|
61 |
/* @formatter:off */
|
62 |
+
wp_localize_script( 'gadwp-frontend-item-reports', 'gadwp_item_data', array(
|
63 |
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
64 |
'security' => wp_create_nonce( 'gadwp_frontend_item_reports' ),
|
65 |
'dateList' => array(
|
105 |
'region' => $region,
|
106 |
'language' => get_bloginfo( 'language' ),
|
107 |
'filter' => $_SERVER["REQUEST_URI"],
|
108 |
+
'viewList' => false,
|
109 |
'scope' => 'front-item',
|
110 |
)
|
111 |
);
|
front/tracking/code-universal.php
CHANGED
@@ -29,8 +29,23 @@ if ( $this->gadwp->config->options['ga_crossdomain_tracking'] && $this->gadwp->c
|
|
29 |
$create_options .= "'allowLinker' : true";
|
30 |
}
|
31 |
$create_options .= '}';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
?>
|
33 |
-
ga('create', '<?php echo esc_html($profile[2]); ?>',
|
34 |
<?php if ($this->gadwp->config->options ['ga_crossdomain_tracking'] && $this->gadwp->config->options ['ga_crossdomain_list']!='') {?>
|
35 |
ga('require', 'linker');
|
36 |
<?php
|
@@ -96,4 +111,4 @@ if ( $this->gadwp->config->options['ga_dash_adsense'] ) {
|
|
96 |
|
97 |
window.google_analytics_uacct = "<?php echo esc_html($profile[2]); ?>";
|
98 |
<?php }?>
|
99 |
-
</script>
|
29 |
$create_options .= "'allowLinker' : true";
|
30 |
}
|
31 |
$create_options .= '}';
|
32 |
+
|
33 |
+
$options = "'auto'";
|
34 |
+
$optionsArray = array();
|
35 |
+
if ( !empty( $this->gadwp->config->options['ga_cookiedomain'] ) ) {
|
36 |
+
$optionsArray['cookieDomain'] = $this->gadwp->config->options['ga_cookiedomain'];
|
37 |
+
}
|
38 |
+
if ( !empty( $this->gadwp->config->options['ga_cookiename'] ) ) {
|
39 |
+
$optionsArray['cookieName'] = $this->gadwp->config->options['ga_cookiename'];
|
40 |
+
}
|
41 |
+
if ( !empty( $this->gadwp->config->options['ga_cookieexpires'] ) ) {
|
42 |
+
$optionsArray['cookieExpires'] = (int) $this->gadwp->config->options['ga_cookieexpires'];
|
43 |
+
}
|
44 |
+
if (!empty($optionsArray)) {
|
45 |
+
$options = json_encode($optionsArray);
|
46 |
+
}
|
47 |
?>
|
48 |
+
ga('create', '<?php echo esc_html($profile[2]); ?>', <?php echo $options; ?><?php if ($create_options != '{}') {?>, <?php echo $create_options; }?>);
|
49 |
<?php if ($this->gadwp->config->options ['ga_crossdomain_tracking'] && $this->gadwp->config->options ['ga_crossdomain_list']!='') {?>
|
50 |
ga('require', 'linker');
|
51 |
<?php
|
111 |
|
112 |
window.google_analytics_uacct = "<?php echo esc_html($profile[2]); ?>";
|
113 |
<?php }?>
|
114 |
+
</script>
|
front/widgets.php
CHANGED
@@ -26,8 +26,8 @@ final class GADWP_Frontend_Widget extends WP_Widget {
|
|
26 |
}
|
27 |
|
28 |
public function load_styles_scripts() {
|
29 |
-
wp_enqueue_style( '
|
30 |
-
wp_enqueue_script( '
|
31 |
wp_enqueue_script( 'googlejsapi', 'https://www.google.com/jsapi' );
|
32 |
}
|
33 |
|
26 |
}
|
27 |
|
28 |
public function load_styles_scripts() {
|
29 |
+
wp_enqueue_style( 'gadwp-front-widget', GADWP_URL . 'front/css/widgets.css', null, GADWP_CURRENT_VERSION );
|
30 |
+
wp_enqueue_script( 'gadwp-front-widget', GADWP_URL . 'front/js/widgets.js', array( 'jquery' ), GADWP_CURRENT_VERSION );
|
31 |
wp_enqueue_script( 'googlejsapi', 'https://www.google.com/jsapi' );
|
32 |
}
|
33 |
|
gadwp.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin URI: https://deconf.com
|
5 |
* Description: Displays Google Analytics Reports and Real-Time Statistics in your Dashboard. Automatically inserts the tracking code in every page of your website.
|
6 |
* Author: Alin Marcu
|
7 |
-
* Version: 4.
|
8 |
* Author URI: https://deconf.com
|
9 |
* Text Domain: google-analytics-dashboard-for-wp
|
10 |
* Domain Path: /languages
|
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) )
|
|
16 |
|
17 |
// Plugin Version
|
18 |
if ( ! defined( 'GADWP_CURRENT_VERSION' ) ) {
|
19 |
-
define( 'GADWP_CURRENT_VERSION', '4.
|
20 |
}
|
21 |
|
22 |
if ( ! class_exists( 'GADWP_Manager' ) ) {
|
4 |
* Plugin URI: https://deconf.com
|
5 |
* Description: Displays Google Analytics Reports and Real-Time Statistics in your Dashboard. Automatically inserts the tracking code in every page of your website.
|
6 |
* Author: Alin Marcu
|
7 |
+
* Version: 4.9
|
8 |
* Author URI: https://deconf.com
|
9 |
* Text Domain: google-analytics-dashboard-for-wp
|
10 |
* Domain Path: /languages
|
16 |
|
17 |
// Plugin Version
|
18 |
if ( ! defined( 'GADWP_CURRENT_VERSION' ) ) {
|
19 |
+
define( 'GADWP_CURRENT_VERSION', '4.9' );
|
20 |
}
|
21 |
|
22 |
if ( ! class_exists( 'GADWP_Manager' ) ) {
|
install/install.php
CHANGED
@@ -37,7 +37,6 @@ class GADWP_Install {
|
|
37 |
$options['ga_realtime_pages'] = 10;
|
38 |
$options['ga_dash_token'] = '';
|
39 |
$options['ga_dash_profile_list'] = array();
|
40 |
-
$options['ga_dash_tableid'] = '';
|
41 |
$options['ga_dash_frontend_keywords'] = 0;
|
42 |
$options['ga_tracking_code'] = '';
|
43 |
$options['ga_enhanced_links'] = 0;
|
@@ -60,6 +59,9 @@ class GADWP_Install {
|
|
60 |
$options['frontend_item_reports'] = 0;
|
61 |
$options['dashboard_widget'] = 1;
|
62 |
$options['api_backoff'] = 0;
|
|
|
|
|
|
|
63 |
} else {
|
64 |
$options = array();
|
65 |
$options['ga_dash_apikey'] = get_option( 'ga_dash_apikey' );
|
@@ -89,7 +91,6 @@ class GADWP_Install {
|
|
89 |
$options['ga_realtime_pages'] = get_option( 'ga_realtime_pages' );
|
90 |
$options['ga_dash_token'] = get_option( 'ga_dash_token' );
|
91 |
$options['ga_dash_profile_list'] = get_option( 'ga_dash_profile_list' );
|
92 |
-
$options['ga_dash_tableid'] = get_option( 'ga_dash_tableid' );
|
93 |
$options['ga_dash_frontend_keywords'] = 0;
|
94 |
$options['ga_enhanced_links'] = 0;
|
95 |
$options['ga_dash_remarketing'] = 0;
|
@@ -108,6 +109,9 @@ class GADWP_Install {
|
|
108 |
$options['frontend_item_reports'] = 0;
|
109 |
$options['dashboard_widget'] = 1;
|
110 |
$options['api_backoff'] = 0;
|
|
|
|
|
|
|
111 |
|
112 |
delete_option( 'ga_dash_apikey' );
|
113 |
delete_option( 'ga_dash_clientid' );
|
@@ -133,7 +137,6 @@ class GADWP_Install {
|
|
133 |
delete_option( 'ga_dash_token' );
|
134 |
delete_option( 'ga_dash_refresh_token' );
|
135 |
delete_option( 'ga_dash_profile_list' );
|
136 |
-
delete_option( 'ga_dash_tableid' );
|
137 |
}
|
138 |
add_option( 'gadash_options', json_encode( $options ) );
|
139 |
}
|
37 |
$options['ga_realtime_pages'] = 10;
|
38 |
$options['ga_dash_token'] = '';
|
39 |
$options['ga_dash_profile_list'] = array();
|
|
|
40 |
$options['ga_dash_frontend_keywords'] = 0;
|
41 |
$options['ga_tracking_code'] = '';
|
42 |
$options['ga_enhanced_links'] = 0;
|
59 |
$options['frontend_item_reports'] = 0;
|
60 |
$options['dashboard_widget'] = 1;
|
61 |
$options['api_backoff'] = 0;
|
62 |
+
$options['ga_cookiedomain'] = '';
|
63 |
+
$options['ga_cookiename'] = '';
|
64 |
+
$options['ga_cookieexpires'] = '';
|
65 |
} else {
|
66 |
$options = array();
|
67 |
$options['ga_dash_apikey'] = get_option( 'ga_dash_apikey' );
|
91 |
$options['ga_realtime_pages'] = get_option( 'ga_realtime_pages' );
|
92 |
$options['ga_dash_token'] = get_option( 'ga_dash_token' );
|
93 |
$options['ga_dash_profile_list'] = get_option( 'ga_dash_profile_list' );
|
|
|
94 |
$options['ga_dash_frontend_keywords'] = 0;
|
95 |
$options['ga_enhanced_links'] = 0;
|
96 |
$options['ga_dash_remarketing'] = 0;
|
109 |
$options['frontend_item_reports'] = 0;
|
110 |
$options['dashboard_widget'] = 1;
|
111 |
$options['api_backoff'] = 0;
|
112 |
+
$options['ga_cookiedomain'] = '';
|
113 |
+
$options['ga_cookiename'] = '';
|
114 |
+
$options['ga_cookieexpires'] = '';
|
115 |
|
116 |
delete_option( 'ga_dash_apikey' );
|
117 |
delete_option( 'ga_dash_clientid' );
|
137 |
delete_option( 'ga_dash_token' );
|
138 |
delete_option( 'ga_dash_refresh_token' );
|
139 |
delete_option( 'ga_dash_profile_list' );
|
|
|
140 |
}
|
141 |
add_option( 'gadash_options', json_encode( $options ) );
|
142 |
}
|
install/uninstall.php
CHANGED
@@ -27,5 +27,8 @@ class GADWP_Uninstall {
|
|
27 |
$sqlquery = $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'gadwp_cache_%%'" );
|
28 |
delete_option( 'gadash_options' );
|
29 |
}
|
|
|
|
|
|
|
30 |
}
|
31 |
}
|
27 |
$sqlquery = $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'gadwp_cache_%%'" );
|
28 |
delete_option( 'gadash_options' );
|
29 |
}
|
30 |
+
GADWP_Tools::unset_cookie( 'default_metric' );
|
31 |
+
GADWP_Tools::unset_cookie( 'default_dimension' );
|
32 |
+
GADWP_Tools::unset_cookie( 'default_view' );
|
33 |
}
|
34 |
}
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: deconf
|
|
3 |
Donate link: https://deconf.com/donate/
|
4 |
Tags: google,analytics,google analytics,dashboard,analytics dashboard,google analytics dashboard,google analytics plugin,google analytics widget,tracking,universal google analytics,realtime,multisite,gadwp
|
5 |
Requires at least: 3.5
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 4.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -108,7 +108,7 @@ You can submit pull requests, feature requests, translations or bug reports on [
|
|
108 |
|
109 |
= Documentation, Tutorials and FAQ =
|
110 |
|
111 |
-
For documentation, tutorials, FAQ and videos check out: [Google Analytics Dashboard for WP
|
112 |
|
113 |
== Screenshots ==
|
114 |
|
@@ -124,7 +124,7 @@ For documentation, tutorials, FAQ and videos check out: [Google Analytics Dashbo
|
|
124 |
|
125 |
== Localization ==
|
126 |
|
127 |
-
You can
|
128 |
|
129 |
== License ==
|
130 |
|
@@ -132,7 +132,21 @@ Google Analytics Dashboard for WP it's released under the GPLv2, you can use it
|
|
132 |
|
133 |
== Changelog ==
|
134 |
|
135 |
-
= 4.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
- Enhancement: switching to translate.wordpress.org, you can find [more details here](https://deconf.com/moving-translations-to-wordpress-org/)
|
137 |
|
138 |
= 4.8.2.1 =
|
3 |
Donate link: https://deconf.com/donate/
|
4 |
Tags: google,analytics,google analytics,dashboard,analytics dashboard,google analytics dashboard,google analytics plugin,google analytics widget,tracking,universal google analytics,realtime,multisite,gadwp
|
5 |
Requires at least: 3.5
|
6 |
+
Tested up to: 4.4
|
7 |
+
Stable tag: 4.9
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
108 |
|
109 |
= Documentation, Tutorials and FAQ =
|
110 |
|
111 |
+
For documentation, tutorials, FAQ and videos check out: [Google Analytics Dashboard for WP documentation](https://deconf.com/google-analytics-dashboard-wordpress/).
|
112 |
|
113 |
== Screenshots ==
|
114 |
|
124 |
|
125 |
== Localization ==
|
126 |
|
127 |
+
You can translate this plugin on [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/google-analytics-dashboard-for-wp).
|
128 |
|
129 |
== License ==
|
130 |
|
132 |
|
133 |
== Changelog ==
|
134 |
|
135 |
+
= 4.9 =
|
136 |
+
- Bug Fix: add an unique class to jQuery UI Tooltips to avoid conflicts
|
137 |
+
- Bug Fix: multiple CSS improvements
|
138 |
+
- Bug Fix: invalid localized date formats
|
139 |
+
- Bug Fix: switching between multisite modes doesn't propagate the new network status on all sites
|
140 |
+
- Bug Fix: Location Settings ignored in posts/pages reports
|
141 |
+
- Enhancement: unset cookies while revoking the authorization or clearing the cache
|
142 |
+
- Enhancement: no more page re-loads on admin dashboard widget when switching between reports
|
143 |
+
- Enhancement: unified reporting system with real-time capabilities
|
144 |
+
- Enhancement: new tracking options enabling you to customize cookieName, cookieDomain, cookieExpires; props by [Martins Sipenko](https://github.com/martinssipenko)
|
145 |
+
- Enhancement: display update notices only to admins and only on dashboard
|
146 |
+
- Enhancement: force language packs updates for all available languages on a Network
|
147 |
+
- Enhancement: added View switch capabilities
|
148 |
+
|
149 |
+
= 4.8.3 =
|
150 |
- Enhancement: switching to translate.wordpress.org, you can find [more details here](https://deconf.com/moving-translations-to-wordpress-org/)
|
151 |
|
152 |
= 4.8.2.1 =
|
tools/gapi.php
CHANGED
@@ -72,7 +72,7 @@ if ( ! class_exists( 'GADWP_GAPI_Controller' ) ) {
|
|
72 |
} catch ( Exception $e ) {
|
73 |
GADWP_Tools::set_cache( 'ga_dash_lasterror', date( 'Y-m-d H:i:s' ) . ': ' . esc_html( $e ), $this->error_timeout );
|
74 |
$this->reset_token();
|
75 |
-
}
|
76 |
if ( is_multisite() && $this->gadwp->config->options['ga_dash_network'] ) {
|
77 |
$this->gadwp->config->set_plugin_options( true );
|
78 |
} else {
|
@@ -223,7 +223,6 @@ if ( ! class_exists( 'GADWP_GAPI_Controller' ) ) {
|
|
223 |
public function reset_token( $all = true ) {
|
224 |
$this->gadwp->config->options['ga_dash_token'] = "";
|
225 |
if ( $all ) {
|
226 |
-
$this->gadwp->config->options['ga_dash_tableid'] = "";
|
227 |
$this->gadwp->config->options['ga_dash_tableid_jail'] = "";
|
228 |
$this->gadwp->config->options['ga_dash_profile_list'] = array();
|
229 |
try {
|
@@ -241,6 +240,9 @@ if ( ! class_exists( 'GADWP_GAPI_Controller' ) ) {
|
|
241 |
} else {
|
242 |
$this->gadwp->config->set_plugin_options();
|
243 |
}
|
|
|
|
|
|
|
244 |
}
|
245 |
|
246 |
/**
|
@@ -319,7 +321,6 @@ if ( ! class_exists( 'GADWP_GAPI_Controller' ) ) {
|
|
319 |
* @return array|int
|
320 |
*/
|
321 |
private function get_mainreport( $projectId, $from, $to, $query, $filter = '' ) {
|
322 |
-
$date_format = get_option( 'date_format' );
|
323 |
switch ( $query ) {
|
324 |
case 'users' :
|
325 |
$title = __( "Users", 'google-analytics-dashboard-for-wp' );
|
@@ -343,14 +344,13 @@ if ( ! class_exists( 'GADWP_GAPI_Controller' ) ) {
|
|
343 |
if ( $from == "today" || $from == "yesterday" ) {
|
344 |
$dimensions = 'ga:hour';
|
345 |
$dayorhour = __( "Hour", 'google-analytics-dashboard-for-wp' );
|
346 |
-
} else
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
}
|
354 |
$options = array( 'dimensions' => $dimensions, 'quotaUser' => $this->managequota . 'p' . $projectId );
|
355 |
if ( $filter ) {
|
356 |
$options['filters'] = 'ga:pagePath==' . $filter;
|
@@ -365,18 +365,21 @@ if ( ! class_exists( 'GADWP_GAPI_Controller' ) ) {
|
|
365 |
foreach ( $data->getRows() as $row ) {
|
366 |
$gadwp_data[] = array( (int) $row[0] . ':00', round( $row[1], 2 ) );
|
367 |
}
|
368 |
-
} else
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
} else {
|
375 |
-
foreach ( $data->getRows() as $row ) {
|
376 |
-
// $row[0] contains 'yyyyMMdd'
|
377 |
-
$gadwp_data[] = array( date_i18n( 'l, ' . $date_format, strtotime( $row[0] ) ), round( $row[2], 2 ) );
|
378 |
-
}
|
379 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
380 |
return $gadwp_data;
|
381 |
}
|
382 |
|
@@ -661,7 +664,6 @@ if ( ! class_exists( 'GADWP_GAPI_Controller' ) ) {
|
|
661 |
* @return array|int
|
662 |
*/
|
663 |
public function frontend_widget_stats( $projectId, $from, $anonim ) {
|
664 |
-
$date_format = get_option( 'date_format' );
|
665 |
$content = '';
|
666 |
$to = 'yesterday';
|
667 |
$metrics = 'ga:sessions';
|
@@ -681,7 +683,7 @@ if ( ! class_exists( 'GADWP_GAPI_Controller' ) ) {
|
|
681 |
$max = max( $max_array ) ? max( $max_array ) : 1;
|
682 |
}
|
683 |
foreach ( $data->getRows() as $row ) {
|
684 |
-
$gadwp_data[] = array( date_i18n( 'l, '
|
685 |
}
|
686 |
$totals = $data->getTotalsForAllResults();
|
687 |
return array( $gadwp_data, $anonim ? 0 : number_format_i18n( $totals['ga:sessions'] ) );
|
@@ -728,7 +730,7 @@ if ( ! class_exists( 'GADWP_GAPI_Controller' ) ) {
|
|
728 |
$gadwp_data->rows[$i] = array_map( 'esc_html', $row );
|
729 |
$i++;
|
730 |
}
|
731 |
-
return $gadwp_data;
|
732 |
}
|
733 |
|
734 |
private function map( $map ) {
|
72 |
} catch ( Exception $e ) {
|
73 |
GADWP_Tools::set_cache( 'ga_dash_lasterror', date( 'Y-m-d H:i:s' ) . ': ' . esc_html( $e ), $this->error_timeout );
|
74 |
$this->reset_token();
|
75 |
+
}
|
76 |
if ( is_multisite() && $this->gadwp->config->options['ga_dash_network'] ) {
|
77 |
$this->gadwp->config->set_plugin_options( true );
|
78 |
} else {
|
223 |
public function reset_token( $all = true ) {
|
224 |
$this->gadwp->config->options['ga_dash_token'] = "";
|
225 |
if ( $all ) {
|
|
|
226 |
$this->gadwp->config->options['ga_dash_tableid_jail'] = "";
|
227 |
$this->gadwp->config->options['ga_dash_profile_list'] = array();
|
228 |
try {
|
240 |
} else {
|
241 |
$this->gadwp->config->set_plugin_options();
|
242 |
}
|
243 |
+
GADWP_Tools::unset_cookie( 'default_metric' );
|
244 |
+
GADWP_Tools::unset_cookie( 'default_dimension' );
|
245 |
+
GADWP_Tools::unset_cookie( 'default_view' );
|
246 |
}
|
247 |
|
248 |
/**
|
321 |
* @return array|int
|
322 |
*/
|
323 |
private function get_mainreport( $projectId, $from, $to, $query, $filter = '' ) {
|
|
|
324 |
switch ( $query ) {
|
325 |
case 'users' :
|
326 |
$title = __( "Users", 'google-analytics-dashboard-for-wp' );
|
344 |
if ( $from == "today" || $from == "yesterday" ) {
|
345 |
$dimensions = 'ga:hour';
|
346 |
$dayorhour = __( "Hour", 'google-analytics-dashboard-for-wp' );
|
347 |
+
} else if ( $from == "365daysAgo" || $from == "1095daysAgo" ) {
|
348 |
+
$dimensions = 'ga:yearMonth, ga:month';
|
349 |
+
$dayorhour = __( "Date", 'google-analytics-dashboard-for-wp' );
|
350 |
+
} else {
|
351 |
+
$dimensions = 'ga:date,ga:dayOfWeekName';
|
352 |
+
$dayorhour = __( "Date", 'google-analytics-dashboard-for-wp' );
|
353 |
+
}
|
|
|
354 |
$options = array( 'dimensions' => $dimensions, 'quotaUser' => $this->managequota . 'p' . $projectId );
|
355 |
if ( $filter ) {
|
356 |
$options['filters'] = 'ga:pagePath==' . $filter;
|
365 |
foreach ( $data->getRows() as $row ) {
|
366 |
$gadwp_data[] = array( (int) $row[0] . ':00', round( $row[1], 2 ) );
|
367 |
}
|
368 |
+
} else if ( $from == "365daysAgo" || $from == "1095daysAgo" ) {
|
369 |
+
foreach ( $data->getRows() as $row ) {
|
370 |
+
/* translators:
|
371 |
+
* Example: 'F, Y' will become 'November, 2015'
|
372 |
+
* For details see: http://php.net/manual/en/function.date.php#refsect1-function.date-parameters */
|
373 |
+
$gadwp_data[] = array( date_i18n( __('F, Y'), strtotime( $row[0] . '01' ) ), round( $row[2], 2 ) );
|
|
|
|
|
|
|
|
|
|
|
374 |
}
|
375 |
+
} else {
|
376 |
+
foreach ( $data->getRows() as $row ) {
|
377 |
+
/* translators:
|
378 |
+
* Example: 'l, F j, Y' will become 'Thusday, November 17, 2015'
|
379 |
+
* For details see: http://php.net/manual/en/function.date.php#refsect1-function.date-parameters */
|
380 |
+
$gadwp_data[] = array( date_i18n( __( 'l, F j, Y' ), strtotime( $row[0] ) ), round( $row[2], 2 ) );
|
381 |
+
}
|
382 |
+
}
|
383 |
return $gadwp_data;
|
384 |
}
|
385 |
|
664 |
* @return array|int
|
665 |
*/
|
666 |
public function frontend_widget_stats( $projectId, $from, $anonim ) {
|
|
|
667 |
$content = '';
|
668 |
$to = 'yesterday';
|
669 |
$metrics = 'ga:sessions';
|
683 |
$max = max( $max_array ) ? max( $max_array ) : 1;
|
684 |
}
|
685 |
foreach ( $data->getRows() as $row ) {
|
686 |
+
$gadwp_data[] = array( date_i18n( __( 'l, F j, Y' ), strtotime( $row[0] ) ), ( $anonim ? round( $row[2] * 100 / $max, 2 ) : (int) $row[2] ) );
|
687 |
}
|
688 |
$totals = $data->getTotalsForAllResults();
|
689 |
return array( $gadwp_data, $anonim ? 0 : number_format_i18n( $totals['ga:sessions'] ) );
|
730 |
$gadwp_data->rows[$i] = array_map( 'esc_html', $row );
|
731 |
$i++;
|
732 |
}
|
733 |
+
return array( $gadwp_data );
|
734 |
}
|
735 |
|
736 |
private function map( $map ) {
|
tools/js/item-reports.js
DELETED
@@ -1,737 +0,0 @@
|
|
1 |
-
"use strict";
|
2 |
-
|
3 |
-
google.load( "visualization", "1", {
|
4 |
-
packages : [ "corechart", "table", "orgchart", "geochart" ],
|
5 |
-
'language' : gadwp_item_data.language
|
6 |
-
} );
|
7 |
-
|
8 |
-
//Get the numeric ID
|
9 |
-
gadwp_item_data.getID = function ( item ) {
|
10 |
-
if ( gadwp_item_data.scope == 'admin-item' ) {
|
11 |
-
if ( typeof item.id == "undefined" ) {
|
12 |
-
return 0
|
13 |
-
}
|
14 |
-
if ( item.id.split( '-' )[ 1 ] == "undefined" ) {
|
15 |
-
return 0;
|
16 |
-
} else {
|
17 |
-
return item.id.split( '-' )[ 1 ];
|
18 |
-
}
|
19 |
-
} else {
|
20 |
-
if ( typeof item.id == "undefined" ) {
|
21 |
-
return 1;
|
22 |
-
}
|
23 |
-
if ( item.id.split( '-' )[ 4 ] == "undefined" ) {
|
24 |
-
return 1;
|
25 |
-
} else {
|
26 |
-
return item.id.split( '-' )[ 4 ];
|
27 |
-
}
|
28 |
-
}
|
29 |
-
}
|
30 |
-
|
31 |
-
//Get the selector
|
32 |
-
gadwp_item_data.getSelector = function ( scope ) {
|
33 |
-
if ( scope == 'admin-item' ) {
|
34 |
-
return 'a[id^="gadwp-"]';
|
35 |
-
} else {
|
36 |
-
return 'li[id^="wp-admin-bar-gadwp"]';
|
37 |
-
}
|
38 |
-
}
|
39 |
-
|
40 |
-
gadwp_item_data.responsiveDialog = function () {
|
41 |
-
var visible = jQuery( ".ui-dialog:visible" );
|
42 |
-
// on each visible dialog
|
43 |
-
visible.each( function () {
|
44 |
-
var $this = jQuery( this );
|
45 |
-
var dialog = $this.find( ".ui-dialog-content" ).data( "ui-dialog" );
|
46 |
-
// on each fluid dialog
|
47 |
-
if ( dialog.options.fluid ) {
|
48 |
-
var wWidth = jQuery( window ).width();
|
49 |
-
// window width vs dialog width
|
50 |
-
if ( wWidth < ( parseInt( dialog.options.maxWidth ) + 50 ) ) {
|
51 |
-
// don't fill the entire screen
|
52 |
-
$this.css( "max-width", "90%" );
|
53 |
-
} else {
|
54 |
-
// maxWidth bug fix
|
55 |
-
$this.css( "max-width", dialog.options.maxWidth + "px" );
|
56 |
-
}
|
57 |
-
// change dialog position
|
58 |
-
dialog.option( "position", dialog.options.position );
|
59 |
-
}
|
60 |
-
} );
|
61 |
-
}
|
62 |
-
|
63 |
-
jQuery( document ).ready( function () {
|
64 |
-
jQuery( gadwp_item_data.getSelector( gadwp_item_data.scope ) ).click( function ( e ) {
|
65 |
-
if ( !jQuery( "#gadwp-window-" + gadwp_item_data.getID( this ) ).length > 0 ) {
|
66 |
-
jQuery( "body" ).append( '<div id="gadwp-window-' + gadwp_item_data.getID( this ) + '"></div>' );
|
67 |
-
}
|
68 |
-
jQuery( '#gadwp-window-' + gadwp_item_data.getID( this ) ).gadwpItemReport( gadwp_item_data.getID( this ) );
|
69 |
-
} );
|
70 |
-
|
71 |
-
// on window resize
|
72 |
-
jQuery( window ).resize( function () {
|
73 |
-
gadwp_item_data.responsiveDialog();
|
74 |
-
} );
|
75 |
-
|
76 |
-
// dialog width larger than viewport
|
77 |
-
jQuery( document ).on( "dialogopen", ".ui-dialog", function ( event, ui ) {
|
78 |
-
gadwp_item_data.responsiveDialog();
|
79 |
-
} );
|
80 |
-
} );
|
81 |
-
|
82 |
-
jQuery.fn.extend( {
|
83 |
-
gadwpItemReport : function ( item_id ) {
|
84 |
-
var slug = "-" + item_id;
|
85 |
-
var dialog_title;
|
86 |
-
|
87 |
-
var tools = {
|
88 |
-
set_cookie : function ( name, value ) {
|
89 |
-
var date_item = new Date();
|
90 |
-
date_item.setTime( date_item.getTime() + ( 24 * 60 * 60 * 1000 * 7 ) );
|
91 |
-
var expires = "expires=" + date_item.toUTCString();
|
92 |
-
document.cookie = "gadwp_ir_" + name + "=" + value + "; " + expires + "; path=/";
|
93 |
-
},
|
94 |
-
get_cookie : function ( name ) {
|
95 |
-
var name = "gadwp_ir_" + name + "=";
|
96 |
-
var cookies_array = document.cookie.split( ';' );
|
97 |
-
for ( var i = 0; i < cookies_array.length; i++ ) {
|
98 |
-
var cookie = cookies_array[ i ];
|
99 |
-
while ( cookie.charAt( 0 ) == ' ' )
|
100 |
-
cookie = cookie.substring( 1 );
|
101 |
-
if ( cookie.indexOf( name ) == 0 )
|
102 |
-
return cookie.substring( name.length, cookie.length );
|
103 |
-
}
|
104 |
-
return false;
|
105 |
-
},
|
106 |
-
escape : function ( str ) {
|
107 |
-
var div = document.createElement( 'div' );
|
108 |
-
div.appendChild( document.createTextNode( str ) );
|
109 |
-
return div.innerHTML;
|
110 |
-
},
|
111 |
-
}
|
112 |
-
|
113 |
-
var template = {
|
114 |
-
|
115 |
-
data : '<div id="gadwp-container' + slug + '"><select id="gadwp-sel-period' + slug + '"></select> <select id="gadwp-sel-report' + slug + '"></select><div id="gadwp-progressbar' + slug + '"></div><div id="gadwp-status' + slug + '"></div><div id="gadwp-reports' + slug + '"></div><div style="text-align:right;width:100%;font-size:0.8em;clear:both;margin-right:5px;margin-top:10px;">' + gadwp_item_data.i18n[ 14 ] + ' <a href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_report&utm_medium=link&utm_content=back_report&utm_campaign=gadwp" rel="nofollow" style="text-decoration:none;font-size:1em;">GADWP</a> </div></div>',
|
116 |
-
|
117 |
-
addOptions : function ( id, list ) {
|
118 |
-
var default_metric, default_dimension;
|
119 |
-
var output = [];
|
120 |
-
|
121 |
-
jQuery.each( list, function ( key, value ) {
|
122 |
-
if ( !tools.get_cookie( 'default_metric' ) || !tools.get_cookie( 'default_dimension' ) ) {
|
123 |
-
default_metric = 'uniquePageviews';
|
124 |
-
default_dimension = '30daysAgo';
|
125 |
-
} else {
|
126 |
-
default_metric = tools.get_cookie( 'default_metric' );
|
127 |
-
default_dimension = tools.get_cookie( 'default_dimension' );
|
128 |
-
}
|
129 |
-
|
130 |
-
if ( key == default_metric || key == default_dimension ) {
|
131 |
-
output.push( '<option value="' + key + '" selected="selected">' + value + '</option>' );
|
132 |
-
} else {
|
133 |
-
output.push( '<option value="' + key + '">' + value + '</option>' );
|
134 |
-
}
|
135 |
-
} );
|
136 |
-
jQuery( id ).html( output.join( '' ) );
|
137 |
-
},
|
138 |
-
|
139 |
-
init : function () {
|
140 |
-
if ( jQuery( '#gadwp-window' + slug ).html().length ) { // add main template once
|
141 |
-
return;
|
142 |
-
}
|
143 |
-
|
144 |
-
jQuery( '#gadwp-window' + slug ).append( this.data );
|
145 |
-
|
146 |
-
this.addOptions( '#gadwp-sel-period' + slug, gadwp_item_data.dateList );
|
147 |
-
this.addOptions( '#gadwp-sel-report' + slug, gadwp_item_data.reportList );
|
148 |
-
|
149 |
-
}
|
150 |
-
}
|
151 |
-
|
152 |
-
var reports = {
|
153 |
-
|
154 |
-
npcounter : 0,
|
155 |
-
prs : '',
|
156 |
-
trafficchannels : '',
|
157 |
-
trafficmediums : '',
|
158 |
-
traffictype : '',
|
159 |
-
trafficorganic : '',
|
160 |
-
socialnetworks : '',
|
161 |
-
locations : '',
|
162 |
-
mainchart : '',
|
163 |
-
bottomstats : '',
|
164 |
-
|
165 |
-
getTitle : function ( scope ) {
|
166 |
-
if ( scope == 'admin-item' ) {
|
167 |
-
return jQuery( '#gadwp' + slug ).attr( "title" );
|
168 |
-
} else {
|
169 |
-
return document.getElementsByTagName( "title" )[ 0 ].innerHTML;
|
170 |
-
}
|
171 |
-
},
|
172 |
-
|
173 |
-
alertMessage : function ( msg ) {
|
174 |
-
jQuery( "#gadwp-status" + slug ).css( {
|
175 |
-
"margin-top" : "3px",
|
176 |
-
"padding-left" : "5px",
|
177 |
-
"height" : "auto",
|
178 |
-
"color" : "#000",
|
179 |
-
"border-left" : "5px solid red"
|
180 |
-
} );
|
181 |
-
jQuery( "#gadwp-status" + slug ).html( msg );
|
182 |
-
},
|
183 |
-
|
184 |
-
drawprs : function ( gadwp_prs ) {
|
185 |
-
var data = google.visualization.arrayToDataTable( gadwp_prs );
|
186 |
-
var options = {
|
187 |
-
page : 'enable',
|
188 |
-
pageSize : 10,
|
189 |
-
width : '100%',
|
190 |
-
allowHtml : true
|
191 |
-
};
|
192 |
-
|
193 |
-
var chart = new google.visualization.Table( document.getElementById( 'gadwp-prs' + slug ) );
|
194 |
-
chart.draw( data, options );
|
195 |
-
},
|
196 |
-
|
197 |
-
drawtrafficchannels : function ( gadwp_trafficchannels ) {
|
198 |
-
var data = google.visualization.arrayToDataTable( gadwp_trafficchannels );
|
199 |
-
var options = {
|
200 |
-
allowCollapse : true,
|
201 |
-
allowHtml : true,
|
202 |
-
height : '100%'
|
203 |
-
};
|
204 |
-
|
205 |
-
var chart = new google.visualization.OrgChart( document.getElementById( 'gadwp-trafficchannels' + slug ) );
|
206 |
-
chart.draw( data, options );
|
207 |
-
},
|
208 |
-
|
209 |
-
drawtrafficmediums : function ( gadwp_trafficmediums ) {
|
210 |
-
var data = google.visualization.arrayToDataTable( gadwp_trafficmediums );
|
211 |
-
var options = {
|
212 |
-
is3D : false,
|
213 |
-
tooltipText : 'percentage',
|
214 |
-
legend : 'none',
|
215 |
-
chartArea : {
|
216 |
-
width : '99%',
|
217 |
-
height : '80%'
|
218 |
-
},
|
219 |
-
title : gadwp_item_data.i18n[ 1 ],
|
220 |
-
colors : gadwp_item_data.colorVariations
|
221 |
-
};
|
222 |
-
|
223 |
-
var chart = new google.visualization.PieChart( document.getElementById( 'gadwp-trafficmediums' + slug ) );
|
224 |
-
chart.draw( data, options );
|
225 |
-
},
|
226 |
-
|
227 |
-
drawtraffictype : function ( gadwp_traffictype ) {
|
228 |
-
var data = google.visualization.arrayToDataTable( gadwp_traffictype );
|
229 |
-
var options = {
|
230 |
-
is3D : false,
|
231 |
-
tooltipText : 'percentage',
|
232 |
-
legend : 'none',
|
233 |
-
chartArea : {
|
234 |
-
width : '99%',
|
235 |
-
height : '80%'
|
236 |
-
},
|
237 |
-
title : gadwp_item_data.i18n[ 2 ],
|
238 |
-
colors : gadwp_item_data.colorVariations
|
239 |
-
};
|
240 |
-
|
241 |
-
var chart = new google.visualization.PieChart( document.getElementById( 'gadwp-traffictype' + slug ) );
|
242 |
-
chart.draw( data, options );
|
243 |
-
},
|
244 |
-
|
245 |
-
drawsocialnetworks : function ( gadwp_socialnetworks ) {
|
246 |
-
var data = google.visualization.arrayToDataTable( gadwp_socialnetworks );
|
247 |
-
var options = {
|
248 |
-
is3D : false,
|
249 |
-
tooltipText : 'percentage',
|
250 |
-
legend : 'none',
|
251 |
-
chartArea : {
|
252 |
-
width : '99%',
|
253 |
-
height : '80%'
|
254 |
-
},
|
255 |
-
title : gadwp_item_data.i18n[ 3 ],
|
256 |
-
colors : gadwp_item_data.colorVariations
|
257 |
-
};
|
258 |
-
|
259 |
-
var chart = new google.visualization.PieChart( document.getElementById( 'gadwp-socialnetworks' + slug ) );
|
260 |
-
chart.draw( data, options );
|
261 |
-
},
|
262 |
-
|
263 |
-
drawtrafficorganic : function ( gadwp_trafficorganic ) {
|
264 |
-
var data = google.visualization.arrayToDataTable( gadwp_trafficorganic );
|
265 |
-
var options = {
|
266 |
-
is3D : false,
|
267 |
-
tooltipText : 'percentage',
|
268 |
-
legend : 'none',
|
269 |
-
chartArea : {
|
270 |
-
width : '99%',
|
271 |
-
height : '80%'
|
272 |
-
},
|
273 |
-
title : gadwp_item_data.i18n[ 4 ],
|
274 |
-
colors : gadwp_item_data.colorVariations
|
275 |
-
};
|
276 |
-
|
277 |
-
var chart = new google.visualization.PieChart( document.getElementById( 'gadwp-trafficorganic' + slug ) );
|
278 |
-
chart.draw( data, options );
|
279 |
-
},
|
280 |
-
|
281 |
-
drawlocations : function ( gadwp_locations ) {
|
282 |
-
var data = google.visualization.arrayToDataTable( gadwp_locations );
|
283 |
-
var options = {
|
284 |
-
page : 'enable',
|
285 |
-
pageSize : 10,
|
286 |
-
width : '100%'
|
287 |
-
};
|
288 |
-
|
289 |
-
var chart = new google.visualization.Table( document.getElementById( 'gadwp-locations' + slug ) );
|
290 |
-
chart.draw( data, options );
|
291 |
-
},
|
292 |
-
|
293 |
-
drawmaplocations : function ( gadwp_locations ) {
|
294 |
-
|
295 |
-
var data = google.visualization.arrayToDataTable( gadwp_locations );
|
296 |
-
|
297 |
-
var options = {
|
298 |
-
chartArea : {
|
299 |
-
width : '99%',
|
300 |
-
height : '90%'
|
301 |
-
},
|
302 |
-
colors : [ gadwp_item_data.colorVariations[ 5 ], gadwp_item_data.colorVariations[ 4 ] ],
|
303 |
-
}
|
304 |
-
|
305 |
-
if ( gadwp_item_data.region ) {
|
306 |
-
options.region = gadwp_item_data.region;
|
307 |
-
options.displayMode = 'markers';
|
308 |
-
options.datalessRegionColor = 'EFEFEF';
|
309 |
-
}
|
310 |
-
|
311 |
-
var chart = new google.visualization.GeoChart( document.getElementById( 'gadwp-map' + slug ) );
|
312 |
-
chart.draw( data, options );
|
313 |
-
},
|
314 |
-
|
315 |
-
drawmainchart : function ( gadwp_mainchart, format ) {
|
316 |
-
|
317 |
-
var data = google.visualization.arrayToDataTable( gadwp_mainchart );
|
318 |
-
|
319 |
-
if ( format ) {
|
320 |
-
var formatter = new google.visualization.NumberFormat( {
|
321 |
-
suffix : '%',
|
322 |
-
fractionDigits : 2
|
323 |
-
} );
|
324 |
-
|
325 |
-
formatter.format( data, 1 );
|
326 |
-
}
|
327 |
-
|
328 |
-
var options = {
|
329 |
-
legend : {
|
330 |
-
position : 'none'
|
331 |
-
},
|
332 |
-
pointSize : 3,
|
333 |
-
colors : [ gadwp_item_data.colorVariations[ 0 ], gadwp_item_data.colorVariations[ 4 ] ],
|
334 |
-
chartArea : {
|
335 |
-
width : '99%',
|
336 |
-
height : '90%'
|
337 |
-
},
|
338 |
-
vAxis : {
|
339 |
-
textPosition : "in",
|
340 |
-
minValue : 0
|
341 |
-
},
|
342 |
-
hAxis : {
|
343 |
-
textPosition : 'none'
|
344 |
-
}
|
345 |
-
};
|
346 |
-
var chart = new google.visualization.AreaChart( document.getElementById( 'gadwp-mainchart' + slug ) );
|
347 |
-
chart.draw( data, options );
|
348 |
-
},
|
349 |
-
|
350 |
-
drawbottomstats : function ( gadwp_bottomstats ) {
|
351 |
-
jQuery( "#gdsessions" + slug ).text( gadwp_bottomstats[ 0 ] );
|
352 |
-
jQuery( "#gdusers" + slug ).text( gadwp_bottomstats[ 1 ] );
|
353 |
-
jQuery( "#gdpageviews" + slug ).text( gadwp_bottomstats[ 2 ] );
|
354 |
-
jQuery( "#gdbouncerate" + slug ).text( gadwp_bottomstats[ 3 ] + "%" );
|
355 |
-
jQuery( "#gdorganicsearch" + slug ).text( gadwp_bottomstats[ 4 ] );
|
356 |
-
jQuery( "#gdpagespervisit" + slug ).text( gadwp_bottomstats[ 5 ] );
|
357 |
-
},
|
358 |
-
|
359 |
-
throwDebug : function ( response ) {
|
360 |
-
jQuery( "#gadwp-status" + slug ).css( {
|
361 |
-
"margin-top" : "3px",
|
362 |
-
"padding-left" : "5px",
|
363 |
-
"height" : "auto",
|
364 |
-
"color" : "#000",
|
365 |
-
"border-left" : "5px solid red"
|
366 |
-
} );
|
367 |
-
if ( response == '-24' ) {
|
368 |
-
jQuery( "#gadwp-status" + slug ).html( gadwp_item_data.i18n[ 15 ] );
|
369 |
-
} else {
|
370 |
-
jQuery( "#gadwp-status" + slug ).html( gadwp_item_data.i18n[ 11 ] );
|
371 |
-
console.log( "\n********************* GADWP Log ********************* \n\n" + response );
|
372 |
-
}
|
373 |
-
},
|
374 |
-
|
375 |
-
throwError : function ( target, response, p ) {
|
376 |
-
jQuery( target ).css( {
|
377 |
-
"background-color" : "#F7F7F7",
|
378 |
-
"height" : "auto",
|
379 |
-
"padding-top" : p,
|
380 |
-
"padding-bottom" : p,
|
381 |
-
"color" : "#000",
|
382 |
-
"text-align" : "center"
|
383 |
-
} );
|
384 |
-
if ( response == -21 ) {
|
385 |
-
jQuery( target ).html( gadwp_item_data.i18n[ 12 ] + ' (' + response + ')' );
|
386 |
-
} else {
|
387 |
-
jQuery( target ).html( gadwp_item_data.i18n[ 13 ] + ' (' + response + ')' );
|
388 |
-
}
|
389 |
-
},
|
390 |
-
|
391 |
-
render : function ( period, query ) {
|
392 |
-
var from, to;
|
393 |
-
|
394 |
-
jQuery( '#gadwp-status' + slug ).html( '' );
|
395 |
-
switch ( period ) {
|
396 |
-
case 'today':
|
397 |
-
from = 'today';
|
398 |
-
to = 'today';
|
399 |
-
break;
|
400 |
-
case 'yesterday':
|
401 |
-
from = 'yesterday';
|
402 |
-
to = 'yesterday';
|
403 |
-
break;
|
404 |
-
case '7daysAgo':
|
405 |
-
from = '7daysAgo';
|
406 |
-
to = 'yesterday';
|
407 |
-
break;
|
408 |
-
case '14daysAgo':
|
409 |
-
from = '14daysAgo';
|
410 |
-
to = 'yesterday';
|
411 |
-
break;
|
412 |
-
case '90daysAgo':
|
413 |
-
from = '90daysAgo';
|
414 |
-
to = 'yesterday';
|
415 |
-
break;
|
416 |
-
case '365daysAgo':
|
417 |
-
from = '365daysAgo';
|
418 |
-
to = 'yesterday';
|
419 |
-
break;
|
420 |
-
case '1095daysAgo':
|
421 |
-
from = '1095daysAgo';
|
422 |
-
to = 'yesterday';
|
423 |
-
break;
|
424 |
-
default:
|
425 |
-
from = '30daysAgo';
|
426 |
-
to = 'yesterday';
|
427 |
-
break;
|
428 |
-
}
|
429 |
-
|
430 |
-
tools.set_cookie( 'default_metric', query );
|
431 |
-
tools.set_cookie( 'default_dimension', period );
|
432 |
-
|
433 |
-
if ( gadwp_item_data.scope == 'admin-item' ) {
|
434 |
-
var data = {
|
435 |
-
action : 'gadwp_backend_item_reports',
|
436 |
-
gadwp_security_backend_item_reports : gadwp_item_data.security,
|
437 |
-
from : from,
|
438 |
-
to : to,
|
439 |
-
filter : item_id,
|
440 |
-
}
|
441 |
-
} else {
|
442 |
-
var data = {
|
443 |
-
action : 'gadwp_frontend_item_reports',
|
444 |
-
gadwp_security_frontend_item_reports : gadwp_item_data.security,
|
445 |
-
from : from,
|
446 |
-
to : to,
|
447 |
-
filter : gadwp_item_data.filter,
|
448 |
-
}
|
449 |
-
}
|
450 |
-
|
451 |
-
if ( jQuery.inArray( query, [ 'referrers', 'contentpages', 'searches' ] ) > -1 ) {
|
452 |
-
|
453 |
-
jQuery( '#gadwp-reports' + slug ).html( '<div id="gadwp-trafficchannels' + slug + '"></div>' );
|
454 |
-
jQuery( '#gadwp-reports' + slug ).append( '<div id="gadwp-prs' + slug + '"></div>' );
|
455 |
-
jQuery( '#gadwp-reports' + slug ).hide();
|
456 |
-
|
457 |
-
data.query = 'trafficchannels,' + query;
|
458 |
-
|
459 |
-
jQuery.post( gadwp_item_data.ajaxurl, data, function ( response ) {
|
460 |
-
if ( jQuery.isArray( response ) ) {
|
461 |
-
if ( !jQuery.isNumeric( response[ 0 ] ) ) {
|
462 |
-
if ( jQuery.isArray( response[ 0 ] ) ) {
|
463 |
-
jQuery( '#gadwp-reports' + slug ).show();
|
464 |
-
reports.trafficchannels = response[ 0 ];
|
465 |
-
google.setOnLoadCallback( reports.drawtrafficchannels( reports.trafficchannels ) );
|
466 |
-
} else {
|
467 |
-
reports.throwDebug( response[ 0 ] );
|
468 |
-
}
|
469 |
-
} else {
|
470 |
-
jQuery( '#gadwp-reports' + slug ).show();
|
471 |
-
reports.throwError( '#gadwp-trafficchannels' + slug, response[ 0 ], "125px" );
|
472 |
-
}
|
473 |
-
|
474 |
-
if ( !jQuery.isNumeric( response[ 1 ] ) ) {
|
475 |
-
if ( jQuery.isArray( response[ 1 ] ) ) {
|
476 |
-
reports.prs = response[ 1 ];
|
477 |
-
google.setOnLoadCallback( reports.drawprs( reports.prs ) );
|
478 |
-
} else {
|
479 |
-
reports.throwDebug( response[ 1 ] );
|
480 |
-
}
|
481 |
-
} else {
|
482 |
-
reports.throwError( '#gadwp-prs' + slug, response[ 1 ], "125px" );
|
483 |
-
}
|
484 |
-
} else {
|
485 |
-
reports.throwDebug( response );
|
486 |
-
}
|
487 |
-
NProgress.done();
|
488 |
-
} );
|
489 |
-
|
490 |
-
} else if ( query == 'trafficdetails' ) {
|
491 |
-
|
492 |
-
jQuery( '#gadwp-reports' + slug ).html( '<div id="gadwp-trafficchannels' + slug + '"></div>' );
|
493 |
-
jQuery( '#gadwp-reports' + slug ).append( '<div class="gadwp-floatwraper"><div id="gadwp-trafficmediums' + slug + '"></div><div id="gadwp-traffictype' + slug + '"></div></div>' );
|
494 |
-
jQuery( '#gadwp-reports' + slug ).append( '<div class="gadwp-floatwraper"><div id="gadwp-trafficorganic' + slug + '"></div><div id="gadwp-socialnetworks' + slug + '"></div></div>' );
|
495 |
-
jQuery( '#gadwp-reports' + slug ).hide();
|
496 |
-
|
497 |
-
data.query = 'trafficchannels,medium,visitorType,source,socialNetwork';
|
498 |
-
|
499 |
-
jQuery.post( gadwp_item_data.ajaxurl, data, function ( response ) {
|
500 |
-
if ( jQuery.isArray( response ) ) {
|
501 |
-
if ( !jQuery.isNumeric( response[ 0 ] ) ) {
|
502 |
-
if ( jQuery.isArray( response[ 0 ] ) ) {
|
503 |
-
jQuery( '#gadwp-reports' + slug ).show();
|
504 |
-
reports.trafficchannels = response[ 0 ];
|
505 |
-
google.setOnLoadCallback( reports.drawtrafficchannels( reports.trafficchannels ) );
|
506 |
-
} else {
|
507 |
-
reports.throwDebug( response[ 0 ] );
|
508 |
-
}
|
509 |
-
} else {
|
510 |
-
jQuery( '#gadwp-reports' + slug ).show();
|
511 |
-
reports.throwError( '#gadwp-trafficchannels' + slug, response[ 0 ], "125px" );
|
512 |
-
}
|
513 |
-
|
514 |
-
if ( !jQuery.isNumeric( response[ 1 ] ) ) {
|
515 |
-
if ( jQuery.isArray( response[ 1 ] ) ) {
|
516 |
-
jQuery( '#gadwp-reports' + slug ).show();
|
517 |
-
reports.trafficmediums = response[ 1 ];
|
518 |
-
google.setOnLoadCallback( reports.drawtrafficmediums( reports.trafficmediums ) );
|
519 |
-
} else {
|
520 |
-
reports.throwDebug( response[ 1 ] );
|
521 |
-
}
|
522 |
-
} else {
|
523 |
-
jQuery( '#gadwp-reports' + slug ).show();
|
524 |
-
reports.throwError( '#gadwp-trafficmediums' + slug, response[ 1 ], "80px" );
|
525 |
-
}
|
526 |
-
|
527 |
-
if ( !jQuery.isNumeric( response[ 2 ] ) ) {
|
528 |
-
if ( jQuery.isArray( response[ 2 ] ) ) {
|
529 |
-
jQuery( '#gadwp-reports' + slug ).show();
|
530 |
-
reports.traffictype = response[ 2 ];
|
531 |
-
google.setOnLoadCallback( reports.drawtraffictype( reports.traffictype ) );
|
532 |
-
} else {
|
533 |
-
reports.throwDebug( response[ 2 ] );
|
534 |
-
}
|
535 |
-
} else {
|
536 |
-
jQuery( '#gadwp-reports' + slug ).show();
|
537 |
-
reports.throwError( '#gadwp-traffictype' + slug, response[ 2 ], "80px" );
|
538 |
-
}
|
539 |
-
|
540 |
-
if ( !jQuery.isNumeric( response[ 3 ] ) ) {
|
541 |
-
if ( jQuery.isArray( response[ 3 ] ) ) {
|
542 |
-
jQuery( '#gadwp-reports' + slug ).show();
|
543 |
-
reports.trafficorganic = response[ 3 ];
|
544 |
-
google.setOnLoadCallback( reports.drawtrafficorganic( reports.trafficorganic ) );
|
545 |
-
} else {
|
546 |
-
reports.throwDebug( response[ 3 ] );
|
547 |
-
}
|
548 |
-
} else {
|
549 |
-
jQuery( '#gadwp-reports' + slug ).show();
|
550 |
-
reports.throwError( '#gadwp-trafficorganic' + slug, response[ 3 ], "80px" );
|
551 |
-
}
|
552 |
-
|
553 |
-
if ( !jQuery.isNumeric( response[ 4 ] ) ) {
|
554 |
-
if ( jQuery.isArray( response[ 4 ] ) ) {
|
555 |
-
jQuery( '#gadwp-reports' + slug ).show();
|
556 |
-
reports.socialnetworks = response[ 4 ];
|
557 |
-
google.setOnLoadCallback( reports.drawsocialnetworks( reports.socialnetworks ) );
|
558 |
-
} else {
|
559 |
-
reports.throwDebug( response[ 4 ] );
|
560 |
-
}
|
561 |
-
} else {
|
562 |
-
jQuery( '#gadwp-reports' + slug ).show();
|
563 |
-
reports.throwError( '#gadwp-socialnetworks' + slug, response[ 4 ], "80px" );
|
564 |
-
}
|
565 |
-
} else {
|
566 |
-
reports.throwDebug( response );
|
567 |
-
}
|
568 |
-
NProgress.done();
|
569 |
-
} );
|
570 |
-
|
571 |
-
} else if ( query == 'locations' ) {
|
572 |
-
|
573 |
-
jQuery( '#gadwp-reports' + slug ).html( '<div id="gadwp-map' + slug + '"></div>' )
|
574 |
-
jQuery( '#gadwp-reports' + slug ).append( '<div id="gadwp-locations' + slug + '"></div>' );
|
575 |
-
jQuery( '#gadwp-reports' + slug ).hide();
|
576 |
-
|
577 |
-
data.query = query;
|
578 |
-
|
579 |
-
jQuery.post( gadwp_item_data.ajaxurl, data, function ( response ) {
|
580 |
-
if ( jQuery.isArray( response ) ) {
|
581 |
-
if ( !jQuery.isNumeric( response[ 0 ] ) ) {
|
582 |
-
if ( jQuery.isArray( response[ 0 ] ) ) {
|
583 |
-
jQuery( '#gadwp-reports' + slug ).show();
|
584 |
-
reports.locations = response[ 0 ];
|
585 |
-
google.setOnLoadCallback( reports.drawmaplocations( reports.locations ) );
|
586 |
-
google.setOnLoadCallback( reports.drawlocations( reports.locations ) );
|
587 |
-
} else {
|
588 |
-
reports.throwDebug( response[ 0 ] );
|
589 |
-
}
|
590 |
-
} else {
|
591 |
-
jQuery( '#gadwp-reports' + slug ).show();
|
592 |
-
reports.throwError( '#gadwp-map' + slug, response[ 0 ], "125px" );
|
593 |
-
reports.throwError( '#gadwp-locations' + slug, response[ 0 ], "125px" );
|
594 |
-
}
|
595 |
-
} else {
|
596 |
-
reports.throwDebug( response );
|
597 |
-
}
|
598 |
-
NProgress.done();
|
599 |
-
} );
|
600 |
-
|
601 |
-
} else {
|
602 |
-
|
603 |
-
jQuery( '#gadwp-reports' + slug ).html( '<div id="gadwp-mainchart' + slug + '"></div>' )
|
604 |
-
jQuery( '#gadwp-reports' + slug ).append( '<div id="gadwp-bottomstats' + slug + '" class="gadwp-wrapper"><div class="inside"><div class="small-box"><h3>' + gadwp_item_data.i18n[ 5 ] + '</h3><p id="gdsessions' + slug + '"> </p></div><div class="small-box"><h3>' + gadwp_item_data.i18n[ 6 ] + '</h3><p id="gdusers' + slug + '"> </p></div><div class="small-box"><h3>' + gadwp_item_data.i18n[ 7 ] + '</h3><p id="gdpageviews' + slug + '"> </p></div><div class="small-box"><h3>' + gadwp_item_data.i18n[ 8 ] + '</h3><p id="gdbouncerate' + slug + '"> </p></div><div class="small-box"><h3>' + gadwp_item_data.i18n[ 9 ] + '</h3><p id="gdorganicsearch' + slug + '"> </p></div><div class="small-box"><h3>' + gadwp_item_data.i18n[ 10 ] + '</h3><p id="gdpagespervisit' + slug + '"> </p></div></div></div>' );
|
605 |
-
jQuery( '#gadwp-reports' + slug ).hide();
|
606 |
-
|
607 |
-
data.query = query + ',bottomstats';
|
608 |
-
|
609 |
-
jQuery.post( gadwp_item_data.ajaxurl, data, function ( response ) {
|
610 |
-
if ( jQuery.isArray( response ) ) {
|
611 |
-
if ( !jQuery.isNumeric( response[ 0 ] ) ) {
|
612 |
-
if ( jQuery.isArray( response[ 0 ] ) ) {
|
613 |
-
jQuery( '#gadwp-reports' + slug ).show();
|
614 |
-
reports.mainchart = response[ 0 ];
|
615 |
-
if ( query == 'visitBounceRate' ) {
|
616 |
-
google.setOnLoadCallback( reports.drawmainchart( reports.mainchart, true ) );
|
617 |
-
} else {
|
618 |
-
google.setOnLoadCallback( reports.drawmainchart( reports.mainchart, false ) );
|
619 |
-
}
|
620 |
-
} else {
|
621 |
-
reports.throwDebug( response[ 0 ] );
|
622 |
-
}
|
623 |
-
} else {
|
624 |
-
jQuery( '#gadwp-reports' + slug ).show();
|
625 |
-
reports.throwError( '#gadwp-mainchart' + slug, response[ 0 ], "125px" );
|
626 |
-
}
|
627 |
-
if ( !jQuery.isNumeric( response[ 1 ] ) ) {
|
628 |
-
if ( jQuery.isArray( response[ 1 ] ) ) {
|
629 |
-
jQuery( '#gadwp-reports' + slug ).show();
|
630 |
-
reports.bottomstats = response[ 1 ];
|
631 |
-
google.setOnLoadCallback( reports.drawbottomstats( reports.bottomstats ) );
|
632 |
-
} else {
|
633 |
-
reports.throwDebug( response[ 1 ] );
|
634 |
-
}
|
635 |
-
} else {
|
636 |
-
jQuery( '#gadwp-reports' + slug ).show();
|
637 |
-
reports.throwError( '#gadwp-bottomstats' + slug, response[ 1 ], "40px" );
|
638 |
-
}
|
639 |
-
} else {
|
640 |
-
reports.throwDebug( response );
|
641 |
-
}
|
642 |
-
NProgress.done();
|
643 |
-
} );
|
644 |
-
|
645 |
-
}
|
646 |
-
|
647 |
-
},
|
648 |
-
|
649 |
-
refresh : function () {
|
650 |
-
if ( jQuery( '#gadwp-bottomstats' + slug ).length > 0 ) {
|
651 |
-
this.drawbottomstats( this.bottomstats );
|
652 |
-
}
|
653 |
-
if ( jQuery( '#gadwp-mainchart' + slug ).length > 0 && jQuery.isArray( this.mainchart ) ) {
|
654 |
-
this.drawmainchart( this.mainchart );
|
655 |
-
}
|
656 |
-
if ( jQuery( '#gadwp-map' + slug ).length > 0 && jQuery.isArray( this.locations ) ) {
|
657 |
-
this.drawmaplocations( this.locations );
|
658 |
-
}
|
659 |
-
if ( jQuery( '#gadwp-locations' + slug ).length > 0 && jQuery.isArray( this.locations ) ) {
|
660 |
-
this.drawlocations( this.locations );
|
661 |
-
}
|
662 |
-
if ( jQuery( '#gadwp-socialnetworks' + slug ).length > 0 && jQuery.isArray( this.socialnetworks ) ) {
|
663 |
-
this.drawsocialnetworks( this.socialnetworks );
|
664 |
-
}
|
665 |
-
if ( jQuery( '#gadwp-trafficorganic' + slug ).length > 0 && jQuery.isArray( this.trafficorganic ) ) {
|
666 |
-
this.drawtrafficorganic( this.trafficorganic );
|
667 |
-
}
|
668 |
-
if ( jQuery( '#gadwp-traffictype' + slug ).length > 0 && jQuery.isArray( this.traffictype ) ) {
|
669 |
-
this.drawtraffictype( this.traffictype );
|
670 |
-
}
|
671 |
-
if ( jQuery( '#gadwp-trafficmediums' + slug ).length > 0 && jQuery.isArray( this.trafficmediums ) ) {
|
672 |
-
this.drawtrafficmediums( this.trafficmediums );
|
673 |
-
}
|
674 |
-
if ( jQuery( '#gadwp-trafficchannels' + slug ).length > 0 && jQuery.isArray( this.trafficchannels ) ) {
|
675 |
-
this.drawtrafficchannels( this.trafficchannels );
|
676 |
-
}
|
677 |
-
if ( jQuery( '#gadwp-prs' + slug ).length > 0 && jQuery.isArray( this.prs ) ) {
|
678 |
-
this.drawprs( this.prs );
|
679 |
-
}
|
680 |
-
},
|
681 |
-
|
682 |
-
init : function () {
|
683 |
-
|
684 |
-
if ( jQuery( "#gadwp-reports" + slug ).html().length ) { // only when report is empty
|
685 |
-
return;
|
686 |
-
}
|
687 |
-
|
688 |
-
try {
|
689 |
-
NProgress.configure( {
|
690 |
-
parent : "#gadwp-progressbar" + slug,
|
691 |
-
showSpinner : false
|
692 |
-
} );
|
693 |
-
NProgress.start();
|
694 |
-
} catch ( e ) {
|
695 |
-
this.alertMessage( gadwp_item_data.i18n[ 0 ] );
|
696 |
-
}
|
697 |
-
|
698 |
-
this.render( jQuery( '#gadwp-sel-period' + slug ).val(), jQuery( '#gadwp-sel-report' + slug ).val() );
|
699 |
-
|
700 |
-
jQuery( window ).resize( function () {
|
701 |
-
reports.refresh();
|
702 |
-
} );
|
703 |
-
}
|
704 |
-
}
|
705 |
-
|
706 |
-
template.init();
|
707 |
-
|
708 |
-
reports.init();
|
709 |
-
|
710 |
-
jQuery( '#gadwp-sel-period' + slug ).change( function () {
|
711 |
-
jQuery( '#gadwp-reports' + slug ).html( '' );
|
712 |
-
reports.init();
|
713 |
-
} );
|
714 |
-
|
715 |
-
jQuery( '#gadwp-sel-report' + slug ).change( function () {
|
716 |
-
jQuery( '#gadwp-reports' + slug ).html( '' );
|
717 |
-
reports.init();
|
718 |
-
} );
|
719 |
-
|
720 |
-
return this.dialog( {
|
721 |
-
width : 'auto',
|
722 |
-
maxWidth : 510,
|
723 |
-
height : 'auto',
|
724 |
-
modal : true,
|
725 |
-
fluid : true,
|
726 |
-
dialogClass : 'gadwp wp-dialog',
|
727 |
-
resizable : false,
|
728 |
-
title : reports.getTitle( gadwp_item_data.scope ),
|
729 |
-
position : {
|
730 |
-
my : "top",
|
731 |
-
at : "top+100",
|
732 |
-
of : window
|
733 |
-
}
|
734 |
-
} );
|
735 |
-
|
736 |
-
}
|
737 |
-
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tools/tools.php
CHANGED
@@ -111,22 +111,10 @@ if ( ! class_exists( 'GADWP_Tools' ) ) {
|
|
111 |
}
|
112 |
}
|
113 |
|
114 |
-
public static function set_cookie( $name, $value ) {
|
115 |
-
$name = 'gadwp_' . $name;
|
116 |
-
setcookie( $name, $value, time() + 60 * 60 * 24 * 7, '/' );
|
117 |
-
}
|
118 |
-
|
119 |
-
public static function get_cookie( $name ) {
|
120 |
-
$name = 'gadwp_' . $name;
|
121 |
-
if ( isset( $_COOKIE[$name] ) ) {
|
122 |
-
return $_COOKIE[$name];
|
123 |
-
} else {
|
124 |
-
return false;
|
125 |
-
}
|
126 |
-
}
|
127 |
-
|
128 |
public static function unset_cookie( $name ) {
|
129 |
-
$name = '
|
|
|
|
|
130 |
setcookie( $name, '', time() - 3600, '/' );
|
131 |
}
|
132 |
|
@@ -180,6 +168,9 @@ if ( ! class_exists( 'GADWP_Tools' ) ) {
|
|
180 |
public static function clear_cache() {
|
181 |
global $wpdb;
|
182 |
$sqlquery = $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'gadwp_cache_qr%%'" );
|
|
|
|
|
|
|
183 |
}
|
184 |
}
|
185 |
}
|
111 |
}
|
112 |
}
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
public static function unset_cookie( $name ) {
|
115 |
+
$name = 'gadwp_wg_' . $name;
|
116 |
+
setcookie( $name, '', time() - 3600, '/' );
|
117 |
+
$name = 'gadwp_ir_' . $name;
|
118 |
setcookie( $name, '', time() - 3600, '/' );
|
119 |
}
|
120 |
|
168 |
public static function clear_cache() {
|
169 |
global $wpdb;
|
170 |
$sqlquery = $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'gadwp_cache_qr%%'" );
|
171 |
+
GADWP_Tools::unset_cookie( 'default_metric' );
|
172 |
+
GADWP_Tools::unset_cookie( 'default_dimension' );
|
173 |
+
GADWP_Tools::unset_cookie( 'default_view' );
|
174 |
}
|
175 |
}
|
176 |
}
|