How to Add Cookie Consent to WordPress

In this guide, we’ll show how to add a cookie consent notice to your WordPress website in a few simple steps.

We’ll cover:

  • Why you need a cookie consent banner or cookie notice.
  • How to add a WordPress cookie consent notice to your WordPress website.

Plus, we’ll show you how to achieve all this with the help of the best WordPress cookie consent plugin, Cookie Cracker.

WordPress cookie consent

But first, let’s go over why you need a cookie consent banner on your WordPress website.

Why a cookie consent banner is needed

To users or site visitors, cookies usually don’t mean a lot, but they’re invaluable to you, the website owner.

Types of cookies you might use on your website

If you run a WordPress website, chances are you use cookies without realizing it. This is because different types of web cookies exist. If your website uses any of these features, it uses cookies too, and you’ll need a cookie notice to let visitors know. 

Google Analytics

Google Analytics uses a type of web cookie known as the ‘_ga’ cookie to collect information on how users interact with your site.

Google analytics cookie wordpress

It doesn’t personally identify your site’s visitors, nor can it be used to track them, but it is useful information to help you run your business. 

Customer shopping carts in WooCommerce

WooCommerce shops use session management (first-party) cookies to manage the sessions of shoppers on your store. With cookies, you can keep track of the specific user who has been assigned a particular shopping cart.

woocommerce cookie

To do this, the server hosting your WooCommerce site sends a cookie to the client with a unique session identifier. That session identifier will be sent back to the server every time the user visits a new page on the website, which lets the server know which shopping cart to display to the user.

Advertisements from external sources

If you allow external sources to run ads on your site, they place third-party cookies on users’ devices.

ads cookie wordpress

These types of cookies can sometimes be used to track users and then send them targeted ads on social media platforms. So you’ll need a cookie notice and cookie policy to keep website visitors in the loop.


iFrames enable you to embed content from other sources on your website pages. A good example is a video from YouTube, Vimeo, and locations from Google maps.

iframe cookie wordpress

Since you’re loading content from another source, this is usually treated as a third-party cookie.

Auto-filling authentication fields

Your site could also allow customers to save their passwords to autofill them when visiting your login page again. Your site will send authentication cookies to users’ devices and help to identify their devices when they login to your site again. 

Legal reasons for having a cookie notice

In this privacy-awareness age, users’ concern for the privacy of their data is exceptionally high. You must allow them to consent before collecting their information, irrespective of the type of cookies your site uses.

Globally, different laws require you to have some kind of cookie notice displayed on your website.

Here are the main privacy laws that govern how you collect and use users’ data.

General Data Protection Regulation (GDPR)

This law gives users control over how sites collect their personal data information. It also requires user consent for acquiring the data and requires these sites to justify what they do with it.

Although it’s EU cookie law (European Union), it also affects businesses outside this region, including the US. 

For this reason, it’s worth ensuring your site has a built-in WordPress GDPR cookie compliance with a GDPR cookie consent plugin. We’ll help you with that later in the article.

CCPA (California Consumer Privacy Act)

Like GDPR, CCPA compliance applies to any business that collects, shares, or manages users’ personal information in the State of California.


Lei Geral de Proteção de Dados (LGPD) is a cookie law in Brazil that requires businesses to acquire consent before collecting user data. Essentially, LGPD is Brazil’s version of GDPR.

Businesses operating within these jurisdictions are obligated to comply with these cookie laws. Compliance with these laws enables customers to willingly trust businesses with their information.  

So if you want to add a cookie consent banner or notice to your WordPress website, you’ll need some help.

You can’t add a cookie banner in the default WordPress install. Fortunately, you can do this easily with the Cookie Cracker plugin.  

How to add a WordPress cookie consent notice

A cookie notice is more than just a usual popup on a website. It needs to have the following:

  • A statement informing users that your website uses cookies. 
  • Information on why your website uses cookies. 
  • A list of the cookies you use. 
  • An option to accept, reject or select the cookies they want to allow. 

This cookie consent notice can be complicated, but the Cookie Cracker plugin makes it exceptionally simple to add this to your WordPress website

Introducing the cookie notice plugin, Cookie Cracker

Cookie Cracker is an easy-to-use cookie notice plugin that lets you create simple, customizable, effective cookie banners for your WordPress website. With Cookie Cracker, you build consent management into your site without the fuss.

WordPress cookie consent popup

It enables you to generate cookie consent notices that will not only let your visitors know which type of cookies you use and their purpose but also give them the freedom to choose which cookies they want to allow.

With Cookie Cracker, you can easily create GDPR-compliant cookie notices and make sure your website follows all the EU guidelines outlined in GDPR cookie policies.

In addition, with the plugin’s auto-update feature, your cookie banners will automatically load new updates to the existing ePrivacy policy regulations.

With Cookie Cracker you’ll be able to do the following. 

Import popular cookie templates 

You won’t have to generate your cookies from scratch. You can import up to 37 templates of popular cookie templates, including WordPress, Amazon, Google Analytics, etc. 

cookie templates

Decide where you want to place your cookie notice   

Cookie Cracker offers customizable layouts for your cookie notice. This allows you to place your cookie notice where you like. Whether at the bottom, the middle of the screen, as a popup, or on the side.

cookie cracker layout

Create an infinite number of cookies and cookie groups   

You can create and manage as many cookies as you want and manage them in groups/cookie categories. This allows you to provide site visitors with an organized overview of your site’s cookies. 

cookie cracker groups

Show content from external sources only after allowing it

