Ready for the new Google Consent Mode v2?

Starting from March 13, 2024 you have to use Google Consent Mode v2 to comply with the latest regulations

×
Latest News, Updates, Tutorials and much more

Blog

Cookie Blocking

Automatic Third-Party Cookies Blocking

Third-Party Cookies in a nutshell

Third-party cookies are important for many technologies across the web. You can read the detailed explanation about how third-party cookies work.

However, sometimes they need to be blocked to comply with the latest privacy regulations. This might be a tricky task depending on what third-party services are used on your website and how the website is built. Blocking third-party cookies requires blocking whole third-party functionality and related scripts.

Why use automatic Third-Party Cookies blocking?

CookieScript already has an option to block third-party cookies, but the third-party script had to be edited in order for the Third-Party Cookies to be blocked properly. While this is a straightforward task for web developers, it might be challenging for other people since it requires actual code editing.

In some cases, it's also quite inconvenient to edit third-party scripts due to the lack of access to the script itself. Some third-party scripts are inserted using plugins, which cannot be edited to keep them updatable.

CookieScript now uses some advanced technologies that allow blocking any third-party scripts without editing actual third-party script code. You heard it right, you can block any third-party script, even your custom scripts. This allows your website to be compliant with third-party cookie regulations much more easily and without changing your website code.

Such functionalities help CookieScript to stand out from other competitors.

How does it work under the hood?

Scanning

First things first. During the scanning process, Cookie Scanner also looks for all scripts used on your website. The Cookie Scanner is smart enough to distinguish similar scripts from unique ones and treats similar scripts as one script.

Categorizing

All scripts found during the scanning process are then listed in your Banners Settings > Scripts. Here you can choose what scripts should be blocked by Cookie-Script until the user agrees to a certain category of cookies.

Blocking

Now back to your website. Here CookieScript banner is loaded and starts looking through other third-party scripts. At this point banner "knows" what scripts should be blocked before it gets loaded. When such a script is found, the type for the script is changed and the script is not loaded/executed.

In order for this to work properly, CookieScript code should be included before third-party scripts that should be blocked automatically. Ideally, Cookie-Script should be the first script included on the website
Due to the technical limitations of modern browsers, it is only possible to block cookies that are set during the JavaScript execution. Cookies that are set by the server during the response (with an HTTP header) cannot be blocked automatically. Although this is rarely the case, if you have such scripts, you have to block such scripts manually.

How to block existing third-party scripts using CookieScript?

Enabling automatic third-party cookie blocking is quite straightforward:

  1. Go to editing your Cookie Banner Item and select the Scripts section.
  2. Find a script that sets Third-Party Cookies, for example, the Facebook Pixel script.
  3. Choose a Cookie Category after accepting which script should be activated (Let's say Targeting category). Mark script to be blocked and save your changes.

Easy as that. Your Facebook Pixel script will now be deactivated until the user agrees to the Targeting Cookies. Not a single line of code needs to be edited.

Google Tag Manager

If you are using Google Tag Manager to include scripts on your website, you should use Google Tag Manager to block third-party scripts. Automatic script blocking will not work with Google Tag Manager since Google Tag Manager itself is a system to manage scripts without editing website code.

Things to remember

There are a few requirements for Automatic Third-party Cookie Blocking to work properly:

  1. CookieScript-generated code must come before any other script that should be blocked. Otherwise, it won't be able to block those scripts.
  2. The whole functionality should be enabled in settings, it can be found in the [Scripts] section of your banner.
  3. You might need to re-scan your website in case the last scan was completed before this functionality was introduced.
  4. An automatically blocked script will not be executed, but the request for the script will still be sent to the server (in the case of a remote script). 

New to CookieScript?

CookieScript helps to make the website ePrivacy and GDPR compliant.

We have all the necessary tools to comply with the latest privacy policy regulations: third-party script management, consent recording, monthly website scans, automatic cookie categorization, cookie declaration automatic update, translations to 34 languages, and much more.