Disable scripts based on user cookie selection
-
Hello, we use a GDPR plugin to let the user decide if using cookies or not.
Does you plugin have some hook or action for us to use and activate the google scripts or not? (based on some user action)
For example with other plugins we use something like:
/* disable Google Analytics on gdpr_cookie plugin */ add_filter('woocommerce_ga_disable_tracking', 'gdpr_ga_integration_wc', 20); function gdpr_ga_integration_wc($disable_ga_wc) { if (function_exists('gdpr_cookie_is_accepted')) : if (!gdpr_cookie_is_accepted('thirdparty')) : $disable_ga_wc = true; endif; endif; return $disable_ga_wc; } add_action('gdpr_force_reload', '__return_true');
In this example the plugin we are blocking is the WooCommerce Google Analytics Integration and has one filter we can hook and enable or disable the plugin:
add_filter('woocommerce_ga_disable_tracking', 'gdpr_ga_integration_wc', 20);
Thank you.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Disable scripts based on user cookie selection’ is closed to new replies.