Yandex Metrica - Version 1.6.1

Version Description

  • prevent inline js loading globally. Props Makaka Games
    • script handler renamed
    • chart options updated; bar charts start from zero and line charts are using index mode for tooltips
Download this release

Release Info

Developer m_uysl
Plugin Icon 128x128 Yandex Metrica
Version 1.6.1
Comparing to
See all releases

Code changes from version 1.6 to 1.6.1

README.md CHANGED
@@ -4,7 +4,7 @@ Contributors: m_uysl
4
  Tags: yandex,metrica,stats,statistics,tools,analytics,analytics tool,metrika
5
  Requires at least: 3.8
6
  Tested up to: 4.9
7
- Stable tag: 1.6
8
  License: GPLv2 (or later)
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -72,6 +72,11 @@ Extract the zip file and just drop the contents in the `wp-content/plugins/` dir
72
 
73
  ## Changelog ##
74
 
 
 
 
 
 
75
  ### 1.6 ###
76
  - charting library changed. (Switched to Chart.js)
77
  - daily stats using bar type
4
  Tags: yandex,metrica,stats,statistics,tools,analytics,analytics tool,metrika
5
  Requires at least: 3.8
6
  Tested up to: 4.9
7
+ Stable tag: 1.6.1
8
  License: GPLv2 (or later)
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
72
 
73
  ## Changelog ##
74
 
75
+ ### 1.6.1 ###
76
+ - prevent inline js loading globally. Props Makaka Games
77
+ - script handler renamed
78
+ - chart options updated; bar charts start from zero and line charts are using index mode for tooltips
79
+
80
  ### 1.6 ###
81
  - charting library changed. (Switched to Chart.js)
82
  - daily stats using bar type
readme.txt CHANGED
@@ -4,7 +4,7 @@ Contributors: m_uysl
4
  Tags: yandex,metrica,stats,statistics,tools,analytics,analytics tool,metrika
5
  Requires at least: 3.8
6
  Tested up to: 4.9
7
- Stable tag: 1.6
8
  License: GPLv2 (or later)
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -65,6 +65,11 @@ Yandex Metrica plugin uses wp_footer hook for the adds necessary tracking code.
65
 
66
  == Changelog ==
67
 
 
 
 
 
 
68
  = 1.6 =
69
  - charting library changed. (Switched to Chart.js)
70
  - daily stats using bar type
4
  Tags: yandex,metrica,stats,statistics,tools,analytics,analytics tool,metrika
5
  Requires at least: 3.8
6
  Tested up to: 4.9
7
+ Stable tag: 1.6.1
8
  License: GPLv2 (or later)
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
65
 
66
  == Changelog ==
67
 
68
+ = 1.6.1 =
69
+ - prevent inline js loading globally. Props Makaka Games
70
+ - script handler renamed
71
+ - chart options updated; bar charts start from zero and line charts are using index mode for tooltips
72
+
73
  = 1.6 =
74
  - charting library changed. (Switched to Chart.js)
75
  - daily stats using bar type
templates/dashboard-charts-js.php CHANGED
@@ -76,6 +76,18 @@
76
  display: true,
77
  text : '<?php echo __( 'Metrica Traffic', 'yandex-metrica' );?>'
78
  },
 
 
 
 
 
 
 
 
 
 
 
 
79
  }
80
  });
81
 
@@ -94,6 +106,29 @@
94
 
95
  <?php } ?>
96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  });
98
 
99
  </script>
76
  display: true,
77
  text : '<?php echo __( 'Metrica Traffic', 'yandex-metrica' );?>'
78
  },
79
+ scales: {
80
+ yAxes: [{
81
+ ticks: {
82
+ beginAtZero:true
83
+ }
84
+ }]
85
+ },
86
+ <?php if('daily' !== $this->period):?>
87
+ tooltips: {
88
+ mode: 'index'
89
+ }
90
+ <?php endif;?>
91
  }
92
  });
93
 
106
 
107
  <?php } ?>
108
 
109
+ $('#yandex_metrica_widget h3.hndle span').append('<span class="postbox-title-action"><a href="http://metrica.yandex.com" class="edit-box open-box"><?php _e('View Full Report', 'yandex-metrica');?></a></span>');
110
+
111
+ $(document).on("change", "#period", function () {
112
+ jQuery.ajax({
113
+ type : 'post',
114
+ url : 'admin-ajax.php',
115
+ cache: false,
116
+ data : {
117
+ action : 'metrica_actions',
118
+ period : $(this).val(),
119
+ _ajax_nonce: '<?php echo wp_create_nonce("yandex-metrica-nonce");?>'
120
+ },
121
+ beforeSend: function () {
122
+ jQuery("#metricaloading").html('<img src="<?php echo admin_url("images/wpspin_light.gif")?>" />').show();
123
+ },
124
+ success: function (html) {
125
+ jQuery("#metricaloading").hide();
126
+ jQuery('#yandex_metrica_widget .inside').html(html);
127
+ return true;
128
+ }
129
+ });
130
+ });
131
+
132
  });
