Google Analytics Opt-Out - Version 2.1.2

Version Description

  • Fixed an issue where the opt-out code may not be on top of the sourcecode of some websites.
  • Opt-Out settings field has been moved up on the settings page.
Download this release

Release Info

Developer wp-buddy
Plugin Icon 128x128 Google Analytics Opt-Out
Version 2.1.2
Comparing to
See all releases

Code changes from version 2.1.1 to 2.1.2

google-analytics-opt-out.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Google Analytics Opt-Out
4
  Plugin URI: https://wp-buddy.com/products/plugins/google-analytics-opt-out
5
  Description: Provides an Opt-Out functionality for Google Analytics
6
- Version: 2.1.1
7
  Author: WP-Buddy
8
  Author URI: https://wp-buddy.com
9
  License: GPL2
@@ -42,7 +42,7 @@ define( 'GAOOP_FILE', __FILE__ );
42
  define( 'GAOOP_PATH', trailingslashit( plugin_dir_path( __FILE__ ) ) );
43
  define( 'GAOOP_URL', trailingslashit( plugins_url( '', __FILE__ ) ) );
44
 
45
- if ( version_compare( PHP_VERSION, '5.3', '<' ) ) {
46
  wp_die( sprintf( __( 'You are using PHP in version %s. This version is outdated and cannot be used with the Google Analytics Opt-Out plugin. Please update to the latest PHP version in order to use this plugin. You can ask your provider on how to do this.', 'google-analytics-opt-out' ), PHP_VERSION ) );
47
  }
48
 
@@ -54,16 +54,3 @@ require_once GAOOP_PATH . 'inc/settings.php';
54
  require_once GAOOP_PATH . 'inc/frontend.php';
55
 
56
 
57
- function gaoop_activation() {
58
-
59
- if ( ! function_exists( 'is_plugin_active' ) ) {
60
- include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
61
- }
62
-
63
- if ( is_plugin_active( 'google-analytics-opt-out/google-analytics-opt-out.php' ) ) {
64
- wp_die( __( 'It seems that the free version of the Google Analytics Opt-Out is installed. Please deactivate the free version before activating the pro version. Thanks! ', 'google-analytics-opt-out' ) . '<br /><br /><a href="' . admin_url( 'plugins.php' ) . '">' . __( '&larr; Go back', 'google-analytics-opt-out' ) . '</a>' );
65
- }
66
- }
67
-
68
- register_activation_hook( GAOOP_FILE, 'gaoop_activation' );
69
-
3
  Plugin Name: Google Analytics Opt-Out
4
  Plugin URI: https://wp-buddy.com/products/plugins/google-analytics-opt-out
5
  Description: Provides an Opt-Out functionality for Google Analytics
6
+ Version: 2.1.2
7
  Author: WP-Buddy
8
  Author URI: https://wp-buddy.com
9
  License: GPL2
42
  define( 'GAOOP_PATH', trailingslashit( plugin_dir_path( __FILE__ ) ) );
43
  define( 'GAOOP_URL', trailingslashit( plugins_url( '', __FILE__ ) ) );
44
 
45
+ if ( version_compare( PHP_VERSION, '5.6', '<' ) ) {
46
  wp_die( sprintf( __( 'You are using PHP in version %s. This version is outdated and cannot be used with the Google Analytics Opt-Out plugin. Please update to the latest PHP version in order to use this plugin. You can ask your provider on how to do this.', 'google-analytics-opt-out' ), PHP_VERSION ) );
47
  }
48
 
54
  require_once GAOOP_PATH . 'inc/frontend.php';
55
 
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/frontend.php CHANGED
@@ -167,7 +167,7 @@ function gaoop_wp_head() {
167
  $custom_css = get_option( 'gaoop_custom_styles', '' );
168
  $custom_css = apply_filters( 'gaoop_custom_styles', $custom_css );
169
 
170
- echo '<style type="text/css">/** Google Analytics Opt Out Custom CSS */' . $standard_css . $custom_css . '</style>';
171
  }
172
 
173
- add_action( 'wp_head', 'gaoop_wp_head' );
167
  $custom_css = get_option( 'gaoop_custom_styles', '' );
168
  $custom_css = apply_filters( 'gaoop_custom_styles', $custom_css );
169
 
170
+ echo '<style type="text/css">/** Google Analytics Opt Out Custom CSS **/' . $standard_css . $custom_css . '</style>';
171
  }
172
 
173
+ add_action( 'wp_head', 'gaoop_wp_head' );
inc/scripts.php CHANGED
@@ -1,53 +1,28 @@
1
  <?php
