Google Analyticator - Version 6.4.9.2

Version Description

  • Temporarily disable [analytics] shortcode to fix a bug
Download this release

Release Info

Developer grimmdude
Plugin Icon 128x128 Google Analyticator
Version 6.4.9.2
Comparing to
See all releases

Code changes from version 6.4.9.1 to 6.4.9.2

google-analyticator.php CHANGED
@@ -490,7 +490,7 @@ if(!$addons){?>
490
  <p>2- <a target="_blank" href="https://wordpress.org/support/view/plugin-reviews/google-analyticator">Leave a :) Review</a></p>
491
  <p>3- Have a great day!</p>
492
  <h3 style="text-align:center">Show off your analytics</h3>
493
- <p>Use short code <b>[analytics]</b> anywhere on your site to show your analytics publicly.</p>
494
  <p>Use short code <b>[analytics-counter]</b> anywhere on your site to display the page view counter widget.</p>
495
  </div>
496
  <?php }?>
@@ -1324,6 +1324,7 @@ function add_ga_admin_footer(){
1324
  */
1325
 
1326
  //[analytics]
 
1327
  function ga_analyticator_shortcode( $atts ) {
1328
  # Include the Google Analytics Summary widget
1329
  require_once('google-analytics-summary-widget.php');
@@ -1337,8 +1338,9 @@ function ga_analyticator_shortcode( $atts ) {
1337
 
1338
  return ob_get_clean();
1339
  }
 
1340
 
1341
- //[analytics]
1342
  function ga_analyticator_counter_shortcode( $atts ) {
1343
  # Include Google Analytics Stats widget
1344
  require_once('google-analytics-stats-widget.php');
490
  <p>2- <a target="_blank" href="https://wordpress.org/support/view/plugin-reviews/google-analyticator">Leave a :) Review</a></p>
491
  <p>3- Have a great day!</p>
492
  <h3 style="text-align:center">Show off your analytics</h3>
493
+ <!--<p>Use short code <b>[analytics]</b> anywhere on your site to show your analytics publicly.</p>-->
494
  <p>Use short code <b>[analytics-counter]</b> anywhere on your site to display the page view counter widget.</p>
495
  </div>
496
  <?php }?>
1324
  */
1325
 
1326
  //[analytics]
1327
+ /*
1328
  function ga_analyticator_shortcode( $atts ) {
1329
  # Include the Google Analytics Summary widget
1330
  require_once('google-analytics-summary-widget.php');
1338
 
1339
  return ob_get_clean();
1340
  }
1341
+ */
1342
 
1343
+ //[analytics-counter]
1344
  function ga_analyticator_counter_shortcode( $atts ) {
1345
  # Include Google Analytics Stats widget
1346
  require_once('google-analytics-stats-widget.php');
google-analytics-summary-widget.php CHANGED
@@ -15,6 +15,8 @@ class GoogleAnalyticsSummary
15
  **/
16
  function GoogleAnalyticsSummary($options = array('shortcode' => FALSE))
17
  {
 
 
18
  add_action('wp_dashboard_setup', array(
19
  $this,
20
  'addDashboardWidget'
@@ -28,15 +30,20 @@ class GoogleAnalyticsSummary
28
  'addTopJs'
29
  ));
30
 
31
- // For shortcode
32
- add_action('wp_footer', array(
33
- $this,
34
- 'addJavascript'
35
- ));
36
- add_action('wp_head', array(
37
- $this,
38
- 'addTopJs'
39
- ));
 
 
 
 
 
40
 
41
  $this->qa_selecteddate = isset( $_REQUEST['qa_selecteddate'] ) ? wp_filter_kses( $_REQUEST['qa_selecteddate'] ) : '31';
42
  $this->date_before = date('Y-m-d', strtotime( '-'.$this->qa_selecteddate.' days', strtotime( current_time( 'mysql' ) ) ) );
@@ -79,154 +86,158 @@ class GoogleAnalyticsSummary
79
  **/
80
  function addTopJs()
81
  {
82
- ?>
83
- <style type="text/css">
84
- #google-analytics-summary .legend table {width:auto;border:0;margin:0;}
85
- </style>
86
- <script type="text/javascript">
87
-
88
- //Tooltip
89
- jQuery.fn.UseTooltip = function () {
90
- var previousPoint = null;
91
-
92
- jQuery(this).bind("plothover", function (event, pos, item) {
93
- if (item) {
94
- if (previousPoint != item.dataIndex) {
95
- previousPoint = item.dataIndex;
96
-
97
- jQuery("#vumtooltip").remove();
98
-
99
- var x = item.datapoint[0];
100
- var y = item.datapoint[1];
101
- showTooltip(item.pageX, item.pageY, "<b>"+d2[ x- 1] + "</b><br/>" + item.series.label + ": <strong>" + y + "</strong>");
102
- }
103
- }
104
- else {
105
- jQuery("#vumtooltip").remove();
106
- previousPoint = null;
107
- }
108
- });
109
- };
110
-
111
- function showTooltip(x, y, contents) {
112
- jQuery('<div id="vumtooltip">' + contents + '</div>').css({
113
- position: 'absolute',
114
- display: 'none',
115
- top: y + 5,
116
- left: x + 20,
117
- border: '1px solid #D0D0D0',
118
- padding: '6px',
119
- size: '9',
120
- 'background-color': '#fff',
121
- opacity: 0.80
122
- }).appendTo("body").fadeIn(200);
123
- }
124
-
125
- jQuery(document).ready(function($){
126
- // Add a link to see full stats on the Analytics website
127
- jQuery('#google-analytics-summary h3.hndle span').append('<span class="postbox-title-action"><a href="http://google.com/analytics/" class="edit-box open-box"><?php _e('View Full Stat Report', 'google-analyticator');?></a></span>');
128
-
129
- // Onload call analytics
130
- getAnalytics();
131
-
132
- //On date selection change
133
- jQuery("#qa_selecteddate").change(function(){
134
- getAnalytics();
135
- });
136
-
137
- });
138
-
139
- function getAnalytics(){
140
-
141
- // console.log( 'Start getAnalytics();' );
142
- // Grab the widget data
143
- jQuery.ajax({
144
- type: 'post',
145
- url: '<?php echo admin_url( 'admin-ajax.php' ); ?>',
146
- data: {
147
- action: 'ga_stats_widget',
148
- qa_selecteddate: jQuery("#qa_selecteddate :selected").val(),
149
- _ajax_nonce: '<?php echo wp_create_nonce("google-analyticator-statsWidget_get");?>'
150
- },
151
- beforeSend: function() {
152
- jQuery("#analyticsloading").html('<img src="<?php echo admin_url("images/wpspin_light.gif")?>" border="0" /> ').show();
153
- },
154
- success: function(html) {
155
- jQuery("#analyticsloading").hide();
156
- // Hide the loading message
157
- jQuery('#google-analytics-summary .inside small').remove();
158
-
159
- // console.log(html);
160
-
161
- // Place the widget data in the area
162
- jQuery('#google-analytics-summary .inside .target').html(html);
163
-
164
- // Display the widget data
165
- jQuery('#google-analytics-summary .inside .target').slideDown();
166
-
167
- // Handle displaying the graph
168
- var divElement = jQuery('div'); //log all div elements
169
- var placeholder = jQuery(".flotcontainer");
170
-
171
- //disable graph if the selected is yesterday or today
172
- placeholder.show();
173
- if(jQuery("#qa_selecteddate :selected").val() == '0' || jQuery("#qa_selecteddate :selected").val() == '1') {
174
- placeholder.hide();
175
- return false;
176
- }
177
-
178
- //graph options
179
- var options = {
180
- grid: {
181
- show: true,
182
- aboveData: true,
183
- color: "#3f3f3f" ,
184
- labelMargin: 5,
185
- axisMargin: 0,
186
- borderWidth: 0,
187
- borderColor:null,
188
- minBorderMargin: 5 ,
189
- clickable: true,
190
- hoverable: true,
191
- autoHighlight: true,
192
- mouseActiveRadius: 10
193
- },
194
- series: {
195
- grow: {active:false},
196
- lines: {
197
- show: true,
198
- fill: true,
199
- lineWidth: 2,
200
- steps: false
201
- },
202
- points: {show:true}
203
- },
204
- legend: { position: "se" },
205
- yaxis: { min: 0 },
206
- xaxis: {ticks : datelabel, tickDecimals : 0},
207
- colors: ['#88bbc8', '#ed7a53', '#9FC569', '#bbdce3', '#9a3b1b', '#5a8022', '#2c7282'],
208
- shadowSize:1,
209
- tooltip: false, //activate tooltip
210
- };
211
-
212
- jQuery.plot(placeholder, [
213
- {
214
- label: "<?php _e('Visits', 'google-analyticator')?>",
215
- data: d1,
216
- lines: {fillColor: "#f2f7f9"},
217
- points: {fillColor: "#88bbc8"}
218
- }
219
-
220
- ], options);
221
- jQuery(".flotcontainer").UseTooltip();
222
-
223
- }
224
- });
225
- }
226
- jQuery(window).resize(function() {
227
- getAnalytics();
228
- });
229
- </script>
 
 
 
 
230
  <?php
231
  }
232
 
15
  **/
16
  function GoogleAnalyticsSummary($options = array('shortcode' => FALSE))
17
  {
18
+ $this->options = $options;
19
+
20
  add_action('wp_dashboard_setup', array(
21
  $this,
22
  'addDashboardWidget'
30
  'addTopJs'
31
  ));
32
 
33
+ /*
34
+ if ($this->options['shortcode']) {
35
+ // For shortcode
36
+ add_action('wp_footer', array(
37
+ $this,
38
+ 'addJavascript'
39
+ ));
40
+
41
+ add_action('wp_head', array(
42
+ $this,
43
+ 'addTopJs'
44
+ ));
45
+ }
46
+ */
47
 
48
  $this->qa_selecteddate = isset( $_REQUEST['qa_selecteddate'] ) ? wp_filter_kses( $_REQUEST['qa_selecteddate'] ) : '31';
49
  $this->date_before = date('Y-m-d', strtotime( '-'.$this->qa_selecteddate.' days', strtotime( current_time( 'mysql' ) ) ) );
86
  **/
87
  function addTopJs()
88
  {
89
+ print_r($this->options);
90
+
91
+ ?>
92
+
93
+
94
+ <style type="text/css">
95
+ #google-analytics-summary .legend table {width:auto;border:0;margin:0;}
96
+ </style>
97
+ <script type="text/javascript">
98
+
99
+ //Tooltip
100
+ jQuery.fn.UseTooltip = function () {
101
+ var previousPoint = null;
102
+
103
+ jQuery(this).bind("plothover", function (event, pos, item) {
104
+ if (item) {
105
+ if (previousPoint != item.dataIndex) {
106
+ previousPoint = item.dataIndex;
107
+
108
+ jQuery("#vumtooltip").remove();
109
+
110
+ var x = item.datapoint[0];
111
+ var y = item.datapoint[1];
112
+ showTooltip(item.pageX, item.pageY, "<b>"+d2[ x- 1] + "</b><br/>" + item.series.label + ": <strong>" + y + "</strong>");
113
+ }
114
+ }
115
+ else {
116
+ jQuery("#vumtooltip").remove();
117
+ previousPoint = null;
118
+ }
119
+ });
120
+ };
121
+
122
+ function showTooltip(x, y, contents) {
123
+ jQuery('<div id="vumtooltip">' + contents + '</div>').css({
124
+ position: 'absolute',
125
+ display: 'none',
126
+ top: y + 5,
127
+ left: x + 20,
128
+ border: '1px solid #D0D0D0',
129
+ padding: '6px',
130
+ size: '9',
131
+ 'background-color': '#fff',
132
+ opacity: 0.80
133
+ }).appendTo("body").fadeIn(200);
134
+ }
135
+
136
+ jQuery(document).ready(function($){
137
+ // Add a link to see full stats on the Analytics website
138
+ jQuery('#google-analytics-summary h3.hndle span').append('<span class="postbox-title-action"><a href="http://google.com/analytics/" class="edit-box open-box"><?php _e('View Full Stat Report', 'google-analyticator');?></a></span>');
139
+
140
+ // Onload call analytics
141
+ getAnalytics();
142
+
143
+ //On date selection change
144
+ jQuery("#qa_selecteddate").change(function(){
145
+ getAnalytics();
146
+ });
147
+
148
+ });
149
+
150
+ function getAnalytics(){
151
+
152
+ // console.log( 'Start getAnalytics();' );
153
+ // Grab the widget data
154
+ jQuery.ajax({
155
+ type: 'post',
156
+ url: '<?php echo admin_url( 'admin-ajax.php' ); ?>',
157
+ data: {
158
+ action: 'ga_stats_widget',
159
+ qa_selecteddate: jQuery("#qa_selecteddate :selected").val(),
160
+ _ajax_nonce: '<?php echo wp_create_nonce("google-analyticator-statsWidget_get");?>'
161
+ },
162
+ beforeSend: function() {
163
+ jQuery("#analyticsloading").html('<img src="<?php echo admin_url("images/wpspin_light.gif")?>" border="0" /> ').show();
164
+ },
165
+ success: function(html) {
166
+ jQuery("#analyticsloading").hide();
167
+ // Hide the loading message
168
+ jQuery('#google-analytics-summary .inside small').remove();
169
+
170
+ // console.log(html);
171
+
172
+ // Place the widget data in the area
173
+ jQuery('#google-analytics-summary .inside .target').html(html);
174
+
175
+ // Display the widget data
176
+ jQuery('#google-analytics-summary .inside .target').slideDown();
177
+
178
+ // Handle displaying the graph
179
+ var divElement = jQuery('div'); //log all div elements
180
+ var placeholder = jQuery(".flotcontainer");
181
+
182
+ //disable graph if the selected is yesterday or today
183
+ placeholder.show();
184
+ if(jQuery("#qa_selecteddate :selected").val() == '0' || jQuery("#qa_selecteddate :selected").val() == '1') {
185
+ placeholder.hide();
186
+ return false;
187
+ }
188
+
189
+ //graph options
190
+ var options = {
191
+ grid: {
192
+ show: true,
193
+ aboveData: true,
194
+ color: "#3f3f3f" ,
195
+ labelMargin: 5,
196
+ axisMargin: 0,
197
+ borderWidth: 0,
198
+ borderColor:null,
199
+ minBorderMargin: 5 ,
200
+ clickable: true,
201
+ hoverable: true,
202
+ autoHighlight: true,
203
+ mouseActiveRadius: 10
204
+ },
205
+ series: {
206
+ grow: {active:false},
207
+ lines: {
208
+ show: true,
209
+ fill: true,
210
+ lineWidth: 2,
211
+ steps: false
212
+ },
213
+ points: {show:true}
214
+ },
215
+ legend: { position: "se" },
216
+ yaxis: { min: 0 },
217
+ xaxis: {ticks : datelabel, tickDecimals : 0},
218
+ colors: ['#88bbc8', '#ed7a53', '#9FC569', '#bbdce3', '#9a3b1b', '#5a8022', '#2c7282'],
219
+ shadowSize:1,
220
+ tooltip: false, //activate tooltip
221
+ };
222
+
223
+ jQuery.plot(placeholder, [
224
+ {
225
+ label: "<?php _e('Visits', 'google-analyticator')?>",
226
+ data: d1,
227
+ lines: {fillColor: "#f2f7f9"},
228
+ points: {fillColor: "#88bbc8"}
229
+ }
230
+
231
+ ], options);
232
+ jQuery(".flotcontainer").UseTooltip();
233
+
234
+ }
235
+ });
236
+ }
237
+ jQuery(window).resize(function() {
238
+ getAnalytics();
239
+ });
240
+ </script>
241
  <?php
242
  }
243
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: noahkagan
3
  Tags: google analytics plugin, stats, statistics, google, analytics, dashboard, google analytics, tracking, widget, marketing,pageviews,visits, web stats, javascript
4
  Requires at least: 3.2
5
  Tested up to: 4.2.2
6
- Stable tag: 6.4.9.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -74,6 +74,9 @@ For any support issues, please use the official WordPress support forums.
74
 
75
  == Changelog ==
76
 
 
 
 
77
  = 6.4.9.1 =
78
  * Added [analytics-counter] shortcode so you can display the page view counter widget anywhere
79
 
3
  Tags: google analytics plugin, stats, statistics, google, analytics, dashboard, google analytics, tracking, widget, marketing,pageviews,visits, web stats, javascript
4
  Requires at least: 3.2
5
  Tested up to: 4.2.2
6
+ Stable tag: 6.4.9.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
74
 
75
  == Changelog ==
76
 
77
+ = 6.4.9.2 =
78
+ * Temporarily disable [analytics] shortcode to fix a bug
79
+
80
  = 6.4.9.1 =
81
  * Added [analytics-counter] shortcode so you can display the page view counter widget anywhere
82