Support » Plugin: EU Cookie Law (GDPR) » Block script in the header

  • Hello @milmor and staff,
    is it possible to block script by wrapping in this way? <!-COOKIE-BLOCK-START–> <script> <!–COOKIE-BLOCK-END–>

    I want to block a script in my header but if I use the shortcode [cookie][/cookie] it appears at the top of the page the grey banner that say to accept cookies. And it breaks a little bit the structure of the website, as is in the header.

    So I’m wondering if is possible to block a script in the header with another code like <!-COOKIE-BLOCK-START–> <!–COOKIE-BLOCK-END–> that doesn’t show the banner but only block the script before user accept.

    Thank you.
    I look forward to hearing from you soon.
    Kind regards,

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Marco Milesi

    (@milmor)

    Hi,
    if you want to exclude a script, you can type between <script> and </script> the string eucookielaw_exclude.
    Ex. add class=”eucookielaw_exclude” or a comment.
    https://wordpress.org/plugins/eu-cookie-law/#faq

    Hi Marco,
    thank you very much for your answer.
    Now I’ve understood and solved the issue.
    Thank you!
    Have a great evening!
    Kind regards,

    Hi @milmor,
    unfortunately you confuse my question and then I tried to follow your advise but it doesn’t work.

    Your plugin doesn’t block all scripts. I have asked a way to block some scripts and you answered a way to EXCLUDE scripts. It is not the same thing!!!

    If you please read carefully the first post you will see: <<I want to block a script in my header but if I use the shortcode [cookie][/cookie] it appears at the top of the page the grey banner that say to accept cookies. And it breaks the structure of the website, as is in the header.>>

    So please I’m expecting a way to block a script and not to exclude it!
    Please I wasted all the day to try to use the code you told me to use but it is WRONG.

    I know this support is for free but please a bit of attention to the request.

    I look forward to hearing from you soon.
    Kind regards,

    Plugin Author Marco Milesi

    (@milmor)

    The plugin should automatically block scripts if auto block enabled.
    There are also php functions to check cookie consent, as written in our faqs.

    • This reply was modified 9 months, 3 weeks ago by  Marco Milesi.

    No the plugin doesn’t block scripts like analytic scripts or other if they are in the header or in the footer and are integrated through wordrpress theme.

    For this reason I’ve asked if is possible to tag the script in some way for blocking manually. I cannot wrap these scripts with shortcodes as they are not in the wordpress editor.

    But I can block them if there was a class that instead of say EXCLUDE it says INCLUDE eg. class=”eucookielaw_INCLUDE”. Is it possible? It should be an easy way.

    Instead you are suggesting me to put a function on functions.php to check consent before running the script is right?

    Thanks for your collaboration.

    Plugin Author Marco Milesi

    (@milmor)

    You can also use the functions in your theme templates.
    For example, if the script is in the header.php you can use it 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Block script in the header’ is closed to new replies.