How does automatic cookie blocking work?


By Manish Gautam

updated 4 months ago

General working mechanism 

The Secure Privacy Scanner scans your website and identifies all cookies and plugins setting them. You can view a detailed report of your cookies and plugins inside the Scan Report.

Based on the Scan Report, we generate a JavaScript file. This file is unique for each domain. It has all the information regarding the plugins and the origin of the cookies, (domains from which the cookies are inserted) With Automatic Cookie Blocking Secure Privacy will block all cookies except the essential ones from being set until a user has given their consent.

Based on their consent and the categories consented, if any, Secure Privacy will enable those plugins and cookies. By default all the cookies except will be blocked for any website, however, the webmasters can control this behavior by turning on/off the Auto blocking switch.

Every time we scan your website the JavaScript file is updated with the latest list of plugins and cookies found on your website.

Technical working mechanism

The way it technically works is that each cookie setting script is identified and saved in a unique JavaScript file. The most 'advanced' javascript feature that Secure Privacy uses is MutationObserver, which is compatible with all major browsers as well as IE11. The observers registered with Secure Privacy checks the script loading pattern and blocks them until the consent is given.

Right now Auto-Blocking will only work for iframes created dynamically on the page, such as advertising iframes that are injected by a JavaScript file. For iframes embedded directly on page, for example some youtube videos, we recommend following the manual steps to block those iframes.


Secure Privacy Auto-Blocking uses your scan results and cookie categorizations to know what to block. If a cookie has not been detected by the site scanner or is not categorized, it will not be controlled by the auto-blocking script.

To ensure a successful implementation of the auto-blocking script, rescan your site before beginning the implementation and ensure all cookies are categorized.

Did this answer your question?