I have just uploaded the version 2.3 of Easy Cookie Law WordPress plugin. The update comes with two major features:
There is however a manual action required if you also want to show de <noscript> version of the code on the body. You will have to put a PHP line of code in your theme, just after the HTML <body>
tag:
If you want to put the tracking code just after the opening of the <body>
tag as Google recommends, there is also an option:
First, you also have to manually put this other PHP line in your theme (normally in the header.php) there where you want to have the code, also, after the opening of the the <body>
tag:
Second, select the option “Let me manually print the GMT code for the header where I want”. With this option selected, the code will be echoed via the PHP line you just inserted in your theme and not via the wp_head
action hook as it normally is.
One of the functions work with JavaScript and it is called ecl_is_cookie_accepted()
. You can call it whenever you want like this:
The same function is available in PHP. But take care, it may not work depending on which cache plugin you are using in case you are using any:
In the next days, I will be extending the functions to make it compatible with other plugins and scripts.
If you have any question or proposal, do not hesitate to contact me!