2
- /**
3
- * Echos out the JavaScript for the opt-out
4
- *
5
- * @since 1.0
6
- * @deprecated 2.0.2
7
- *
8
- * @todo Remove this is a future version.
9
- *
10
- * @return void
11
- */
12
- function gaoop_head_script() {
13
-
14
- //
15
- // if ( apply_filters( 'gaoop_stop_head', false ) ) {
16
- // return;
17
- // }
18
- //
19
- // gaoop_js();
20
- }
21
 
22
  /**
23
- * Echos out the Javascript or returns it (if $echo is set to TRUE)
24
  *
25
  * @since 1.0
26
  *
27
- * @param bool $echo
28
- *
29
  * @return void|string
30
  */
31
- function gaoop_js( $echo = true ) {
32
 
33
  $ua_code = gaoop_get_ua_code();
34
  if ( empty( $ua_code ) ) {
35
- return '';
36
  }
37
- ob_start();
38
- if ( $echo ):
39
  ?>
40
  <script type="text/javascript">
41
- <?php
42
- endif;
43
- ?>
44
- /* Google Analytics Opt-Out WordPress by WP-Buddy | http://wp-buddy.com/products/plugins/google-analytics-opt-out */
45
  <?php do_action( 'gaoop_js_before_script' ); ?>
46
  var gaoop_property = '<?php echo $ua_code; ?>';
47
  var gaoop_disable_str = 'ga-disable-' + gaoop_property;
48
  if ( document.cookie.indexOf( gaoop_disable_str + '=true' ) > -1 ) {
49
  window[ gaoop_disable_str ] = true;
50
  }
 
51
  function gaoop_analytics_optout() {
52
  document.cookie = gaoop_disable_str + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
53
  window[ gaoop_disable_str ] = true;
@@ -55,20 +30,14 @@ if ( $echo ):
55
  }
56
  <?php
57
  do_action( 'gaoop_js_after_script' );
58
-
59
- if($echo):
60
  ?>
61
  </script>
62
  <?php
63
- endif;
64
- $content = ob_get_clean();
65
- if ( $echo ) {
66
- echo $content;
67
- } else {
68
- return $content;
69
- }
70
  }
71
 
 
 
 
72
  /**
73
  * Enqueue Frontend Scripts
74
  *
@@ -86,10 +55,6 @@ function gaoop_enqueue_scripts() {
86
 
87
  return $tag;
88
  }, 10, 2 );
89
-
90
- $js = gaoop_js( false );
91
- wp_add_inline_script( 'goop', $js );
92
  }
93
 
94
  add_action( 'init', 'gaoop_enqueue_scripts' );
95
-
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  /**
4
+ * Echos the Javascript or returns it (if $echo is set to TRUE)
5
  *
6
  * @since 1.0
7
  *
 
 
8
  * @return void|string
9
  */
10
+ function gaoop_js() {
11
 
12
  $ua_code = gaoop_get_ua_code();
13
  if ( empty( $ua_code ) ) {
14
+ return;
15
  }
 
 
16
  ?>
17
  <script type="text/javascript">
18
+ /* Google Analytics Opt-Out WordPress by WP-Buddy | https://wp-buddy.com/products/plugins/google-analytics-opt-out */
 
 
 
19
  <?php do_action( 'gaoop_js_before_script' ); ?>
20
  var gaoop_property = '<?php echo $ua_code; ?>';
21
  var gaoop_disable_str = 'ga-disable-' + gaoop_property;
22
  if ( document.cookie.indexOf( gaoop_disable_str + '=true' ) > -1 ) {
23
  window[ gaoop_disable_str ] = true;
24
  }
25
+
26
  function gaoop_analytics_optout() {
27
  document.cookie = gaoop_disable_str + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
28
  window[ gaoop_disable_str ] = true;
30
  }
31
  <?php
32
  do_action( 'gaoop_js_after_script' );
 
 
33
  ?>
34
  </script>
35
  <?php
 
 
 
 
 
 
 
36
  }
37
 
