Google Analytics Dashboard for WP (GADWP) - Version 4.4.1

Version Description

  • Bug Fix: frontend widget nonce issue while using a cache plugin, reported by Rick
  • Bug Fix: clear the buffer immediately before returning AJAX response
  • Bug Fix: add fullpath while loading autoload.php
Download this release

Release Info

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

Code changes from version 4.4 to 4.4.1

admin/ajax-actions.php CHANGED
@@ -38,6 +38,8 @@ if (! class_exists('GADASH_Backend_Ajax')) {
38
  $to = $_REQUEST['to'];
39
  $query = $_REQUEST['query'];
40
 
 
 
41
  if (! isset($_REQUEST['gadashadmin_security_widget_reports']) or ! wp_verify_nonce($_REQUEST['gadashadmin_security_widget_reports'], 'gadashadmin_get_widgetreports')) {
42
  print(json_encode(- 30));
43
  die();
@@ -113,6 +115,8 @@ if (! class_exists('GADASH_Backend_Ajax')) {
113
 
114
  $projectId = $_REQUEST['projectId'];
115
 
 
 
116
  if (! isset($_REQUEST['gadashadmin_security_widgetrealtime']) or ! wp_verify_nonce($_REQUEST['gadashadmin_security_widgetrealtime'], 'gadashadmin_get_realtime')) {
117
  print(json_encode(- 30));
118
  die();
38
  $to = $_REQUEST['to'];
39
  $query = $_REQUEST['query'];
40
 
41
+ ob_clean();
42
+
43
  if (! isset($_REQUEST['gadashadmin_security_widget_reports']) or ! wp_verify_nonce($_REQUEST['gadashadmin_security_widget_reports'], 'gadashadmin_get_widgetreports')) {
44
  print(json_encode(- 30));
45
  die();
115
 
116
  $projectId = $_REQUEST['projectId'];
117
 
118
+ ob_clean();
119
+
120
  if (! isset($_REQUEST['gadashadmin_security_widgetrealtime']) or ! wp_verify_nonce($_REQUEST['gadashadmin_security_widgetrealtime'], 'gadashadmin_get_realtime')) {
121
  print(json_encode(- 30));
122
  die();
front/ajax-actions.php CHANGED
@@ -40,9 +40,11 @@ if (! class_exists('GADASH_Frontend_Ajax')) {
40
  {
41
  global $GADASH_Config;
42
 
43
- $page_url = $_REQUEST['gadash_pageurl'];
44
- $post_id = $_REQUEST['gadash_postid'];
45
  $query = $_REQUEST['query'];
 
 
46
 
47
  if (! isset($_REQUEST['gadash_security_pagereports']) or ! wp_verify_nonce($_REQUEST['gadash_security_pagereports'], 'gadash_get_frontend_pagereports')) {
48
  print(json_encode(- 30));
@@ -82,15 +84,11 @@ if (! class_exists('GADASH_Frontend_Ajax')) {
82
  }
83
 
84
  switch ($query) {
85
-
86
  case 'pageviews':
87
  print($GADASH_GAPI->frontend_afterpost_pageviews($projectId, $page_url, $post_id));
88
  break;
89
- case 'searches':
90
- print($GADASH_GAPI->frontend_afterpost_searches($projectId, $page_url, $post_id));
91
- break;
92
  default:
93
- die();
94
  break;
95
  }
96
 
@@ -107,25 +105,21 @@ if (! class_exists('GADASH_Frontend_Ajax')) {
107
  {
108
  global $GADASH_Config;
109
 
110
- $anonim = (int)$_REQUEST['gadash_anonim'];
111
- $period = $_REQUEST['gadash_period'];
112
 
113
- switch ($period) { //make sure we have a valid request
114
  case '7daysAgo':
115
- $safeperiod = '7daysAgo';
116
  break;
117
  case '14daysAgo':
118
- $safeperiod = '14daysAgo';
119
  break;
120
  default:
121
- $safeperiod = '30daysAgo';
122
  break;
123
  }
124
 
125
- if (! isset($_REQUEST['gadash_security_afw']) or ! wp_verify_nonce($_REQUEST['gadash_security_afw'], 'gadash_get_frontendwidget_data')) {
126
- print(json_encode(- 30));
127
- die();
128
- }
129
 
130
  if ($GADASH_Config->options['ga_dash_token'] and function_exists('curl_version') and $GADASH_Config->options['ga_dash_tableid_jail']) {
131
  include_once ($GADASH_Config->plugin_path . '/tools/gapi.php');
@@ -150,7 +144,7 @@ if (! class_exists('GADASH_Frontend_Ajax')) {
150
  die();
151
  }
152
 
153
- $data_widget = $GADASH_GAPI->frontend_widget_stats($projectId, $safeperiod, $anonim);
154
 
155
  print(json_encode($data_widget));
156
 
40
  {
41
  global $GADASH_Config;
42
 
43
+ $page_url = esc_url($_REQUEST['gadash_pageurl']);
44
+ $post_id = (int)$_REQUEST['gadash_postid'];
45
  $query = $_REQUEST['query'];
46
+
47
+ ob_clean();
48
 
49
  if (! isset($_REQUEST['gadash_security_pagereports']) or ! wp_verify_nonce($_REQUEST['gadash_security_pagereports'], 'gadash_get_frontend_pagereports')) {
50
  print(json_encode(- 30));
84
  }
85
 
86
  switch ($query) {
 
87
  case 'pageviews':
88
  print($GADASH_GAPI->frontend_afterpost_pageviews($projectId, $page_url, $post_id));
89
  break;
 
 
 
90
  default:
91
+ print($GADASH_GAPI->frontend_afterpost_searches($projectId, $page_url, $post_id));
92
  break;
93
  }
94
 
105
  {
106
  global $GADASH_Config;
107
 
108
+ $anonim = (int)$_REQUEST['gadash_anonim']; //make sure we have an int value
 
109
 
110
+ switch ($_REQUEST['gadash_period']) { //make sure we have a valid request
111
  case '7daysAgo':
112
+ $period = '7daysAgo';
113
  break;
114
  case '14daysAgo':
115
+ $period = '14daysAgo';
116
  break;
117
  default:
118
+ $period = '30daysAgo';
119
  break;
120
  }
121
 
122
+ ob_clean();
 
 
 
123
 
124
  if ($GADASH_Config->options['ga_dash_token'] and function_exists('curl_version') and $GADASH_Config->options['ga_dash_tableid_jail']) {
125
  include_once ($GADASH_Config->plugin_path . '/tools/gapi.php');
144
  die();
145
  }
146
 
147
+ $data_widget = $GADASH_GAPI->frontend_widget_stats($projectId, $period, $anonim);
148
 
149
  print(json_encode($data_widget));
150
 
front/widgets.php CHANGED
@@ -107,7 +107,7 @@ class GADSH_Frontend_Widget extends WP_Widget
107
 
108
  echo '<script type="text/javascript">
109
 
110
- jQuery.post("' . admin_url('admin-ajax.php') . '", {action: "gadash_get_frontendwidget_data",gadash_anonim: "' . $instance['anonim'] . '",gadash_period: "' . $instance['period'] . '",gadash_display: "' . $instance['display'] . '",gadash_security_afw: "' . wp_create_nonce('gadash_get_frontendwidget_data') . '"}, function(response){
111
  response = jQuery.parseJSON(response);
112
  if (!jQuery.isNumeric(response)){
113
  if (jQuery("#gadash-widgetchart")[0]){
107
 
108
  echo '<script type="text/javascript">
109
 
110
+ jQuery.post("' . admin_url('admin-ajax.php') . '", {action: "gadash_get_frontendwidget_data",gadash_anonim: "' . $instance['anonim'] . '",gadash_period: "' . $instance['period'] . '"}, function(response){
111
  response = jQuery.parseJSON(response);
112
  if (!jQuery.isNumeric(response)){
113
  if (jQuery("#gadash-widgetchart")[0]){
gadwp.php CHANGED
@@ -4,10 +4,10 @@
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.4
8
  * Author URI: https://deconf.com
9
  */
10
- define('GADWP_CURRENT_VERSION', '4.4');
11
 
12
  /*
13
  * Include Install
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.4.1
8
  * Author URI: https://deconf.com
9
  */
10
+ define('GADWP_CURRENT_VERSION', '4.4.1');
11
 
12
  /*
13
  * Include Install
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://deconf.com/donate/
4
  Tags: google,analytics,google analytics,dashboard,analytics dashboard,google analytics dashboard,google analytics widget,tracking,realtime,wpmu,multisite
5
  Requires at least: 2.8
6
  Tested up to: 4.1
7
- Stable tag: 4.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -60,7 +60,7 @@ Install the Google Analytics tracking code in less than a minute and customize i
60
  - exclude traffic based on user roles
61
  - option to exclude event tracking from bounce-rate calculation
62
  - multiple domains / cross domain tracking
63
- - action hook for tracking code customization
64
  - track authors, publication year, categories and user engagement using Google Analytics custom dimensions
65
  - affiliate links tracking using Google Analytics events
66
  - track fragment identifiers, hash marks (#) in URI links
@@ -126,6 +126,11 @@ This plugin it's released under the GPLv2, you can use it free of charge on your
126
 
127
  == Changelog ==
128
 
 
 
 
 
 
129
  = 4.4 =
130
  - Bug Fix: frontend reports and widget are not responsive
131
  - Bug Fix: random notices for today and yesterday reports
4
  Tags: google,analytics,google analytics,dashboard,analytics dashboard,google analytics dashboard,google analytics widget,tracking,realtime,wpmu,multisite
5
  Requires at least: 2.8
6
  Tested up to: 4.1
7
+ Stable tag: 4.4.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
60
  - exclude traffic based on user roles
61
  - option to exclude event tracking from bounce-rate calculation
62
  - multiple domains / cross domain tracking
63
+ - action hook for code customization
64
  - track authors, publication year, categories and user engagement using Google Analytics custom dimensions
65
  - affiliate links tracking using Google Analytics events
66
  - track fragment identifiers, hash marks (#) in URI links
126
 
127
  == Changelog ==
128
 
129
+ = 4.4.1 =
130
+ - Bug Fix: frontend widget nonce issue while using a cache plugin, reported by [Rick](https://deconf.com/ask/author/rickbates/)
131
+ - Bug Fix: clear the buffer immediately before returning AJAX response
132
+ - Bug Fix: add fullpath while loading autoload.php
133
+
134
  = 4.4 =
135
  - Bug Fix: frontend reports and widget are not responsive
136
  - Bug Fix: random notices for today and yesterday reports
tools/gapi.php CHANGED
@@ -23,12 +23,13 @@ if (! class_exists('GADASH_GAPI')) {
23
  function __construct()
24
  {
25
  global $GADASH_Config;
 
26
  if (! function_exists('curl_version')) {
27
  update_option('gadash_lasterror', date('Y-m-d H:i:s') . ': CURL disabled. Please enable CURL!');
28
  return;
29
  }
30
 
31
- require 'autoload.php';
32
 
33
  $this->client = new Google_Client();
34
  $this->client->setScopes('https://www.googleapis.com/auth/analytics.readonly');
23
  function __construct()
24
  {
25
  global $GADASH_Config;
26
+
27
  if (! function_exists('curl_version')) {
28
  update_option('gadash_lasterror', date('Y-m-d H:i:s') . ': CURL disabled. Please enable CURL!');
29
  return;
30
  }
31
 
32
+ include_once ($GADASH_Config->plugin_path . '/tools/autoload.php');;
33
 
34
  $this->client = new Google_Client();
35
  $this->client->setScopes('https://www.googleapis.com/auth/analytics.readonly');