How to automatically block cookies on your WordPress website

How to Automatically Block Cookies on Your WordPress Website?

To automatically block non-essential cookies you need a dedicated cookie consent plugin such as WebToffee’s GDPR Cookie Consent plugin, as WordPress does not block cookies by default. This WordPress-native solution detects and blocks cookies used for analytics, marketing, and other non-essential purposes until a user explicitly provides consent.

In this article, you’ll learn how to automatically block third-party cookies in WordPress and ensure cookies load only after user consent using the GDPR Cookie Consent plugin.

📌

Key Takeaways

  • Loading third-party cookies onto users’ browsers without consent violates GDPR.
  • The WordPress GDPR Cookie Consent Plugin by WebToffee enables you to detect and automatically block third-party cookies on your website.
  • Third-party cookies will be blocked until the user explicitly consents to them.

What Are Third-Party Cookies?

Third-party cookies are cookies placed on a visitor’s browser by domains other than the one they are visiting. They are used to track user activity on the website for different purposes, such as advertising, analytics, etc.

Say, for instance, you searched for a blog about Motorcycle riding gears for monsoon and then you visited Facebook and saw ads for Motorcycle riding gears. This is caused by Facebook cookies on the blog. The cookies will track your activities and preferences and use that information for advertising.

Third-party cookie retargeting

What Is the Difference Between First-Party Cookies and Third-Party Cookies?

First-party cookies and third-party cookies are small pieces of text that carry information regarding website visitors. Both are commonly used to track site visitors’ activity and preferences. Their purpose for collecting information is what differentiates them.

First-party cookies collect information from website visitors to improve the user experience. For example, the store may save items in your shopping cart, remember your login details, or store your language preference so the site works smoothly when you return.

Whereas third-party cookies are loaded by other domains to collect user information for third parties. They commonly use this information for targeted advertising.

Third-Party Cookies and Data Privacy

As mentioned above, third-party cookies collect information from website visitors for advertisers and data brokers. This information is commonly used for marketing and analytical purposes.

Selling the information for advertising is not just the only issue with third-party cookies. Researchers at Kaspersky discovered trojans that can steal information from browser cookies and get into website visitors’ social media accounts. Many new cookie laws were introduced in order to prevent the security risks of cookies and protect the privacy of users.

How to Block Third-Party Cookies Automatically on Your WordPress Website?

We have a cookie compliance plugin that can help you with automatically blocking cookies on your WordPress website. The plugin helps you achieve GDPR compliance for WordPress websites. It can be used to create a cookie consent banner for your WordPress website. You can also generate a cookie policy for your website using the template with this plugin.

So it is an all-in-one cookie compliance solution for WordPress websites.

Looking for a complete cookie compliance solution? WebToffee’s CMP plugin has got you covered!

  • Auto-block cookies
  • Scan and list cookies
  • Customize cookie banner
  • Easy consent mode integration
  • Show banner based on user location
  • User consent logging
  • Get explicit/implicit consent

Get Plugin

The below steps will guide you through the setup process of automatically blocking cookies on your website.

After purchasing the premium version, download the plugin installation file from the download section of your My Account page.

Install and activate the plugin on your WordPress dashboard. Refer to our article if you need help in plugin installation and activation.

After installing the plugin, go to the Cookie Consent menu from your WordPress dashboard.

  • Under the Cookie Banner tab, select GDPR as the consent law type.
  • Scroll down to the General settings.
  • Select the Enable cookie banner checkbox. (If this option is enabled by default, keep it as is.)
  • Add Geo-targeting if required.
💡

Pro Tip: Geo-targeting helps you show the cookie banner only to a specific country or region. We recommend continuing geo-targeting worldwide as most countries now have data privacy laws similar to GDPR.

  • Enable IAB TCF 2.2 and configure related settings if required.
  • Expand the Show advanced settings dropdown, and enable the Reload page upon user consent checkbox. From here, you can also choose to hide the cookie banner on specific pages and set how long user consent should remain valid.
  • The plugin also allows you to customize the cookie banner, banner text, buttons, etc. But we will ignore those steps now.
Create WordPress cookie banner
  • After making the necessary changes, click on Update Settings to save.

Step 3: Scan Website for Cookies

Now, we will scan the website to identify the third-party cookies.

  • Go to the Manage Cookies tab.
  • Click on the 🔍Cookie Scanner button and select Scan for cookies.
Scan WordPress website for cookies

This will initiate the cookie scanning process on your website. Once the scanning is complete, the plugin will group them into categories such as Necessary, Functional, Performance, Marketing, Advertisement, and Others.

Cookies that are essential for the website to function are placed under the “Necessary” category. All other cookies are automatically blocked by the plugin until users give their consent.

For example, advertising cookies from services like Google fall under the non-essential category and are blocked from loading by default.

Cookies are added in the cookie list

To manually block third-party cookies, all you need to do is add cookies and its script URL pattern to the appropriate non-essential cookie category. To do the same, click on Add cookie corresponding to the cookie category.

Once you add the cookie details, expand the Advanced Options section and enter the script URL pattern. This allows the plugin to identify the associated cookies and block them automatically before user consents.

Add cookies manually to the cookie list

If you want to disable automatic cookie blocking for a specific category that is essential to your website and does not affect GDPR compliance, you can do so from the same settings page.

To disable third-party cookie blocking for any cookie categories, click on the ✏️Edit icon near the cookie category name.

Edit cookie categories

Then check the Enable cookies prior to user consent checkbox. This will load the cookies without users consent.

Enable cookies prior to user consent

Then, click on Save Changes to apply the setting.

That’s it! Your WordPress website will now automatically block third-party cookies until users give their consent. Only essential cookies will load by default, ensuring your site collects data in a compliant way.

Frequently Asked Questions

Does WordPress automatically use cookies?

Yes WordPress by default, uses two types of cookies. Comment cookies and session cookies. Comment cookies store information about the commenter so that they don’t have to enter the information each time they post a comment on your website. Session cookies are used to authenticate users who have registered an account on a WordPress website.

Check out our complete guide on WordPress cookies for more information.

Does WordPress blocks cookies?

No, WordPress doesn’t have a default option to block third-party cookies or create a cookie banner. With the help of cookie consent plugins, you can manage cookie compliance for your WordPress website.

Why do you need a native CMP for cookie compliance in WordPress?

A native Consent Management Platform (CMP), like the GDPR Cookie Consent plugin, eliminates the need to connect to external servers. Consent data remains securely stored on your web server. Additionally, native CMPs are easier to use as they integrate seamlessly within the WordPress ecosystem.

Conclusion

You can give your users granular control over the types of cookies they accept or reject using the plugin we discussed in this article. The plugin also helps you add a cookie consent banner to your website. This is the only plugin you need to comply with GDPR and CCPA for using cookies on WordPress websites.

Hopefully, you now understand what third-party cookies are and how to block them automatically. Do you have any questions? Please feel free to ask in the comments section.

Article by

Associate Product Marketer @ WebToffee. I work on WooCommerce plugins and write about eCommerce growth, automation, coupons, subscriptions, and data privacy. Interested in practical marketing strategies that actually move metrics.

Got any query? Please leave a comment or reach out to our support

Your email address will not be published. Required fields are marked *

Google Preferred Source

Ensure GDPR & US Cookie Compliance for WordPress