GDPR Compliance With Cloudflare & WordPress

Jul 01, 2018

GDPR Compliance With Cloudflare & WordPress

This post was originally created on our sister site WP Cover.
View Original Article
July 1, 2018

We’ve all heard about the big GDPR phenomenon.  How large companies are spending millions to become compliant and the potential fines that can be thrown out if they are not.

While I’m not going to claim to be an attorney or have much insight into the law, I do have a method that can get you basic compliance fairly quickly.  This particular setup requires:

  • Your sites DNS to be hosted through Cloudflare
  • Your site to be built using PHP (WordPress, Drupal, Joomla, etc.)

If you have both of the above boxes checked off, you’re ready to get started!

Side Note – if your site is not currently run through Cloudflare, it’s easy to switch and 100% free.  Signup for an account at and follow their easy onboarding process.

If you’re looking for the quickest implementation, simply copy and paste the below code into your active themes footer.php file:

Utilizing the above code, you’re only going to see the GDPR cookie notice if you are located within a country that requires GDPR compliance. Therefore, if you are located in the United States you’re not going to see the popup. In order to allow you to test it, simply append ?gdpr=true onto the end of your domain (example: You’ll see the popup and can confirm your consent. If all looks good and you’re happy with the result you can stop reading here.

If you’d like to further customize the popup, head over to This is the open source cookie consent script that we’re using to show the popup. You can customize the color scheme and the behavior using the builder.

Once you’re happy with the look and feel, you’ll want to replace the code in between the conditional PHP statement within the above code. Example:



That’s it! You’ve now tackled GDPR compliance in its most basic form.

**Important Note – I am not a lawyer or an attorney. I have no legal knowledge, I’m simply basing this tutorial off my own private reading and comments of others. You should consult with an attorney to ensure you are fully GDPR compliant.


The post GDPR Compliance With Cloudflare & WordPress appeared first on WP Cover.

Additional News


Let's get started. Fill out the form below to email us or request a call back.