Support » Plugin: GDPR Cookie Compliance (CCPA ready) » jQuery(…).moove_gdpr_read_cookies is not a function

  • Resolved markusdittrich

    (@markusdittrich)


    Hi!

    I’m trying to use the JS hook to read the cookies using javascript. I added this codesnippet to my functions.php from your hooks-page in the WP-backend:

    add_action( 'wp_footer', 'gdpr_js_extension', 1000 );
    function gdpr_js_extension() {
        echo "
            <script>
                jQuery(document).ready(function(){
                    var cookies_object = jQuery(this).moove_gdpr_read_cookies();
                    console.log('cookies_object', cookies_object);
                    if ( typeof cookies_object === 'object' ) {
                        console.log(cookies_object);
                    }
                });
            </script>";
    }

    But when visiting the frontend the console just states:
    Uncaught TypeError: jQuery(...).moove_gdpr_read_cookies is not a function

    It does work however, if I wrap the code in a 5 second timeout. Also this error does not occur with older version of the plugin. The last working version known to me is 4.5.2. Right now I’m, using the latest version 4.5.6.

    All the Best,
    Markus

  • You must be logged in to reply to this topic.