133
 
134
  </script>
yandex-metrica.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Yandex Metrica
4
  Plugin URI: http://uysalmustafa.com/plugins/yandex-metrica
5
  Description: Best metrica plugin for the use Yandex Metrica in your WordPress site.
6
  Author: Mustafa Uysal
7
- Version: 1.6
8
  Text Domain: yandex-metrica
9
  Domain Path: /languages/
10
  Author URI: http://uysalmustafa.com
@@ -51,7 +51,6 @@ class WP_Yandex_Metrica extends WP_Stack_Plugin {
51
 
52
  $this->hook( 'admin_menu' );
53
  $this->hook( 'wp_footer' ); // using wp_footer for adding tracking code. If you theme don't have it, this plugin can't track your site.
54
- $this->hook( 'admin_head', 'yandex_metrica_js' );
55
 
56
  if ( $this->is_authorized() ) {
57
  self::$metrica_api = new Yandex_Metrica( $this->options["access_token"] );
@@ -168,43 +167,6 @@ class WP_Yandex_Metrica extends WP_Stack_Plugin {
168
  }
169
 
170
 
171
- public function yandex_metrica_js() {
172
- ?>
173
- <script type="text/javascript">
174
- jQuery(document).ready(function ($) {
175
- jQuery('#yandex_metrica_widget h3.hndle span').append('<span class="postbox-title-action"><a href="http://metrica.yandex.com" class="edit-box open-box"><?php _e('View Full Report', 'yandex-metrica');?></a></span>');
176
-
177
- $(document).on("change", "#period", function () {
178
-
179
- jQuery.ajax({
180
- type : 'post',
181
- url : 'admin-ajax.php',
182
- cache: false,
183
- data : {
184
- action : 'metrica_actions',
185
- period : $(this).val(),
186
- _ajax_nonce: '<?php echo wp_create_nonce("yandex-metrica-nonce");?>'
187
-
188
- },
189
-
190
- beforeSend: function () {
191
- jQuery("#metricaloading").html('<img src="<?php echo admin_url("images/wpspin_light.gif")?>" />').show();
192
- },
193
-
194
- success: function (html) {
195
- //console.log(html);
196
- jQuery("#metricaloading").hide();
197
- jQuery('#yandex_metrica_widget .inside').html(html);
198
- return true;
199
- }
200
-
201
- });
202
- });
203
- });
204
- </script>
205
- <?php
206
- }
207
-
208
  public function dashboard_chart_js() {
209
  wp_enqueue_script( 'jquery' );
210
  $statical_data = self::$metrica_api->get_counter_statistics( $this->options["counter_id"], $this->start_date, $this->end_date, "daily" );
@@ -230,7 +192,7 @@ class WP_Yandex_Metrica extends WP_Stack_Plugin {
230
 
231
  public function enqueue() {
232
  if ( self::$metrica_api->is_valid_counter( $this->options["counter_id"] ) ) {
233
- wp_enqueue_script( 'chart', plugins_url( "js/Chart.min.js", __FILE__ ) );
234
  }
235
  }
236
 
4
  Plugin URI: http://uysalmustafa.com/plugins/yandex-metrica
5
  Description: Best metrica plugin for the use Yandex Metrica in your WordPress site.
6
  Author: Mustafa Uysal
7
+ Version: 1.6.1
8
  Text Domain: yandex-metrica
9
  Domain Path: /languages/
10
  Author URI: http://uysalmustafa.com
51
 
52
  $this->hook( 'admin_menu' );
53
  $this->hook( 'wp_footer' ); // using wp_footer for adding tracking code. If you theme don't have it, this plugin can't track your site.
 
54
 
55
  if ( $this->is_authorized() ) {
56
  self::$metrica_api = new Yandex_Metrica( $this->options["access_token"] );
167
  }
168
 
169
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  public function dashboard_chart_js() {
171
  wp_enqueue_script( 'jquery' );
172
  $statical_data = self::$metrica_api->get_counter_statistics( $this->options["counter_id"], $this->start_date, $this->end_date, "daily" );
192
 
193
  public function enqueue() {
194
  if ( self::$metrica_api->is_valid_counter( $this->options["counter_id"] ) ) {
195
+ wp_enqueue_script( 'yandex-metrica-chart', plugins_url( "js/Chart.min.js", __FILE__ ) );
196
  }
197
  }
198