Cookie Cracker supports iFrames and oEmbeds, allowing you to show content from external sources like YouTube and Google Maps only after the customer allows it.

If not, Cookie Cracker will apply auto-blocking, blocking scripts that customers don’t accept.

content block cookie cracker

Have proof of consent information

Cookie Cracker has an overview page that acts like a consent log to help prove which user accepted which cookie(s). It will tell you the time of consent, the user’s ID, their encrypted IP address, and all the cookies they confirmed.

Cookie Cracker is compatible with WordPress themes and page builders, so you will be able to easily customize the cookie notice to fit in with the rest of your site. 

So now we know what Cookie Cracker offers. Let’s see how to set it up and use it on your site. 

Step 1: Install the WordPress plugin, Cookie Cracker

First, you’ll need to purchase Cookie Cracker from the MarketPress website:

Once you complete your purchase, you’ll be sent a link to download the extension and store it as a zip file and a license key to activate the service.

In this tutorial, we’ll install Cookie Cracker via the WordPress dashboard, but you can also install it via FTP

To install Cookie Cracker:

  1. From your WordPress dashboard, go to Plugins > Add New > Upload plugin.
  2. Select the ZIP file you’ve just downloaded, upload, and install the plugin.
  3. After successful installation, you’ll need to enter your license key in the field provided to activate the plugin. 

Now the plugin is ready. We can proceed to add your cookies to Cookie Cracker. 

Step 2: Add your cookies to Cookie Cracker

Contrary to a standard cookie notice plugin, Cookie Cracker allows you to list all the cookies they track so that site visitors can see exactly what they want to opt in and out of.

To do this, Cookie Cracker allows you to add cookies/scripts to your cookie notice in the following way:

  1. Go to Settings > Cookie Cracker on your WordPress dashboard and click on the Cookies tab. 
  2. Next, click on Add Script and then click the Load template link to choose the various service platforms you want to preset your cookie settings for. For example, YouTube, FaceBook, and more.
add script cookie cracker
  1. Then, hit the Submit button to set the following important fields for your cookie automatically:
    • Labels – the label field will contain the name of various services or platforms that sets your cookie, for example, Facebook and YouTube.
    • Group – assigns each cookie to a group, for example, marketing or technical.
    • Provider – contains the operator to which the cookie is traced.
    • Lifetime – sets an expiration date for a cookie. 
    • Cookies – lists all cookie names you’ve created and separates them by commas should they be many.
    • Privacy policy link – links privacy policy laws to the provider.
    • Description – describes what you’ll use your cookie for.
    • Opt-in Code – shows the code that’ll be executed when the user accepts your cookie.
add cookie consent to wordpress

Each field is entered automatically, but you are free to change the values.

  1. Finally, click Save Settings to add your cookie to your WordPress site.

After adding your cookies to Cookie Cracker, we can proceed to customize the cookie notice to fit your store’s design. 

Step 3: Customize the cookie notice bar design

While you’re still on the Cookie Cracker settings page:

  1. Click the Design tab and then go to Customizer to find all the design settings for your Cookie opt-in box.
cookie consent wordpress design
  1. Here, you have four options:
    • Layout – You can choose three different positions for your cookie banner. Either center, bottom, or bottom right.
    • Texts – Here, you can type in your headline and the description (custom message to be displayed) of the cookie notice. You’ll have the option to add custom text and change the background color, font color, and font size.
    • Links & Buttons – You can customize the typography of buttons, the accept, customize, or necessary buttons, and legal links. You can assign a cookie privacy policy page and an imprint page. 
    • Overlay –  You’ll have three overlay options: color, Z-index, and transparency. You can set the transparency values from 0 to 1 to determine the opacity of your cookie notice. Z-index determines the order in which the elements of the cookie notice are arranged on your site.
  2. You can preview all your changes and then click Publish to save all changes when you’re ready.

Now we’ve set up our cookies and our notice, next, let’s activate your cookie notification bar and display it on your store. 

Step 4: Activate your cookie notification bar

Activating your cookie notification bar is the easiest step. To do this, take the following steps:

  1. Go to Settings > Cookie Cracker and click the Settings tab on your WordPress dashboard. This should open the general settings page.
  2. Turn on the Activate Cookie banner and all content blockers sliders to automatically activate the cookie banner on your WordPress site or WooCommerce store.
activate cookie consent wordpress
  1. Click on the Save settings button to continue, and that’s it.

Anyone who visits your site will now be able to choose specific cookies they want to allow ad understand why your site uses them.

Add a WordPress cookie consent bar to your website today

Cookie consent notices are important to your WordPress website to ensure you comply with data privacy and data protection laws. Because of their legal significance, cookies are slightly complicated, and you can’t add effective and compliant cookies in the default WordPress install.

To do this, you will need the Cookie Cracker plugin, an easy-to-use cookie consent solution for WordPress that lets you add effective cookie consent notices to your site that serves both your visitors and your site itself.

Subscribe to Newsletter

Autor Avatar

Specialising in WordPress and WooCommerce, Gina Lucia is a Content Marketer and contributor to the MarketPress blog.

That might interest you too

8 Best WordPress GDPR Plugins in 2022

If you’re looking to sell to EU customers, you will need to make sure your WordPress site is fully GDPR compliant and abides by all privacy laws put in p ...

Learn more

How to Make Your WooCommerce Store GDPR Compliant

Looking for a simple way to sell to EU customers? Make your WooCommerce store GDPR compliant. If you’re catering to customers from the European Union, ...

Learn more