Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Add a Cookies Popup in WordPress for GDPR/CCPA

Did you know that your WordPress site may be setting cookies on your visitors’ browsers? Different regulations, like the European Union’s GDPR, require websites to get user consent before setting any cookies on computers.

The good news is that in WordPress, you can easily set up cookie consent using different plugins. We’ve tested multiple tools and implemented them on our own websites, and we’ve found that the best options are WPConsent and Cookie Notice.

In this article, we will show you how to add a cookies popup in WordPress.

How to Add cookies popup in WordPress

Browser cookies are small files containing data sent by a website to store in a user’s browser. Most WordPress websites set cookies for various purposes.

For example, by default, WordPress uses cookies for authentication purposes to store session information for logged-in users. It also sets a cookie when someone leaves a comment on your site.

Apart from these, WordPress plugins can also set their own cookies to store different information or recognize repeat visitors.

You can learn how your site uses cookies by checking our guide on how to know if your WordPress website uses cookies.

While cookies are extremely useful, they can also be used to collect information about a user and share it with third-party advertising platforms.

That’s why, in Europe and a few other countries, website owners are required to let users know about their usage of cookies. If your website targets audiences in those regions, then you need to show a cookie consent disclaimer.

Cookie notice preview

The easiest way to do that is with a WordPress GDPR plugin. WPConsent and Cookie Notice are two of the most popular cookie notification plugins and are compatible with many other popular WordPress plugins.

That being said, let’s take a look at how to easily display a cookie consent popup in WordPress.

The best way to add a cookie popup to your WordPress website is by using WPConsent.

WPConsent lets you easily create custom cookie consent popups and banners to match your website’s design.

Plus, unlike most cookie notice plugins that only display warnings, WPConsent actually protects user privacy by automatically blocking all tracking scripts and cookies until visitors give consent. This helps to ensure your site properly follows GDPR legislation.

Note: There is a free version of WPConsent that you can use. However, we’ll be using the Pro version for this tutorial because it comes with more advanced features.

To get started, you’ll need to install and activate the WPConsent plugin. If you need help, see our step-by-step guide on how to install a WordPress plugin.

Once the plugin is activated, it will launch the easy onboarding wizard. Go ahead and click the ‘Let’s Get Started’ button to set up the plugin in 5 minutes.

Click the Let's Get Started button to use the setup wizard

First, you need to copy and paste your license key into the ‘License Key’ field and click the ‘Verify Key’ button. You can find your license key in your account area on the WPConsent website.

After your license key has been verified, click the ‘Scan Your Website’ button.

Enter your license key and scan your website

WPConsent will then scan your entire website for known 3rd-party scripts, core features, and WordPress plugins that may be using cookies.

When the scan is finished, WPConsent will notify you of how many services it found that set cookies. Click the ‘OK’ button to review them.

Completed WPConsent scan

Now, you can see which services are using cookies on your website. On our test site, it shows that WordPress comments and WPForms are using cookies.

Click the ‘Auto-Configure Selected’ button to automatically import and configure all the cookie and privacy information for the detected services, including their descriptions, cookie durations, and data policy URLs.

Auto-configure the services that are using cookies on your site

Now that the cookie data is configured, you can choose the layout and position of the cookie popup or banner to display on your website.

Choose the cookie popup layout

When you select a layout, you can scroll down the page to see a preview of how it will look.

From here, you can click on the ‘Save & Complete Setup’ if you’re happy with the cookie banner design. Or, you can select ‘Further Configure Banner Styles’ to customize your cookie popup, which is what we’ll do in this tutorial.

Further configure banner styles

Customize Your Cookie Popup Notice

Clicking ‘Further Configure Banner Styles’ will take you to the WPConsent » Banner Design page.

From here, you can change the style of your cookie popup, including the background color, text color, font size, button type, button color, and more.

Don’t forget to click the ‘Save’ button to store your style setting changes.

Configure WPConsent cookie banner style settings

Then, you can click on the ‘Content’ tab to customize the cookie popup message. You can also scroll down the page to edit the button text, change the button order, and upload a logo or icon.

When you’re happy with the design, click the ‘Save’ button.

Edit the cookie popup message

Now, you can visit your WordPress website to see how your cookie popup looks live in action.

See the cookie popup live on your WordPress website

Add a Cookie Policy to Your WordPress Site

You should also add a cookie declaration to your website’s privacy policy. If you haven’t already created a privacy policy page, then you can follow our guide on how to create a privacy policy page in WordPress.

