What Are Cookies
According to Mozilla’s Developer Network’s definition, an HTTP Cookie is a is a small piece of data that a server sends to the user's web browser. The browser may store that data on the user’s computer and send it back the next time this user visits the same website.
Cookies are mainly used for the following purposes:
- To preserve session data such as logins, shopping carts, game scores, and more
- To save user preferences and other settings
- And to track and analyze user behavior.
How to Add A Cookie Consent Notice With a Plugin
When it comes to displaying cookie consent in WordPress, there is no shortage of plugins. Below, I’ll briefly go over the top four cookie consent plugins for WordPress and then show you how to use one of them on your WordPress website.
1. GDPR Cookie Consent Banner
2. EU Cookie Law
The EU Cookie Law plugin is another popular plugin with more than 100,000 active installs and 4,5-star rating. This plugin has slightly more options than the previous plugin and gives you the option to inform users that your site has cookies, with a popup for more information, and option to lock scripts before acceptance. The benefit of this plugin is that you can easily insert the cookie consent onto any page or post through the shortcode.
3. GDPR Cookie Consent
The GDPR Cookie Consent plugin is a robust plugin that offers a plethora of options when it comes to displaying cookie consent notices. Not only can you customize the text and where the notice will appear but you can also customize how the cookie consent looks like, as well as set styles for the accept and reject buttons, and more. The GDPR Cookie Consent plugin also comes with the ability to create a list of cookies and store information about non-necessary cookies.
4. WF Cookie Consent
How to Add Cookie Consent Notice to WordPress With GDPR Cookie Consent
For the purposes of this tutorial, we’ll be using the GDPR Cookie Consent plugin as it offers the most options out of the four.
Here’s how to use the plugin:
- In your WordPress dashboard, go to Plugins > Add new. Search for GDPR Cookie Consent, install and activate the plugin.
- Go to GDPR Cookie Consent and click on Cookie Law Settings. On the General tab, configure how you want your cookie consent to show up on your website. You can choose between banner, popup or a widget and decide whether the notice should be animated and auto-dismissed.
- Customize the styles by tweaking the settings under the Customize Cookie Bar and Customize Buttons.
- When you’re done tweaking the settings, click the Update Settings button and visit your website to see how your cookie notice looks.
How to Add a Cookie Consent Notice Without a Plugin
As with anything WordPress related, there is a way to add a cookie consent notice to your WordPress website without using a plugin. This step will require copying and pasting a code snippet into your header.php file. Here’s how to do it.
1. Visit Cookie Consent by Insites
Start by navigating to Cookie Consent’s website. This is a free and open-source solution for displaying cookie consent on your website that can be customized not only in terms of how it looks on your site but also in terms of consent type.
2. Customize Your Cookie Consent
Click on the download button. You will be taken to a new page where you can choose where the cookie consent should appear, how it looks, and which consent type you want to use. You can choose from a simple cookie notification or from a more advanced notification that allows visitors to accept or disable the cookies. For the purposes of this tutorial, I’ve chosen a simple cookie notification but you can choose your preferred consent type.
3. Add the Cookie Consent Code to Your WordPress Website
When you’re done generating and customizing your cookie consent, copy the provided code. Go back to your WordPress dashboard and navigate to Appearance > Editor and open up your header.php file. Paste the generated code there, save the changes, and close the editor.
Alternatively, you can use a plugin like Head and Footer Scripts Inserter to insert the script into your website without having to touch the theme files.
4. Check Out Your Cookie Consent
All that’s left to do now is to visit your website and make sure the cookie consent notice displays properly.
Adding a cookie consent notice helps you stay compliant with the laws and informs your users on which data you’re collecting and how you use it. Use this tutorial to add cookie consent to your WordPress website with or without the help of plugins.
Like This Article?
I have tons of great free content and giveaways! Join 10,000+ others and get access to coupons, freebies, and other great wordpress tips and tricksfor your wordpress website!