How To Easily Setup Adsense An EU Cookie Consent Policy

I’ve been reading more and more about the new EU Cookie Consent policy as it relates to Adsense and getting more concerned by the day.  If you didn’t already know, the clowns in charge over in the EU (that’s European Union, like Great Briton, France, Germany, and a few more) have decreed that they will be making the internet safer for all of it’s citizens by forcing website owners to publish a Cookie Consent Policy.  Not only must it be published, but the visitor must give consent for you to use cookies during their browsing session.  My first thought wasfuck those EU retards, I’ll block ’em all! See how they like that!“.  But after cooling down and thinking about it more, I decided to find a less drastic way to deal with it.

Since my main website runs an older version of Drupal my choices of a simple plug-in or module are limited. I wanted something that would give the required warning before any cookies are sent, give them the choice to stay or go, and only bother people visiting from countries in the EU. I didn’t find anything that I liked that was also compatible with my site so I had to go to plan-B.


I remembered that Cloudflare can block or ‘challenge’ by country.  This ‘challenge’ displays a web-page and requires a CAPTCHA form to be filled out before continuing.  Since this particular website already uses Cloudflrae I decided to see how difficult it would be to create custom rules and a custom challenge-page to make the dipshits in charge at the EU happy.  Turns out, it was pretty simple.

First, I had to setup the Cloudflare Firewall Rules. This is pretty simple by just entering the two-letter country code for all 28 countries that comprise the EU.  To get the specific country code for each country Google it or go here: Internet Country Codes

Entering the country code in your Cloudflare firewall is easy. Just type it in and select “challenge”:Cloudflare country blocking


After entering all the EU country codes, you can then customize your “Challenge Page”. This is the page that will be shown to visitors coming from the countries that you’ve set to “challenge”.

Custom challenge page in Cloudflare


For your challenge page you will need to create a static HTML page that is hosted “outside” of your Drupal (or WordPress, Joomla, etc) installation.  If you use your CMS to create the page a cookie would be served up when displaying it, violating the EU cookie law. Imagine the horror!!  To make the CAPTCHA show, be sure to add the text “::CAPTCHA_BOX::” where you want the CAPTCHA form to be displayed.

Make sure your .HTML file is uploaded to your server and add it to Cloudflare by clicking the EDIT button and typing in the URL.  You can then click PREVIEW to make sure it looks and works the way you envisioned.  Mine looks like this:Adsense cookie notice for EU visitors


That’s pretty much all it takes!  The changes take effect immediately.  Any time you want to update or change the wording of your new EU Cookie Consent page just edit the HTML file you uploaded to your server and Cloudflare will automatically display the updated text.

2 thoughts on “How To Easily Setup Adsense An EU Cookie Consent Policy

  1. How come I didn’t see any challenge before reading your blog?

    Did you come to your senses too and realise that doing this would kill off just about all your EU traffic? There are far less draconian ways to comply with the ridiculous EU cookies policy plus if you aren’t hosted in the EU they have absolutely no way of enforcing their rules.

Leave a Reply

Your email address will not be published.