I notice that there are still active posts online questioning how to implement your website to support the EU Cookie Law. That's why I am posting this quick high-level solution for this.
Keep in mind that there are two types of cookies: primary (bare minimum that your code needs to operate), and non-essential cookies (these get created when you have some third-party analytics on your site). The EU law allows you to use the primary cookies and you have to give an option to user to opt out of non-essential cookies.
Therefore a lot of websites have a banner at the top of the page that allows users to opt out and they actually use a primary cookie to know that the person opted out. Then the rest of functionality on your site can use the existence of this special primary cookie and the value in it to allow the analytics to even run on the site.
I hope this helps. Thanks.
keywords: #cookies #EULaw #cookielaw #tech #websites #softwareengineering #softwaredevelopment #programming #programmer #developers