WPConsent makes creating a cookie policy easy. It automatically scans your website to detect all active cookies, then generates a detailed cookie policy that documents each cookie’s purpose, duration, and type.

To configure the cookie policy, go to WPConsent » Dashboard from your WordPress admin area and click on the ‘Configure’ button next to ‘Cookie Policy.’

Configure cookie policy in WPConsent

This will direct you to WPConsent’s ‘Settings’ page. From here, scroll down the page to the ‘Cookie Policy’ section.

You can select which page you want to use for your cookie policy from the dropdown menu. In this tutorial, we’ll add the cookie declaration to our privacy policy page.

You also need to copy the shortcode that WPConsent provides.

Select cookie policy page

Don’t forget to click the ‘Save Changes’ button at the bottom of the page.

Next, you just need to edit your privacy policy page and insert the shortcode where you want to display the cookie declaration.

Enter cookie declaration shortcode

To see the cookie declaration, you need to save and preview the page. This is how the first few paragraphs look on our test website:

Example of cookies policy page

Method 2: Add a Cookie Popup with Cookie Notice

You can also add a cookie popup to your WordPress site with Cookie Notice. It’s a free plugin that’s easy to use. However, it’s not as feature-rich as WPConsent.

First, you’ll need to install and activate the Cookie Notice & Compliance for GDPR / CCPA plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.

Upon activation, the plugin will start displaying a basic cookies popup to your visitors immediately without any additional configuration. The default message is suitable for most websites.

Cookie notice default message

If you’d like to customize the notification, then you need to visit the Cookies menu item in your WordPress dashboard.

From here, simply scroll down to the Notice Settings section.

Edit cookie notice message

On this page, you can customize the popup message and button text.

You can also add a link to your privacy policy page. If you haven’t already created one, then you can follow our guide on how to create a privacy policy page in WordPress.

After that, you can select that page from the Privacy Policy dropdown menu.

Enable privacy policy link

The WordPress cookie plugin also gives your visitors the option of refusing and revoking consent.

To do that, just click on the ‘Refuse consent’ and ‘Revoke consent’ checkboxes. The default settings will work for most websites.

Refuse consent settings

If you scroll down to the Notice Design section, then you can choose the position, animation, button style, and colors of your cookie consent popup.

You can also set a button class to add custom CSS for your popup.

Edit design of notice

Once you’re finished, click on the ‘Save Changes’ button at the end to store your settings.

You can now visit your website to see your cookie consent popup in action.

Cookie notice default message

Bonus: Improve GDPR Compliance with MonsterInsights

MonsterInsights is the best analytics solution for your WordPress site. It’s also the simplest way to improve compliance with GDPR and other privacy regulations.

That’s because MonsterInsights offers an EU Compliance addon that works out of the box. It will automatically change your analytics settings to help you stay in compliance with privacy laws.

The MonsterInsights Google Analytics plugin

The EU compliance addon is included in the premium plan. The best thing is that it automatically integrates with both Cookie Notice and Cookiebot.

You can read our complete MonsterInsights review for more details.

The first step is to install the MonsterInsights plugin and connect it to your Google Analytics account. For more information, see our guide on how to install Google Analytics using MonsterInsights.

Once MonsterInsights is installed and set up, you’ll need to install and activate the EU Compliance addon.

You can do that by navigating to the Insights » Addons page in your WordPress dashboard. Next, find the EU Compliance addon and click on the ‘Install’ button.

MonsterInsights EU compliance addon

The addon will be automatically activated.

You can check this by going to the MonsterInsights » Settings page and switching to the ‘Engagement’ tab.

When you look at the EU Compliance section, you will see that the addon has been turned on.

View EU compliance settings

If you click the down arrow on the right side of the screen, then you can see a detailed list of the configuration changes the addon has made to your website.

For instance, you can see that it automatically anonymizes IP addresses in Google Analytics, disabled demographics, interest reports, disabled UserID tracking, and much more.

View EU compliance settings in MonsterInsights

Next, you can scroll down to see MonsterInsights compatibility with different cookie plugins like Cookie Notice and CookieBot.

MonsterInsights will automatically change the Google Analytics tracking code if any of the plugins are installed on your site. This way, it will wait for consent before tracking users in Google Analytics.

Compliance plugin integration

We hope this article helped you add a cookie consent popup to your WordPress site. You may also want to see our step-by-step guide on how to create a yes/no optin for WordPress and the best popup plugins for WordPress.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

