• First of all, congratulations to the creator for this fabulous plugin. I have a problem I do not understand how I should block a cookie until the user has given his consent.

    I can block or unblock the Google Analytics cookie. No problem, it works for me. I got the code here: https://gdpr-wp.com/knowledge-base/enabling-or-disabling-functionality-based-on-consent-and-cookies/

    But what about the other cookies ?? I use the following code but it doesn’t work. I got a mistake 500. I insert the code in the functions.php :

    add_action( 'wp_head', 'preferences' );
    function preferences() {
      if ( ! has_consent( 'Préférences' ) || ! is_allowed_cookie( '_AVESTA_ENVIRONMENT' ) )  }

    Please help me! Please!

    Thank you

Viewing 15 replies - 16 through 30 (of 43 total)
  • I am not sure how this works either – let’s try an example:

    If I have say an embedded YouTube video on one of my website pages which uses an iframe and this iframe code causes some cookies to be set, for example:

    @@History/@@scroll|#
    GPS
    PREF
    VISITOR_INFO1_LIVE
    YSC

    Would I simply add the following to the page? (What if one item of code sets multiple cookies?)

    is_allowed_cookie( ‘@@History/@@scroll|#’‘GPS’ ‘PREF’ ‘VISITOR_INFO1_LIVE’ ‘YSC’ ){

    -Put the iframe code here-

    }

    And then make sure that there is a cookie category of Marketing (for example) with all of these cookies listed in it @@History/@@scroll|#, GPS, PREF, VISITOR_INFO1_LIVE, YSC in GDPR plug-in and set to off by default?

    Is that all I have to do? Will that stop the cookies being set (and the video from showing) until they consent? Or is more code required? For instance code set in functions.php to make it work and if so what would that code be?

    Additional questions:

    1.) What if the cookies set by a single item of code such as above are cookies of different classes e.g. Marketing and Statistics?

    2.) Is consent for cookies recorded anywhere? or only if logged in because most sites don;t require people to login so what happens if they never login? There must be a way to record consent by a cookie and allocate to an IP which is encrypted? Is this required for GDPR?

    @the-pixel-freak

    Unfortunately it is not that easy. For every cookie you use you have to add a script to enable/disable it. And believe me, you have to take your time for that, because it will costs some time.

    Grtz

    Thread Starter imloic

    (@imloic)

    Well ! No im using a cache plugin (W3TC)

    Some solutions to block _ga with javascript ? How to insert in function.php or header.php please ?

    Thanks
    Loïc

    @thedarkeye

    Maybe can help me 🙂

    • This reply was modified 5 years, 10 months ago by imloic.

    @imloic

    Im sorry, i do not really understand what your problem is at the moment.
    Could you explain it to me more specific?

    Grtz

    Thread Starter imloic

    (@imloic)

    i use a cache plugin. My actual code do not work anymore. Because i use a cache plugin now. With cache plugin google analytcis is always load :((

    • This reply was modified 5 years, 10 months ago by imloic.
    Christian

    (@visualframeworks)

    window ga disabled does not remove the cookies after they are set.

    Another issue is, when you use a cache plugin. The window ga disabled will stay in cache… ;( Havent found a way to disable cache for the head right now…

    Thread Starter imloic

    (@imloic)

    @visualframeworks

    yep, so bad 🙁

    yea then is the question if some sort of cache plugin like that, is still allowed.

    Did you tried it on another pc to test it? does it still not disable?

    Thread Starter imloic

    (@imloic)

    yes, at home and at work.

    Hmm, is that cache plugin that important? Otherwise i should deactivate it, since GDPR is pretty important.

    I can not say much about it unfortunately, i am nog using a cache plugin.

    Christian

    (@visualframeworks)

    Tried it with several browsers and devices and all the same. If you visit the website and you decide to allow _ga (or other cookies), the second person wich descides to NOT allow these cookies will be trackable (visit the same pages as the first one). And vice versa.

    • This reply was modified 5 years, 10 months ago by Christian.
    • This reply was modified 5 years, 10 months ago by Christian.

    Yea, and the problem with that is that if the visitor doesn’t want that, it is his/her right to have it turned off. If you can’t do that, i would create a privacy policy were you explain why its turned on. Or simply delete the cache plugin.

    Christian

    (@visualframeworks)

    I am trying to solve it in this way. To set a cookie – but it will not work.
    Could someone gimme a hand? I need to delete the cookie. That does not work.

    add_action( 'init', 'gdpr_ga_opt_out' );
    function gdpr_ga_opt_out() {
    	if ( ! is_allowed_cookie( '_ga' ) ) {
    		$cookie_name = 'ga-disable-UA-XXXXXXXX-X';
    		$cookie_value = 'true';
    		setcookie($cookie_name, $cookie_value, time() + (86400 * 30), '/');
    	}
    }
    add_action( 'init', 'gdpr_ga_opt_in' );
    function gdpr_ga_opt_in() {
    	if ( is_allowed_cookie( '_ga' ) ) {
                    $cookie_name = 'ga-disable-UA-XXXXXXXX-X';
                    unset($_COOKIE[$cookie_name]);
                    $res = setcookie($cookie_name, '', time() - 3600);
            }
    }
    • This reply was modified 5 years, 10 months ago by Christian.

    @visualframeworks : On a shared device, it is impossible to know that there has been a change of user and thus a change of possible consents, if the visitor is not logged. This should be specified in the privacy policy with a link to how to clear the cookie cache. But the second visitor “inherits” cookies from the “first” at first load. The good reflex is to clear the browser cache when we sit in front of a shared device.

    You are still using the cache plugin? Because thats really not going to work.
    Probably google still needs to fix that.

    Also, what error do you get in the console, do you have a screenshot for me?

Viewing 15 replies - 16 through 30 (of 43 total)
  • The topic ‘How to block cookies ? Other than _ga’ is closed to new replies.