pressidium / pressidium-cookie-consent

🍪 Lightweight, user-friendly and customizable cookie consent banner to help you comply with the EU GDPR cookie law and CCPA regulations.
https://wordpress.org/plugins/pressidium-cookie-consent/
GNU General Public License v2.0
45 stars 2 forks source link

Don't print cookie blocking script if there are no scripts to block #6

Closed joppuyo closed 1 year ago

joppuyo commented 1 year ago

Hello!

I am manually managing script blocking via setting parameters type="text/plain" and data-cookiecategory="analytics" on analytics script tags. However, I noticed that the script pressidium-cookie-consent/public/block-scripts.js is still placed in the document head. Since this is a render-blocking script I'm a bit worried that it might have an effect on page loading performance.

I do understand that it needs to be a blocking script rather than an async one so it can manage other scripts on the page but I'm not sure if it needs to be loaded if there are no blocked scripts defined in the plugin admin page. Would it be possible to only place this script in the page head if there are blocked scripts defined?

Thanks!

over-engineer commented 1 year ago

Hey, @joppuyo!

Thank you for sharing your valuable feedback once more.

You’re absolutely right! The /public/block-scripts.js script is a render-blocking script and it’s best to avoid loading it when it’s not needed.

The issue was addressed in 1.0.3, which was just released on the Plugin Directory.

joppuyo commented 1 year ago

Thank you for the fast response. I updated the plugin and the script is now gone 🙂