• Hello

    I saw that a few cookie disclaimer plugins provide additionally to the PHP cookie check

    (if ( function_exists('cn_cookies_accepted') && cn_cookies_accepted() ) {
    )

    a shortcode such as [cookie] and [/cookie]. This would allow the WordPress administrator to manage the e.g. google tracking code within the Customizer as he’s used to.
    Could this be added as a feature request?

    Thank you in advance for your feedback!

    Cheers, Jo?l

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author dFactory

    (@dfactory)

    Sure, good idea.
    Adding to our todo list.

    Thread Starter joelschmid

    (@joelschmid)

    Hello @dfactory

    I got the following response from WP Rocket:

    I’ve been able to reproduce the issue you described on my own site.

    However, the behavior does conform to how our compatibility code for this plugin is currently written, in that it creates two versions of the page, one for when the cookie is set, and one for when the cookie isn’t set.

    That being said, I can see how this causes an issue when you’re using the Script blocking feature of the plugin to include a script only once the cookie is accepted — once the page is already cached without the cookie, the script won’t be included until the cache for that page has been cleared and regenerated with the cookie.

    Maybe this helps you to adapt it on your end if it’s easier? Otherwise I would recommend you to get in touch with WP Rocket directly.

    Cheers, Jo?l

    Thread Starter joelschmid

    (@joelschmid)

    Hello

    The Script Blocking is now working with WP Rocket if you activate separate cache files for mobile devices.
    To do that, go to WP Rocket settings > Cache tab > and enable “Separate cache files for mobile devices” > Save settings.

    Furthermore, the website has to be (automatically) reloaded in order that the tracking code appears.

    Would it be possible to implement the blocking tracking code with JavaScript, so that the tracking code gets implemented without reloading the page?

    Thank you in advance for your help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Creating a shortcode to use in e.g. customizer’ is closed to new replies.