Under EU GDPR regulations/law your site must seek prior consent before allowing cookies to be served to visitors from the EU/EEA (even if your site is located outside the EU).
On visiting a site with a “cookie consent” notice, I don’t feel empowered just irritated.
However; it is possible to limit cookie consent notices to EU visitors ONLY, sparing your NON-EU visitors this annoyance (and partially functioning cookie-less pages).
Make your WordPress Site only display Cookie Consent options to visitors located in the EU
If you are using a caching plugin read this first
The CCA plugin identifies your visitor’s location, and tells Cookie Notice when to display the EU Cookie Law bar. Cookie Notice displays your customized bar.
2. Configure Cookie Notice to display the bar with your choice of text and options in an appropriate style and position for your site.
Dashboard->Settings->Cookie Notice customise and save settings.
3. Set the CCA plugin to control Cookie Notice output.
Dashboard->Settings->Category Country Aware
(On first use of CCA plugin only: go to the “General” tab and check the “Intialize GeoIP” box and Save Settings. then:)
Open the “Countries” tab, scroll down, enable Cookie Notice check box and save settings. If you wish you can also edit the list of “EU country codes”.
*** Job Done***
4. A quick test to ensure its working:
Just add or remove the country code for your location from the list of countries and save settings, and go to one of your posts. If the list includes your country code the bar will be displayed, otherwise it won’t.
Other “EU” functionality provided by the CCA plugin (advanced users)
The CCA plugin provides 2 shortcodes that can be used in posts and shortcode enabled widgets (like the “CCA Text/HTML and RSS” widget):
[cca_not_EU]some text/JS/other shortcodes included if non-EU visitor[/cca_not_EU]
You are [cca_not_EU]NOT [/cca_not_EU]from the EU.
Live example: You are NOT from the EU.
EU visitor detection function for use in your own PHP code (or by other plugins):
cca_is_EU() returns TRUE if visitor is from the EU; or false otherwise.
N.B. Your list of “EU” countries (see image above) is used to determine whether or not the visitor is “from the EU”.
If you are using a caching plugin
Using caching plugins other than Comet Cache and WP Super Cache?
Then you shouldn’t use this solution (although you can contact me re possibility of a custom solution). At a later date country/EU caching may also be provided for Rocket Cache and W3TC – subject to my workload.
Caching plugins do not usually work with server geo-location; they take a “snapshot” (cache) of a page when it is first visited and all subsequent visitors see the same snapshot. If the first visitor was from Germany then the snapshot will include the cookie bar and your visitor from US will be served this snapshot and also see the cookie bar.
Using Comet Cache or WP Super Cache:
If you are using Comet Cache you can install and configure this Country Caching extension to make caching country (and EU) aware. Likewise; for WP Super Cache you can install this WPSC extension. In CC extension settings enable “group caching”, by default the group should contains all EU country codes but it is probably best to copy and paste it from your EU list on CCA’s settings.
Category Country Aware plugin and use with new version of Cookie Notice for GDPR
GDPR applies to EEA countries as well as EU. If you are a previous user of CCA you should add 3 EEA countries (,IS,LI,NO) to you “EU” List (image below). For new users the latest version of CCA will automatically include these in the list.
- You can test by adding and removing your own country from CCA’s “EU list” – use a browser where you can check and delete cookies (e.g. use “developer” setting on Chrome or Opera)
- With Cookie Notice the first page someone visits is not served cookies. When they click on accept Cookie Notice reloads the page downloading cookies. Cookie Notice allows you to choose whether on not first landing page is refreshed. No reload means cookies will not be set for that page but will be for all other pages visited. CCA uses your choice CN reload setting to decide whether to refresh the first page of non-EU visitors, but does it earlier before the page starts to display so it is unnoticeable.
More about the CCA plugin
I’m the author. Most of the sidebar content on this page is provided by CCA widgets, what is displayed depends upon the category of the page and where you are from (if you view my posts on Chinese Phablets you will see different sidebar content).
You can also have responsive ads within posts that only appear on small devices. and much much more. More on its capabilities in this post.