27 CommentsLeave a Reply

  1. Jiří Vaněk

    I have a website in the Czech Republic, which falls under the European Union. Initially, I was lost with GDPR and didn’t know how to implement the rules on the website. However, I now use Complianz – GDPR/CCPA Cookie Consent plugin on all my websites and I am absolutely satisfied. It handles not only the cookie banner but also the entire customization of the website to comply with GDPR law. It’s a good thing such plugins exist.

  2. kzain

    The comparison of Cookie Notice and the Cookie Banner plugin is valuable for users with different needs.
    Cookie Notice seems like a great option with its ease of use. If you need more control over the popup’s appearance or advanced features, the Cookie Banner plugin with Cookiebot could be a good fit.

  3. Ralph

    Thank God there are plugins for that. I wish we as a whole internet could get rid of all that cookies, gdpr and other things and replace it with one but only one thing. It is absurd when we visit new website and before we even see content we have to close so many pop-ups.

    • WPBeginner Support

      It may be annoying but the GDPR was set up with good intentions, hopefully there will be better implementations as time goes on.

      Admin

  4. Chanel Burth

    Thank you for the article. Does this plugin give the option for people to accept or decline?

    • WPBeginner Support

      It does not as that would require it to interact with everything that sets a cookie and have the power to disable it which isn’t something a plugin would have easily.

      Admin

  5. Elliot Jolesch

    This article was very helpful but I wonder if it’s a little out of date.

    The plugin that you recommended, GDPR Cookie Consent Banner, has not been tested for the latest version of WP and apparently hasn’t been updated in 11 months.

    Are you planning an update to this article?

  6. Stephanie

    Thank you this was really helpful. One thing done on the site in under 5 minutes. Amazing!

    • WPBeginner Support

      Glad our guide was helpful :)

      Admin

  7. Declan Howard

    How do I make sure my website does not drop cookies into a visitor’s computer? I do not need to do this.

    • WPBeginner Support

      It would depend on what tools and plugins you are using on your site, you would want to reach out to those to see if they add any cookies or not.

      Admin

  8. Deb Smith, Small Details

    We can ALWAYS count on WPBeginner to give us solid plugin recommendations. I’ve been a “beginner” for over a decade haha!

    • WPBeginner Support

      Thank you, glad our articles have been helpful :)

      Admin

  9. Farukh Hussain

    Hi,
    Thanks for sharing this useful post. However, many plugins make site loads slower. Can you please suggest some code to display this notification.

  10. Aurora

    Can you recommend a way to add a cookie consent without the use of a plugin? My site has too many plugins already.

  11. Sarah A

    Hi,
    Can you recommend a cookie consent for ‘opt in’ that is suitable for the new GDPR law?

  12. Julia

    Hi,
    I’m trying to set up an e-commerce website and have to comply with EU law regarding the use of cookies. How can I find out which cookies my website is using?
    Thanks

  13. Samuel

    Hi,

    I’m looking for a pop up box that imitates the one on the gucci website as it is a square, do you know of any?

  14. kulbir singh kang

    hi me kulbir singh

    something problem in my website ,,,,,when i open to this ,,it is automatically redirect on another multi pal site ,,,,when i open second time it is working properly

    and if when i clear cache cookies of browser (problem in all browser) ,then i go to ,,,same problem display on system

    please visit on my website ,,,and please tell me ,,,, what is solution of this problem

    is this problem of cookies or not ,,,,

  15. Maninder Pal Singh

    Thank you wpbeginner. I was looking for something exactly like this. Light weight plugin with a simple notification for the cookie policy.
    Thanks.

  16. Muhammad Ishfaq

    Thanks the post, the plugin works perfectly on all of my websites including link to the policy page.

  17. Eva B

    It has a glitch. The link to the policy page goes to an error page. I double-checked my spelling and looked on their support forum. There I saw that others left the same request for a fix. No response from developer. This plugin still works for me, but without the link.

    • WPBeginner Support

      @Eva thank you for notifying us, we have tried to contact plugin author as well. It seems like the plugin author didn’t mean to add this functionality. Currently the plugin is only good for adding a simple notification without a link, which satisfies the requirement for the cookie law in most EU countries. However, there should be a link so that users can read privacy policy.

      Admin

  18. Keith Davis

    Looks good guys and the developer says it is lightweight.
    I think I should be using this.

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.