Hello,
Thanks for using our plugin!
You will need to remove the script from your Google Analytics Dashboard For WordPress plugin, otherwise, your GA script will be added twice to your site.
Hope this helps.
Hi @mooveagency,
I had a similar question. Some other, similar plugins include functions that can be accessed in functions.php to check whether a user has accepted the cookie agreement, etc., so that you can disable GA using the ga-disable-xxxxx cookie.
As an example with monster insights, let’s imagine that your plugin included a function called moove_third_party_cookies_accepted
which would tell us if a user had accepted third party cookies. This code might look like:
add_action( 'init', 'toggle_monster_insights_based_on_moove' );
function toggle_monster_insights_based_on_moove() {
if ( function_exists( 'moove_third_party_cookies_accepted' ) && function_exists('monsterinsights_get_ua')) {
if ( moove_third_party_cookies_accepted() ) {
setCookie( 'ga-disable-'.monsterinsights_get_ua(), 'false' );
}else{
setCookie( 'ga-disable-'.monsterinsights_get_ua(), 'true' );
}
}
}
Otherwise, would it be recommended to do something such as:
$cookie = isset($_COOKIE) && isset($_COOKIE["moove_gdpr_popup"]) ? $_COOKIE["moove_gdpr_popup"] : "";
$decoded = urldecode($cookie);
$json = json_decode($decoded, true);
if(isset($json) && isset($json["thirdparty"]) && $json["thirdparty"] == "1"){
setCookie( 'ga-disable-XXXXXX-X', 'false' );
} else {
setCookie( 'ga-disable-XXXXXX-X', 'true' );
}
?
-
This reply was modified 5 years, 1 month ago by
cmborchert.
Hi @cmborchert,
Sorry for the late reply on this.
Please update the plugin to the latest (1.3.0) version, we’ve implemented PHP cookie checking functions like:
gdpr_cookie_is_accepted( 'strict' )
gdpr_cookie_is_accepted( 'thirdparty' )
gdpr_cookie_is_accepted( 'advanced' )
So using the functions above, you can disable the Facebook plugin for WooCommerce using the following code snippet:
function third_party_cookies_accepted () {
$enabled = false;
if ( function_exists( 'gdpr_cookie_is_accepted' ) ) :
$enabled = gdpr_cookie_is_accepted( 'thirdparty' );
endif;
return $enabled;
}
add_action( 'gdpr_force_reload', '__return_true' );
Note: Don’t forget to enable the force_reload once the code snippet is added (gdpr_force_reload hook from the snippet above)!
I hope this helps.