Simple "Cookie Warning" Notification βœ”

(Serdar) #24

This plugin looks good:

(Serdar) #25

@Paritosh thank you so much for this awesome guide. :slight_smile:

Is there any way to show the cookie warning for EU visitors only? Because I never prefer using plugin.

Thanks again!


To display notifications just in EU, you can use this method -

Step 1. By default, keep like this.

.cookies-warning {
    display: none;

Step 2. But, make an external CSS file europe.css to override the behavior for serving in target countries.

.cookies-warning {
    display: block !important;

Step 3. Create an edge rule to bypass cache for the path *

Step 4. Create a whitelist rule for europe.css to serve in only selected countries.

# Display Cookies Notification for the selected countries
# See here:
<FilesMatch "europe.css">
    RewriteEngine on
    RewriteCond %{HTTP:CF-IPCountry} !^(GB|DE)$
    RewriteRule ^(.*)$ – [R=404,L]

Step 5. Add in the footer of your site.

<link rel="stylesheet" href="">

(Manashjyoti Athparia) #27

but this will only work with CF enabled i think

(Serdar) #28

This creates 404 error for non-european countries. It is a penalty for Google SEO?


Nope, 404 doesn’t harm.


Yes, true. If someone doesn’t want to use CF at primary domain, the other easy way is using subdomain with CF enabled at different server block.