We have a feature request for your already awesome plugin.
We would like to have an option to exclude the analytics js code when a certain cookie is not set.
Our purpose is to have a website where only items that are non-EU cookie law restricted are shown. If the users chooses to accept cookies all other items (like google analytics) will be included.
The backend could have options like these:
checkbox -> [x] Check for certain cooke
inputbox -> ["myCookieName"] Cookie name
And in your code you could do a simple check like this:
function yoast_ga_do_tracking (line 1974)
if ( ( $current_user->user_level >= $yoast_ga_options["ignore_userlevel"] ) || !isset($_COOKIE["allow_cookies"])) return false; else return true;