Support Forum Support Forum GDPR Cookie Compliance Shortcode for specifik content after consent

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • Premium
    June 22, 2022 @ 7:45 pm

    Hi,

    I have built a simple shortcode that basically calls your “PHP cookie checker” -snippet.
    so that if gdpr_cookie_is_accepted is true, my content appear otherwise a message displays that cookie consent is needed.

    [myshortcode]Display this after consent[/myshortcode]

    This is working perfect if I view my page logged in as admin however if I’m logged out it does not work at all which would indicate that it’s cache related.
    I’m on WP Engine hosting and only use their cache.

    Could you please help me get this working?

    …is there a way I can paste my code here, if it would be of help?

    Thanks!
    /Anders

     

    Moove Agency
    June 23, 2022 @ 8:18 am

    Hi Anders,

    Thanks for using our plugins.

    The shortcode you created sounds very good!

    You can try to excluding our plugin cookies from cache plugins (if used) using the troubleshooting tip 2:

    We also use WP Engine, so if the above doesn’t hep, please feel free to upload or share the code with us so that we can test it on our end.

    Hope this helps.

    Premium
    June 23, 2022 @ 10:20 am

    Hi,

    I’m not using any cache plugins only default WP Engine cache.

    I’m not sure how I could exclude your plugin assets through WP Engine platform?

    Here is the code I’m using:

    function godkcookie_function( $atts, $content = null ) {
    if ( function_exists( 'gdpr_cookie_is_accepted' ) ) {
    /* supported types: 'strict', 'thirdparty', 'advanced' */
    if ( gdpr_cookie_is_accepted( 'thirdparty' ) ) {
    return $content;
    } else {
    return 'cookie not yet start accepted';
    }
    }
    }
    add_shortcode('godkcookie', 'godkcookie_function');
    add_action( 'gdpr_force_reload', '__return_true' );

     

    Thanks!
    /Anders

    Moove Agency
    June 24, 2022 @ 8:23 am

    Hi Anders,

    Are you testing this functionality in a private browsing window to ensure that your local cache doesn’t interfere?

    Premium
    June 24, 2022 @ 10:59 am

    Hi again,

    I have tested in a private window but my shortcode does not work there either (default Moove show script after consent -functionality works normal).

    When I’m logged in as admin my shortcode is working perfect.

    Are you able to reproduce this ?

    Thanks!

     

    Moove Agency
    June 28, 2022 @ 5:38 pm

    Hi Anders,

    You can read about WPEngine cookie limitations here:

    https://wpengine.com/support/cookies-and-php-sessions/

    Our PHP cookie checker functions are built to use $_COOKIE[‘moove_gdpr_popup’] which is cached on WPEngine.

    You have the following options:

    1) Speak to WPEngine support team and ask to exclude the “moove_gdpr_popup” cookie for you

    2) You can remove the PHP cookie checker, create your shortcode to be always part of the page content but make it hidden. Using our JavaScript functions from Help section, you can implement a JavaScript conditional to show the shortcode content based on cookies. This method won’t be cached on WPEngine.

    Hope this helps.

    Premium
    July 04, 2022 @ 6:32 am

    Thank you for your reply,

    Is there any chance you could provide a small codesnippet to help me on the way with this?

    I have been looking at “Read cookie values with JavaScript” from “documentation” > “default hooks” but not really sure how to implement

    Thanks!

     

Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Shortcode for specifik content after consent’ is closed to new replies.

MooveAgency - Support Forum
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.