Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author WebToffee

    (@webtoffee)

    Hi @123nadav,

    You can add it directly in your active child theme’s functions.php file or you can use a plugin like Code Snippets.

    Thread Starter Nadav Levi

    (@123nadav)

    is little problem “code snipet”

    can put it as a script in the header and footer plugin? as a script and not php?
    and what better from the 2 links?

    Thread Starter Nadav Levi

    (@123nadav)

    @webtoffee Please help? what is better?
    and if I can put a script and not PHP and a plugin of a “header and footer”?

    Thread Starter Nadav Levi

    (@123nadav)

    jquery script for delay gets errors.
    you use jquery and this feature is deprecated from WordPress 5.5.5

    the error:
    Uncaught ReferenceError: jQuery is not defined
    at VM119:266
    (anonymous) @ VM119:266

    when I remove your PHP script everything comeback normal
    you must provide new script to delay the pop up or async it

    Plugin Author WebToffee

    (@webtoffee)

    HI @123nadav,

    Please copy the below code to your active site theme’s functions.php towards the last line.

    add_action('wp_footer', 'wt_cli_delay_cookie_banner', 10);
    function wt_cli_delay_cookie_banner()
    {
    	if (class_exists('Cookie_Law_Info')) {
    	?>
    		<script>
    			jQuery(function() {
    				var timeDelay = 3000; //Time in milli seconds, 1000 ms = 1 second.
    				CLI.bar_elm.hide();
    				if (CLI.settings.notify_animate_show) {
    					CLI.bar_elm.css('visibility', 'hidden');
    				}
    				setTimeout(function() {
    					if (!CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)) {
    						if (CLI.settings.notify_animate_show) {
    							CLI.bar_elm.hide();
    							CLI.bar_elm.css('visibility', 'visible');
    							CLI.bar_elm.slideDown(CLI.settings.notify_animate_show);
    						} else {
    							CLI.bar_elm.show();
    						}
    					}
    				}, timeDelay);
    			});
    		</script>
    <?php
    	}
    }

    To fix the error in console, add below code too to functions.php

    add_filter('autoptimize_filter_js_exclude','jquery_toggle');
    function jquery_toggle($in) {
        if ( is_single() ) {
            return $in.',js/jquery/jquery.js';
        }
        else {
            return $in;
        }
    }
    Thread Starter Nadav Levi

    (@123nadav)

    @webtoffee still have errors:
    https://locksmithunit.com
    I put them in the Code Snippets plugin you recommended to me.
    I put them in the order you tell me…
    what to do?
    Still got VM error with jquery

    Thread Starter Nadav Levi

    (@123nadav)

    I don’t think it will work properly…
    you create PHP of time delay…
    Is not async
    the script still goes up and holds all the system to be executed…

    I test the optimized CSS… is not good as well (don’t have errors, but nothing not happened to the CSS or don’t have any improvement)

    bro you need to work on your plugin…
    You must optimize your plugin, is heavy, very heavy, site goes down in pagespeed
    very bad…

    no option to control the script with DEFER or ASYNC.

    your plugin is Super useful and must be on any website.
    but optimization is very bad bro, even the PHP you created in Github.
    very bad.

    this is not optimized for google or for any kind of website.

    Plugin Author WebToffee

    (@webtoffee)

    Hi @123nadav,

    You collected that code from this thread and the requester of that thread was asking about how to implement the delay. So the solution would be to address that. You may please remove that code.

    To add defer attribute, we have developed another code. Kindly try adding this code via Code Snippets plugin. Add it a new snippet and activate.

    Thread Starter Nadav Levi

    (@123nadav)

    the defer code working.
    but still is slow… you need to use ASYNC is much better.

    if you developed new code with ASYNC i be very glad.

    another thing is the CSS-optimized cookies:
    https://gist.github.com/wtmujeebu/a941b8bff26a4239fe0b60d8de30d285
    I can add this as well to the snippet plugin?

    Thread Starter Nadav Levi

    (@123nadav)

    The defer not help in the speed of the site…
    I think it needs to be a script going on the footer maybe.

    you can test by yourself:
    locksmithunit.com

    and identical site in Spanish without the script:
    locksmithunit.es

    https://developers.google.com/speed/pagespeed/insights/

    you can test by yourself you look don’t have any different.

    this because you do not use async.
    or “function” him in the footer maybe?

    Thread Starter Nadav Levi

    (@123nadav)

    Very bad.
    your plugin slows the site… but seriously… you must do something about the plugin…
    is insane.

    • This reply was modified 3 years, 9 months ago by Nadav Levi.
    Plugin Author WebToffee

    (@webtoffee)

    Hi @123nadav,

    Thank you for your feedback and apologies for the inconvenience caused. Some performance improvements are already in our plans, so stay tuned for plugin updates.

    Thread Starter Nadav Levi

    (@123nadav)

    @webtoffee
    your plugin is very good to the GDPR.
    But the scripts run and the PHP is insane…

    before that, I was with a pop-up CDN.
    if you want I can provide you the code.

    I actually was thinking to save your plugin but remove the pop-up himself.
    (and put script from my own):

    <link rel="stylesheet" type="text/css" href="/cookieconsent.min.css"/><script src="https://cdn.wpcc.io/lib/1.0.2/cookieconsent.min.js" defer></script><script>window.addEventListener("load", function(){window.wpcc.init({"colors":{"popup":{"background":"#222222","text":"#ffffff","border":"#f9f9f9"},"button":{"background":"#f9f9f9","text":"#000000"}},"position":"bottom","content":{"href":"https://locksmithunit.es/politica-de-privacidad/","message":"Este sitio web utiliza cookies. Al continuar navegando por el sitio web, acepta nuestro uso de cookies. Más información:","link":"Politica de Cookies"},"padding":"none","corners":"small","margin":"small","transparency":"10","fontsize":"tiny","border":"thin"})});</script>`

    possible to do stuff like this?
    and hide your popup?
    maybe to add a shortcode from your plugin to my popup? (combine them somehow)

    my pop up is very fast, but your plugin is cover much more GDPR CCPA rules (help SEO).

    Please help

    Thread Starter Nadav Levi

    (@123nadav)

    @webtoffee please tell me if i can use my script with your shortcode.

    and if you can provide a PHP for the snippet plugin for removing your pop-up.
    (but to keep the plugin active! is very good plugin)

    i do it because my pop up much more lighter.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Async? Defer?’ is closed to new replies.