WPConsent Blog

Everything you need to know about the WPConsent plugin

How to Block Third Party Cookies on Your WordPress Website

How to Block Third Party Cookies on Your WordPress Website 

If you’re running a WordPress website, then understanding and controlling cookies is a necessity, especially with growing privacy regulations like GDPR and CCPA.

Cookies are like tiny digital crumbs that websites leave on your web browser. While some cookies are beneficial, others raise privacy concerns. That’s because you’ll need to get permission from your visitors before using certain types of cookies.

Sadly, WordPress doesn’t come with a built-in cookie management system. But with the right plugin, like WPConsent, you can easily set up cookie consent without touching a single line of code and block third-party cookies.

In this article, I will show you how to block cookies on your WordPress website using a very simple method.

Understanding Different Types of Cookies

Cookies are small text files that websites put on your web browsers when you visit them. Think of them as little digital labels that help websites remember things about you, like login details, preferences, and more.

While there are many types of cookies, they can be generally categorized into two main types:

  • Essential Cookies: These cookies are vital for the basic operation of a website. They enable core functionalities like user login, session management, and eCommerce shopping carts. Without these cookies, a website may not function correctly. Generally, these are exempt from strict consent requirements by privacy laws.
  • Non-essential Cookies: These cookies, while not strictly necessary for the website to function, serve various other purposes. They can be further broken down into the following categories:
    • Statistics Cookies: Used to track website traffic, user behavior, and engagement. Tools like Google Analytics rely on these cookies to provide website owners with valuable insights.
    • Marketing Cookies: These cookies track users across websites to deliver personalized advertisements and measure the performance of marketing campaigns.

Now that you understand the basics about cookies, let’s see why is it important to block them in WordPress.

Why Block Third-Party Cookies in WordPress

There are multiple reasons for blocking or controlling cookies on your WordPress website. But one of the main reasons for blocking cookies in WordPress is because of privacy regulations worldwide. They require websites to obtain user consent before setting non-essential cookies.

For example, General Data Protection Regulation (GDPR) in the European Union requires websites to obtain explicit consent before processing personal data, including the use of non-essential cookies.

Similarly, California Consumer Privacy Act (CCPA) in California gives consumers rights regarding their personal information. This includes the right to know what data is collected and to opt-out of the sale of their personal information, which can be relevant to certain cookie uses.

Other regulations like LGPD (Brazil), PIPEDA (Canada), and various state laws in the US are also shaping the landscape of cookie consent and privacy. Non-compliance with these regulations can result in significant fines and legal actions against your website.

Besides that, transparency and providing users control over cookies are essential for building trust. When users understand how their data is being used and feel they have control, they are more likely to have a positive experience on your website.

That said, let’s see how you can easily block cookies on your WordPress website.

Blocking Third Party Cookies on Your WordPress Site

The easiest way to block third party cookies in WordPress is by using WPConsent. It is the best WordPress consent management plugin, and it includes a powerful automatic script blocking feature that helps protect your visitors’ privacy by controlling when and how third-party cookies load on your website.

WPConsent automatically detects scripts from popular services like Google Analytics, Matomo, Google Ads, Facebook Pixel, LinkedIn Insight, Snapchat pixel, TikTok pixel, and more.

Other than that, it also offers pre-built cookie consent banner templates and lots of customization options. Plus, you can see consent logs and easily manage them from your WordPress dashboard.

For this tutorial, I’ll use the WPConsent Pro version because it automatically configures cookie data from other plugins like WooCommerce and WPForms. The Pro version also helps see consent records and offers a modal cookie banner template. There is also a WPConsent Lite version that you can use for free and block common 3rd party scripts and core features.

First, you’ll need to install and activate the WPConsent plugin on your website. If you need help, then please see this guide on how to install a WordPress plugin.

Once the plugin active, you will see the WPConsent setup wizard. Go ahead and click the ‘Let’s Get Started’ button and follow the onscreen instructions.

WPConsent setup wizard

On the next screen, you’ll need to enter the license key and click the ‘Verify Key’ button. You can find the key in the WPConsent account area.

After that, simply click the ‘Scan Your Website’ button.

Enter license key and scan your site

WPConsent will now perform a scan of your site and detect third-party scripts.

When the scan is complete, you’ll see a popup message. Go ahead and click the ‘OK’ button.

Close scan complete popup

After that, WPConsent show the third-party services that may be using cookies on your site.

You can simply select the service, check the ‘Prevent known scripts from adding cookies before consent is given’ option, and click the ‘Auto-Configure Selected’ button. This way, the selected scripts will be stopped from adding cookies before a user gives consent.

Auto configure scripts in WPConsent

On the next screen, WPConsent will show you different cookie banner templates.

You can simply scroll down and click the ‘Save & Complete Setup’ button to exit the setup wizard.

Click save and complete setup wpconsent

Alternatively, you can also head to WPConsent » Scanner from the WordPress dashboard to block third-party scripts from adding cookies without consent.

After that, simply click the ‘Scan Your Website’ button.

Scan your site for third party scripts

Next, you can scroll down to see the detailed report and view which services use cookies on your site.

From here, ensure that the ‘Prevent known scripts from adding cookies before consent is given’ option is checked and then click the ‘Automatically Configure Cookies’ button.

Automatically configure cookies on your site

A popup window will now open confirming to automatically configure cookies on your site.

Go ahead and click the ‘Yes’ button to continue.

Select yes to configure cookies

Once WPConsent populates cookie data from the selected services, you’ll see a success message.

You can click the ‘Ok’ button to close the message.

Close cookie success message

Next, if you want to see the cookie data, then you can head to WPConsent » Settings from the admin panel.

From here, simply switch to the ‘Cookies’ tab. Here, you’ll see details of all the cookies along with their name, ID, description, and duration. WPConsent also lets you edit the details of each cookie and delete them.

View cookie data

Add a Cookie Consent Banner in WordPress

After preventing third party scripts from adding cookies without consent on your site, the next step is to show a cookie banner on your site.

This allows your website visitors to give consent whether they’d want third party cookies to be added to their browser. It also ensures that you’re complying with different data privacy laws while building trust with your audience.

With WPConsent, you get pre-built banner templates with real-time preview. You can simply select a layout, choose its position, and customize the style and content according to your requirements.

Edit cookie banner layout

If you need help, then please see our detailed guide on how to add a cookie consent banner to your WordPress website.

For example, here’s how the banner looks like on our website.

Cookie banner on WPConsent

That’s it! You’ve successfully created a cookie consent banner and blocked third party cookies in WordPress.

Give WPConsent a try today and make your site compliant with privacy laws. Plus, you also get automatic script blocking and a compressive cookie management solution.

If you liked this article, then please follow us on X (formerly known as Twitter). You can also leave a comment below if you need any assistance.

Add A Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.


Popular Resources

Get free tips and resources right in your inbox, along with 500+ others

Follow Us