Support » Plugin: GDPR Cookie Compliance » Check if certain type of Cookie has been accepted or not

  • Resolved Joe Hana

    (@joehana)


    Hey,

    thanks for the great solution.

    I’ve been digging into the code to find some functions I could use to check if certain type of cookies (Strictly Necessary, 3rd Party, Additional) has been accepted or not in order to update one of my custom plugins to set a cookie or not (PHP), but couldn’t find anything useful. Can you perhaps point me in the right direction? Or maybe there is a developer documentation I was missing?

    Thanks a lot in advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • Check the value of the cookie set by this plugin. The value of the cookie changes, once the user changes his prefrences. I used simple JS to delete certain cookies as soon as the value of the moove_gdpr_popup cookie changes. It works fine for me. You can obtain the value of the cookie via JS or PHP.

    Plugin Author Gaspar Nemes

    (@gasparnemes)

    Hi there,

    Thanks for your comment.

    Please update the plugin to the latest version!
    I’ve created a hook for you to display (with console.log) the cookie values (object):

    function gdpr_js_extension() {
      ob_start();
      ?>
      <script>
      jQuery(document).ready(function(){
    	var cookies_object = jQuery(this).moove_gdpr_read_cookies();
    	if ( typeof cookies_object === 'object' ) {
    		console.log(cookies_object);
    		// YOUR CODE HERE
    	}
      });
      </script>
      <?php
      echo ob_get_clean();
    }
    add_action( 'wp_footer', 'gdpr_js_extension', 1000 );

    I hope this helps.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Check if certain type of Cookie has been accepted or not’ is closed to new replies.