38
+ add_action( 'wp_head', 'gaoop_js', 0 );
39
+
40
+
41
  /**
42
  * Enqueue Frontend Scripts
43
  *
55
 
56
  return $tag;
57
  }, 10, 2 );
 
 
 
58
  }
59
 
60
  add_action( 'init', 'gaoop_enqueue_scripts' );
 
inc/settings.php CHANGED
@@ -74,6 +74,9 @@ function gaoop_register_theme_options_section() {
74
  add_settings_field( 'gaoop_editor_button', __( 'Show Editor button', 'google-analytics-opt-out' ), 'gaoop_options_editor_button', 'gaoop_options_page', 'gaoop_settings_section', array( 'label_for' => 'gaoop_options_editor_button' ) );
75
  register_setting( 'gaoop_options_page', 'gaoop_editor_button', 'intval' );
76
 
 
 
 
77
  add_settings_field( 'gaoop_banner', __( 'Use Banner', 'google-analytics-opt-out' ), 'gaoop_options_banner', 'gaoop_options_page', 'gaoop_settings_section', array( 'label_for' => 'gaoop_options_banner' ) );
78
  register_setting( 'gaoop_options_page', 'gaoop_banner', 'intval' );
79
 
@@ -83,9 +86,6 @@ function gaoop_register_theme_options_section() {
83
  add_settings_field( 'gaoop_opt_out_shortcode_integration', __( 'Integrate Shortcode', 'google-analytics-opt-out' ), 'gaoop_options_opt_out_shortcode_integration', 'gaoop_options_page', 'gaoop_settings_section', array( 'label_for' => 'gaoop_options_opt_out_shortcode_integration' ) );
84
  register_setting( 'gaoop_options_page', 'gaoop_opt_out_shortcode_integration', 'sanitize_text_field' );
85
 
86
- add_settings_field( 'gaoop_opt_out_cookie_set_text', __( 'Opt-Out Successful', 'google-analytics-opt-out' ), 'gaoop_options_opt_out_cookie_set_text', 'gaoop_options_page', 'gaoop_settings_section', array( 'label_for' => 'gaoop_options_opt_out_cookie_set_text' ) );
87
- register_setting( 'gaoop_options_page', 'gaoop_opt_out_cookie_set_text', 'sanitize_text_field' );
88
-
89
  add_settings_field( 'gaoop_hide', __( 'Hide banner after closing', 'google-analytics-opt-out' ), 'gaoop_options_hide', 'gaoop_options_page', 'gaoop_settings_section', array( 'label_for' => 'gaoop_options_hide' ) );
90
  register_setting( 'gaoop_options_page', 'gaoop_hide', 'intval' );
91
 
@@ -177,6 +177,8 @@ function gaoop_options_editor_button() {
177
  $editor_button_active = (bool) get_option( 'gaoop_editor_button', false );
178
 
179
  echo '<input ' . checked( $editor_button_active, true, false ) . ' id="gaoop_options_editor_banner" type="checkbox" name="gaoop_editor_button" value="1" />';
 
 
180
  }
181
 
182
 
74
  add_settings_field( 'gaoop_editor_button', __( 'Show Editor button', 'google-analytics-opt-out' ), 'gaoop_options_editor_button', 'gaoop_options_page', 'gaoop_settings_section', array( 'label_for' => 'gaoop_options_editor_button' ) );
75
  register_setting( 'gaoop_options_page', 'gaoop_editor_button', 'intval' );
76
 
77
+ add_settings_field( 'gaoop_opt_out_cookie_set_text', __( 'Opt-Out Successful', 'google-analytics-opt-out' ), 'gaoop_options_opt_out_cookie_set_text', 'gaoop_options_page', 'gaoop_settings_section', array( 'label_for' => 'gaoop_options_opt_out_cookie_set_text' ) );
78
+ register_setting( 'gaoop_options_page', 'gaoop_opt_out_cookie_set_text', 'sanitize_text_field' );
79
+
80
  add_settings_field( 'gaoop_banner', __( 'Use Banner', 'google-analytics-opt-out' ), 'gaoop_options_banner', 'gaoop_options_page', 'gaoop_settings_section', array( 'label_for' => 'gaoop_options_banner' ) );
81
  register_setting( 'gaoop_options_page', 'gaoop_banner', 'intval' );
82
 
86
  add_settings_field( 'gaoop_opt_out_shortcode_integration', __( 'Integrate Shortcode', 'google-analytics-opt-out' ), 'gaoop_options_opt_out_shortcode_integration', 'gaoop_options_page', 'gaoop_settings_section', array( 'label_for' => 'gaoop_options_opt_out_shortcode_integration' ) );
87
  register_setting( 'gaoop_options_page', 'gaoop_opt_out_shortcode_integration', 'sanitize_text_field' );
88
 
 
 
 
89
  add_settings_field( 'gaoop_hide', __( 'Hide banner after closing', 'google-analytics-opt-out' ), 'gaoop_options_hide', 'gaoop_options_page', 'gaoop_settings_section', array( 'label_for' => 'gaoop_options_hide' ) );
90
  register_setting( 'gaoop_options_page', 'gaoop_hide', 'intval' );
91
 
177
  $editor_button_active = (bool) get_option( 'gaoop_editor_button', false );
178
 
179
  echo '<input ' . checked( $editor_button_active, true, false ) . ' id="gaoop_options_editor_banner" type="checkbox" name="gaoop_editor_button" value="1" />';
180
+
181
+ printf( '<p class="description">%s</p>', __( 'Some users reported problems with the editor button. So you can deactivate it here. Read more about the <a target="_blank" href="https://wp-buddy.com/documentation/plugins/google-analytics-opt/faq/#what-are-the-shortcodes-that-i-can-use">shortcodes</a> that can be used instead.', 'google-analytics-opt-out' ) );
182
  }
183
 
184
 
js/frontend.js CHANGED
@@ -5,7 +5,6 @@
5
  var $gaoop = jQuery( '.gaoop' );
6
  var ua_code = $gaoop.data( 'gaoop_ua' );
7
 
8
-
9
  /**
10
  * Check if opt-out cookie has NOT been set already
11
  */
