Tracking cookies are essential bits of data for webmasters and helpful to visitors. That’s why most sites on the World Wide Web use them. This quick guide shows you how to add a cookies popup in WordPress. First, let’s look at what an HTTP cookie is and why it’s important.
How Tracking Cookies Work
Whenever someone visits a website, it stores a cookie text file on that computer or other device. The small file then collects a modest amount of data about the person and their browsing habits. The site’s web server can then tailor pages in a way that best serves the visitor or member.
Session Cookies Vs. Persistent Cookies
There are two types of web cookie, session and persistent. The session file only stays with the browser while it’s open. The persistent cookie has a lifespan and remains with the user until it’s designated life ends. It’s also possible to manually delete persistent cookies at any time.
The Welcome Cookie
The Less Welcome Cookie
Cookies can also collect and share personal data with third-parties, like advertising platforms. Some users are uncomfortable with this. Others welcome it because it means the ads they see are of interest. The argument is that ads are part of the internet, so they may as well be relevant. Either way, site owners must give visitors a choice by displaying cookie consent popups.
Add a Cookie Consent Popup in WordPress
We’re going to use a no-thrills plugin to install and set up our Cookie Consent Popup in WordPress. First, log in to your WP Dashboard and then follow these 4 simple steps.
Step 1: Go to Plugins and select Add New.
Step 2: Type cookie consent into the Add Plugins search box.
Step 3: The next screen shows the available options. Click the Install Now button for the cookie consent plugin of your choice. For this example, we’ll use the GDPR Cookie Consent Banner.
Step 4: Wait for the plugin to refresh from step 3, then click Activate.
Refresh (F5) any live page on your website to view the Cookie Consent Banner across the top.
Cookie Consent Banner Settings
Plugins would be invaluable if they did nothing more than the titles suggest. But most of them— including this one—give lots of additional settings. That gives webmasters more control over the appearance and behaviour of the popup. Let’s take a quick tour of its five tabs.
TIPS: Remember to click the Update Settings button after each change. Also, you must refresh the live webpage (F5) before you can check any changes on the site.
The General Tab lets you turn the cookie popup on or off. The ‘Cookie bar as’ dropdown offers three choices on how to display the message, i.e., Popup, Banner, or Widget.
When Add overlay is set to yes, users can’t browse the site until they accept the message.
The On load, On Hide, and Auto-hide options/descriptions are self-explanatory.
Customize Cookie Bar
Use the Customize Cookie Bar tab to change the bar’s heading, message, font, and colours.
The Customize Button tab lets you control the text and size of the message button. There are also options to close (hide) the message after click or take the visitor to a specified page. The Open URL option is in the Action dropdown, which presents a new field to add a page URL.
The Advanced Tab is there to delete and reset all settings if a theme clashes with the plugin.
Help Guide Tab
The Help Guide Tab lists all the cookie shortcodes used in the active plugin. You can place them anywhere on the site’s posts or pages using the do_shortcode() function inside template files.
Read: What Is Shortcode in WordPress to learn more.
How to Change Cookie Banner Plugins
If you want to use another cookie consent banner, you must first deactivate the active one.
- Goto Plugins/Installed Plugins
- Click the Deactivate link and wait for the page to refresh
- Lastly, click the Delete link if you want to remove the plugin permanently
Feel free to try the various other plugins available. The one in this example is basic, but others may let you customize the appearance, text, and position of the popup.