Google Analytics by Yoast
Feature req: Cookies set check (EU Law) (1 post)

  1. martijnh
    Posted 2 years ago #

    Hi Joost,

    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;
    		return true;


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Google Analytics by Yoast
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic