Version Description
- Fixed: Banner did not stay closed if someone clicked on the info icon and/or the shortcode link.
- Fixed: Browser warnings because of missing SameSite Cookie attributes.
- Fixed: MonsterInsights showed a warning because of multiple occurrences of the UA-Code number.
Download this release
Release Info
Developer | wp-buddy |
Plugin | Google Analytics Opt-Out |
Version | 2.3.4 |
Comparing to | |
See all releases |
Code changes from version 2.3.3 to 2.3.4
- google-analytics-opt-out.php +2 -2
- inc/frontend.php +1 -2
- inc/functions.php +1 -1
- inc/scripts.php +14 -2
- js/frontend.js +15 -10
- readme.txt +9 -3
google-analytics-opt-out.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Plugin Name: Google Analytics
|
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.3.
|
7 |
Author: WP-Buddy
|
8 |
Author URI: https://wp-buddy.com
|
9 |
License: GPL2
|
1 |
<?php
|
2 |
/*
|
3 |
+
Plugin Name: Opt-Out for Google Analytics
|
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.3.4
|
7 |
Author: WP-Buddy
|
8 |
Author URI: https://wp-buddy.com
|
9 |
License: GPL2
|
inc/frontend.php
CHANGED
@@ -53,12 +53,11 @@ function gaoop_footer() {
|
|
53 |
|
54 |
printf(
|
55 |
'<input type="checkbox" class="gaoop-checkbox" id="gaoop_checkbox" />'
|
56 |
-
. '<div data-
|
57 |
. '<label for="gaoop_checkbox" class="gaoop-info-icon" title="%s">%s</label>'
|
58 |
. '<div class="gaoop-opt-out-content">%s</div>'
|
59 |
. '<label for="gaoop_checkbox" class="gaoop-close-icon" title="%s">%s</label>'
|
60 |
. '</div>',
|
61 |
-
gaoop_get_ua_code(),
|
62 |
intval( get_option( 'gaoop_hide', 0 ) ),
|
63 |
esc_attr( __( 'Google Analytics Opt-Out Information', 'google-analytics-opt-out' ) ),
|
64 |
$info_icon,
|
53 |
|
54 |
printf(
|
55 |
'<input type="checkbox" class="gaoop-checkbox" id="gaoop_checkbox" />'
|
56 |
+
. '<div data-gaoop_hide_after_close="%d" class="gaoop gaoop-hidden">'
|
57 |
. '<label for="gaoop_checkbox" class="gaoop-info-icon" title="%s">%s</label>'
|
58 |
. '<div class="gaoop-opt-out-content">%s</div>'
|
59 |
. '<label for="gaoop_checkbox" class="gaoop-close-icon" title="%s">%s</label>'
|
60 |
. '</div>',
|
|
|
61 |
intval( get_option( 'gaoop_hide', 0 ) ),
|
62 |
esc_attr( __( 'Google Analytics Opt-Out Information', 'google-analytics-opt-out' ) ),
|
63 |
$info_icon,
|
inc/functions.php
CHANGED
@@ -23,7 +23,7 @@ function gaoop_yoast_plugin_active() {
|
|
23 |
*/
|
24 |
function gaoop_monster_insights_plugin_active() {
|
25 |
|
26 |
-
return function_exists( '
|
27 |
}
|
28 |
|
29 |
/**
|
23 |
*/
|
24 |
function gaoop_monster_insights_plugin_active() {
|
25 |
|
26 |
+
return function_exists( 'MonsterInsights' );
|
27 |
}
|
28 |
|
29 |
/**
|
inc/scripts.php
CHANGED
@@ -17,14 +17,18 @@ function gaoop_js() {
|
|
17 |
<script type="text/javascript">
|
18 |
/* Google Analytics Opt-Out 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;
|
29 |
<?php echo apply_filters( 'gaoop_cookie_set', '' ); ?>
|
30 |
}
|
@@ -35,7 +39,15 @@ function gaoop_js() {
|
|
35 |
<?php
|
36 |
}
|
37 |
|
38 |
-
add_action( '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
|
41 |
/**
|
17 |
<script type="text/javascript">
|
18 |
/* Google Analytics Opt-Out by WP-Buddy | https://wp-buddy.com/products/plugins/google-analytics-opt-out */
|
19 |
<?php do_action( 'gaoop_js_before_script' ); ?>
|
20 |
+
<?php if(gaoop_monster_insights_plugin_active()): ?>
|
21 |
+
var gaoop_disable_str = disableStr;
|
22 |
+
<?php else: ?>
|
23 |
var gaoop_property = '<?php echo $ua_code; ?>';
|
24 |
var gaoop_disable_str = 'ga-disable-' + gaoop_property;
|
25 |
+
<?php endif; ?>
|
26 |
if (document.cookie.indexOf(gaoop_disable_str + '=true') > -1) {
|
27 |
window[gaoop_disable_str] = true;
|
28 |
}
|
29 |
|
30 |
function gaoop_analytics_optout() {
|
31 |
+
document.cookie = gaoop_disable_str + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; SameSite=Strict; path=/';
|
32 |
window[gaoop_disable_str] = true;
|
33 |
<?php echo apply_filters( 'gaoop_cookie_set', '' ); ?>
|
34 |
}
|
39 |
<?php
|
40 |
}
|
41 |
|
42 |
+
add_action( 'plugins_loaded', 'gaoop_plugins_loaded' );
|
43 |
+
|
44 |
+
function gaoop_plugins_loaded() {
|
45 |
+
if ( gaoop_monster_insights_plugin_active() ) {
|
46 |
+
add_action( 'monsterinsights_tracking_after', 'gaoop_js' );
|
47 |
+
} else {
|
48 |
+
add_action( 'wp_head', 'gaoop_js', 0 );
|
49 |
+
}
|
50 |
+
}
|
51 |
|
52 |
|
53 |
/**
|
js/frontend.js
CHANGED
@@ -8,13 +8,13 @@
|
|
8 |
}
|
9 |
|
10 |
var $gaoop = document.querySelector('.gaoop');
|
11 |
-
var
|
12 |
|
13 |
function gaoop_to_infobox() {
|
14 |
$gaoop_checkbox.checked = true;
|
15 |
}
|
16 |
|
17 |
-
var opted_out = document.cookie.indexOf(
|
18 |
var closed_box = document.cookie.indexOf('gaoop_hide_info=true') >= 0;
|
19 |
var hide_after_close = 1 === parseInt($gaoop.dataset.gaoop_hide_after_close);
|
20 |
|
@@ -52,21 +52,26 @@
|
|
52 |
if ($info_button) {
|
53 |
$info_button.addEventListener('click', function () {
|
54 |
/* destroy cookie */
|
55 |
-
document.cookie = 'gaoop_hide_info=true; expires=Thu, 31 Dec 1901 23:59:59 UTC; path=/';
|
56 |
});
|
57 |
}
|
58 |
|
59 |
|
60 |
/**
|
61 |
-
*
|
62 |
*/
|
63 |
-
var $
|
64 |
-
if ($
|
65 |
-
$
|
66 |
-
|
|
|
67 |
|
68 |
-
|
69 |
-
|
|
|
|
|
|
|
|
|
70 |
}
|
71 |
});
|
72 |
}
|
8 |
}
|
9 |
|
10 |
var $gaoop = document.querySelector('.gaoop');
|
11 |
+
var disable_str = window.disableStr || window.gaoop_disable_str;
|
12 |
|
13 |
function gaoop_to_infobox() {
|
14 |
$gaoop_checkbox.checked = true;
|
15 |
}
|
16 |
|
17 |
+
var opted_out = document.cookie.indexOf(disable_str + '=true') >= 0;
|
18 |
var closed_box = document.cookie.indexOf('gaoop_hide_info=true') >= 0;
|
19 |
var hide_after_close = 1 === parseInt($gaoop.dataset.gaoop_hide_after_close);
|
20 |
|
52 |
if ($info_button) {
|
53 |
$info_button.addEventListener('click', function () {
|
54 |
/* destroy cookie */
|
55 |
+
document.cookie = 'gaoop_hide_info=true; expires=Thu, 31 Dec 1901 23:59:59 UTC; SameSite=Strict; path=/';
|
56 |
});
|
57 |
}
|
58 |
|
59 |
|
60 |
/**
|
61 |
+
* Keep the banner closed
|
62 |
*/
|
63 |
+
var $checkbox = document.querySelector('#gaoop_checkbox');
|
64 |
+
if ($checkbox) {
|
65 |
+
$checkbox.addEventListener('change', function () {
|
66 |
+
if (this.checked) {
|
67 |
+
document.cookie = 'gaoop_hide_info=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; SameSite=Strict; path=/';
|
68 |
|
69 |
+
if (hide_after_close) {
|
70 |
+
$gaoop.classList.add('gaoop-hidden');
|
71 |
+
}
|
72 |
+
} else {
|
73 |
+
document.cookie = 'gaoop_hide_info=false; expires=Thu, 31 Dec 2000 23:59:59 UTC; SameSite=Strict; path=/';
|
74 |
+
$gaoop.classList.remove('gaoop-hidden');
|
75 |
}
|
76 |
});
|
77 |
}
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
=== Google Analytics
|
2 |
Contributors: wp-buddy, floriansimeth
|
3 |
Donate link: https://wp-buddy.com/products/plugins/google-analytics-opt-out/
|
4 |
Tags: google analytics opt-out, monster insights, gdpr, dsgvo
|
5 |
-
Version: 2.3.
|
6 |
-
Stable tag: 2.3.
|
7 |
Requires at least: 4.8.0
|
8 |
Tested up to: 5.5
|
9 |
Requires PHP: 5.6.0
|
@@ -42,6 +42,12 @@ The free and the pro version have now been merged together. So you now can have
|
|
42 |
|
43 |
== Changelog ==
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
= 2.3.3 =
|
46 |
* Fixed: [google_analytics_optout_close] shortcode did not close the popup
|
47 |
|
1 |
+
=== Opt-Out for Google Analytics ===
|
2 |
Contributors: wp-buddy, floriansimeth
|
3 |
Donate link: https://wp-buddy.com/products/plugins/google-analytics-opt-out/
|
4 |
Tags: google analytics opt-out, monster insights, gdpr, dsgvo
|
5 |
+
Version: 2.3.4
|
6 |
+
Stable tag: 2.3.4
|
7 |
Requires at least: 4.8.0
|
8 |
Tested up to: 5.5
|
9 |
Requires PHP: 5.6.0
|
42 |
|
43 |
== Changelog ==
|
44 |
|
45 |
+
|
46 |
+
= 2.3.4 =
|
47 |
+
* Fixed: Banner did not stay closed if someone clicked on the info icon and/or the shortcode link.
|
48 |
+
* Fixed: Browser warnings because of missing SameSite Cookie attributes.
|
49 |
+
* Fixed: MonsterInsights showed a warning because of multiple occurrences of the UA-Code number.
|
50 |
+
|
51 |
= 2.3.3 =
|
52 |
* Fixed: [google_analytics_optout_close] shortcode did not close the popup
|
53 |
|