Table of Contents [TOC]

{tocindex article="current"}

Guides

Menu

  • Pricing
  • Features
    • Regulation compliance
    • GDPR (EU)
    • CCPA (California)
    • PIPEDA (Canada)
    • LGPD (Brasil)
    • KVKK (Turkey)
    • POPIA (South Africa)
    • The basics
    • 42 languages
    • User consents recording
    • Third-party cookie blocking
    • Geo targeting
    • Self-hosted code
    • Google Consent Mode v2
    • Automation
    • Automatic monthly scans
    • Automatic script blocking
    • Advanced reporting
    • Cookie Banner sharing
    • IAB TCF 2.2 integration
    • Google-certified CMP
  • Resources
    • Cookie Scanner
    • Privacy Policy Generator
    • System status
    • Roadmap
    • Changelog
  • Blog
    • Guides
    • News
    • GDPR & CCPA
    • Privacy laws
    • Compare
    • Knowledge base
  • Support
    • Help Center
    • Integrations
    • Contact us
    • Feature request
  • For partners
    • Agencies
    • Affiliates
  • separator
  • Language switcher
    • Profile
    • Billing
    • My plan
  • Sign in
  • Try now
 
  • Guides
  • News
  • GDPR & CCPA
  • Privacy laws
  • Compare
  • Knowledge base
Details
11 March 2021
Last Updated: 26 November 2024

Automatic Third-Party Cookies Blocking

ON THIS PAGE

  • Third-party cookies in a nutshell
  • Why use automatic third-party cookies blocking?
  • How does it work under the hood?
    • Scanning
    • Categorizing
    • Blocking
  • How to block existing third-party scripts using CookieScript?
  • Google Tag Manager
  • Things to remember

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). 

 

Register for free Show pricing plans

 

 
  • About CookieScript
  • Terms of Service
  • Privacy Policy
  • Pricing
  • Resources
  • Cookie Scanner
  • Privacy Policy Generator
  • System status
  • Sitemap
  • Changelog
  • Alternatives
  • CookieBot
  • Termly
  • OneTrust
  • Iubenda
  • Cookie Information
  • CookieFirst
  • Illow
  • Blog
  • Guides
  • News
  • GDPR & CCPA
  • Privacy laws
  • Knowledge base
  • Support
  • Help center
  • Contact us
  • Integrations
  • Request a feature
  • Roadmap
  • For Partners
  • For agencies
  • For Affiliates

Copyright ©2025 CookieScript


main version