5
  var $gaoop = jQuery( '.gaoop' );
6
  var ua_code = $gaoop.data( 'gaoop_ua' );
7
 
 
8
  /**
9
  * Check if opt-out cookie has NOT been set already
10
  */
languages/gaoo.pot CHANGED
@@ -2,14 +2,14 @@
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Google Analytics Opt-Out\n"
5
- "POT-Creation-Date: 2018-01-25 10:57+0700\n"
6
  "PO-Revision-Date: 2013-11-12 09:04+0100\n"
7
  "Last-Translator: WP-Buddy <info@wp-buddy.com>\n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 2.0.5\n"
13
  "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
14
  "_n_noop:1,2;_c;_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_ex:1,2c;"
15
  "esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Google Analytics Opt-Out\n"
5
+ "POT-Creation-Date: 2018-05-11 11:57+0200\n"
6
  "PO-Revision-Date: 2013-11-12 09:04+0100\n"
7
  "Last-Translator: WP-Buddy <info@wp-buddy.com>\n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 2.0.7\n"
13
  "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
14
  "_n_noop:1,2;_c;_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_ex:1,2c;"
15
  "esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
readme.txt CHANGED
@@ -2,11 +2,11 @@
2
  Contributors: wp-buddy, floriansimeth
3
  Donate link: https://wp-buddy.com/products/plugins/google-analytics-opt-out/
4
  Tags: google analytics, analytics, analytics opt-out, analytics opt out, monster insights, monster insight, yoast analytics
5
- Version: 2.1.1
6
- Requires at least: 3.7
7
- Stable tag: 2.1.1
8
  Requires PHP: 5.6.0
9
- Tested up to: 4.9.4
10
  License: GPLv2
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -24,7 +24,7 @@ The free and the pro version have now been merged together. So you now can have
24
  == Installation ==
25
 
26
  * Install and activate the plugin via your WordPress Administration panel
27
- * Go the "Settings" -> "Analytics Opt Out" and enter your UA-code (you don't need this step if MonsterInsights plugin is active)
28
  * [Read the FAQ for more information.](https://wp-buddy.com/documentation/plugins/google-analytics-opt/faq/)
29
 
30
  == Frequently Asked Questions ==
@@ -40,6 +40,10 @@ The free and the pro version have now been merged together. So you now can have
40
 
41
  == Changelog ==
42
 
 
 
 
 
43
  = 2.1.1 =
44
  * Fixed an issue with Monster Insights 7: Submenu item was not visible
45
 
2
  Contributors: wp-buddy, floriansimeth
3
  Donate link: https://wp-buddy.com/products/plugins/google-analytics-opt-out/
4
  Tags: google analytics, analytics, analytics opt-out, analytics opt out, monster insights, monster insight, yoast analytics
5
+ Version: 2.1.2
6
+ Stable tag: 2.1.2
7
+ Requires at least: 4.8.0
8
  Requires PHP: 5.6.0
9
+ Tested up to: 4.9.6
10
  License: GPLv2
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
24
  == Installation ==
25
 
26
  * Install and activate the plugin via your WordPress Administration panel
27
+ * Go the "Settings" -> "Analytics Opt Out" and enter your UA-code (you don't need this step if MonsterInsights plugin is active).
28
  * [Read the FAQ for more information.](https://wp-buddy.com/documentation/plugins/google-analytics-opt/faq/)
29
 
30
  == Frequently Asked Questions ==
40
 
41
  == Changelog ==
42
 
43
+ = 2.1.2 =
44
+ * Fixed an issue where the opt-out code may not be on top of the sourcecode of some websites.
45
+ * Opt-Out settings field has been moved up on the settings page.
46
+
47
  = 2.1.1 =
48
  * Fixed an issue with Monster Insights 7: Submenu item was not visible
49