Home / Docs / Script blocking

Script blocking

ClearCrumb holds back tracking code until the visitor agrees to its category. This is what makes a banner more than a notice.

How it works

  1. When WordPress builds a page, ClearCrumb looks at every <script>, <iframe> and stylesheet link.
  2. If it matches a service you have listed, the tag is changed so the browser does not run it: scripts get type="text/plain" and a data-cc-category, iframes keep their address in data-cc-src.
  3. A tiny guard script in the page head also catches scripts that other scripts add later.
  4. When the visitor agrees to a category, its scripts are released in their original order. If they withdraw a yes later, the page reloads so the code stops running.

Every page is rewritten the same way for every visitor, so full-page caching keeps working.

The service library

ClearCrumb ships with 155 services, from Google Analytics and Tag Manager to Hotjar, the Meta Pixel, YouTube and Calendly. Each has a category, its cookies and the patterns used to recognise it. The library lives inside the plugin; nothing is downloaded.

Go to ClearCrumb → Services & cookies to add or remove services and to switch “wait for consent” off for one service.

Video and map placeholders

Blocked YouTube, Vimeo and Google Maps embeds show a card with a local preview image and two buttons: Load (this embed only) and Always allow (the whole category). Preview images are fetched by your server and stored in your uploads folder, so the visitor’s browser never contacts Google before consent.

Necessary services

Services in the Necessary category, such as security or payment scripts, are never blocked. You cannot move a service into Necessary by hand; the category comes from the library.

Pages that are never rewritten

wp-admin, REST and AJAX requests, feeds, the Customizer and page-builder previews. Developers can skip more pages with the clearcrumb_block_page filter (see Hooks & WP-CLI).