Cookie Consent / IdiocyCookie Consent laws: you have surely seen them.

You go to a site, and you get a popup or bar at the top of the site that says, “We use cookies, blah blah blah…”

There is usually a “Learn more” link, and sometimes a way to accept or reject that site’s use of cookies.

The reason for this is a very stupid law implemented in the European Union that is supposed to protect people from… well, actually, it doesn’t protect anyone from anything. Okay, technically, it protects you from your sanity.

Especially if you use Google Adsense to put ads on your web site, you probably have received an e-mail from them telling you that you must have a Cookie Consent thingie on your site by the end of September 2015 in order to comply with yet another EU cookie law.

Right, so, how do you add cookie consent to your site – quickly and easily?

Piece of cake!

When you read Google’s e-mail to you, it contains a link to

“Cool!” you think. “Surely Google will tell me exactly what to do!”

Family-feud-3-strikesOooh, I’m sorry! You’re wrong.

Or are you?

On the web site, which is Google’s site, you will find absolutely no useful information about HOW to actually implement cookie consent.

But, if you search Google for “cookiechoices.js” – in French – you’ll see this:

cookiechoices.js French Google searchAs you can see, the highlighted portion is a link to The rest of the highlighted text says:

You should also download the file cookiechoices.js, then…

But if you go visit – in any language – you won’t find a link to this file. You can even try searching Google directly for this mysterious file (that Google created), and you still won’t have any luck.

Instead, just download cookiechoices.js here.

I discovered this file since it’s used in the WordPress plugin WF Cookie Consent. Obviously, if you’re using WP, just grab that plugin and you’re done.

For other non-WordPress sites, the easiest way to add cookie consent is through pure JavaScript. With just JS, you can add the popup box to every page on your site by simply including cookiechoices.js. It will set a cookie (through JavaScript) so that the notice doesn’t appear again after it’s displayed to your readers.

CookieChoices.js already includes translations for German, Italian, French, Dutch, Finnish, and English. You call it like this:

<scrìpt src="[PATH TO cookiechoices.js]"></scrìpt>
    linkHref: '[URL TO YOUR COOKIE POLICY]',
    language: 'en'

Replace the accented “i” in the SCRIPT tags with normal ones, of course…

That’s it. You can also modify the cookiechoices.js file to add more languages, change the color of the popup cookie consent bar, change the name of the cookie it will create, etc.

The magic of this solution is that you don’t have to modify your site/app at all. It’s pure JS.

The hilarity of the whole Cookie Consent thing is that, in order to consent to cookies, the cookie consent process will add yet another cookie to your browser.

Seriously, who dreams these things up?!

As to why Google has made this cookiechoices.js code that they wrote so hard to find? I have no idea. But given the insanity of the EU Cookie Laws anyway, I guess I shouldn’t be surprised.

Finally, keep in mind that cookies really aren’t a serious threat to anyone… at least, they are nowhere near the threat to privacy that browser fingerprints are!

Need help? Hire me!
Get Scottie Stuff!