Block cookies until user acceptance
-
Hello, as you already know in the EU (GDPR) and USA (CCPA) we need to let the user accept the cookies for using them locally. The law also says that the user must have the option to block third party cookies (as yours).
What would be the way to block cookies until the user accepts cookies?
Another plugins like WooCommerce Google Analytics Integration and Facebook for WooCommerce have hooks to enable or disable.
Maybe your plugin can have something similar, a filter that if returned true the files that load the cookies are disabled and if returned false, load scripts and cookies.
Here are some examples for those plugins using a plugin GDPR Cookie Compliance (CCPA ready)
/* disable Facebook cookies on gdpr_cookie plugin */ add_filter('facebook_for_woocommerce_integration_pixel_enabled', 'gdpr_cookie_facebook_wc', 20); function gdpr_cookie_facebook_wc() { $enable_fb_wc = true; if (function_exists('gdpr_cookie_is_accepted')) : $enable_fb_wc = gdpr_cookie_is_accepted('thirdparty'); endif; return $enable_fb_wc; } add_action('gdpr_force_reload', '__return_true'); /* 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');
Let me know your thoughts.
Thank you.
- The topic ‘Block cookies until user acceptance’ is closed to new replies.