All 19 Cookie Consent sections

See every section

The part that makes it different

Updated Cookie Consent 1.6.0Tested with WordPress 7.1

Most consent banners ask a question and change nothing. The analytics and advertising tags load in the page head, run immediately, and have already reported the visit by the time anybody reads the banner. The answer is stored and then ignored.

This plugin rewrites the page. Every script and embed belonging to a service nobody has agreed to comes out looking like this:

HTML
<!-- what the site printed -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-ABC"></script>

<!-- what leaves the server -->
<script type="text/plain" data-trcc="analytics"
        data-trcc-src="https://www.googletagmanager.com/gtag/js?id=G-ABC" async></script>

A browser will not run a script whose type it does not recognise, and it will not fetch an address that is no longer in src. When the visitor agrees, the plugin's own script builds the tag properly and puts it in, and only then does it load. The scripts go back one at a time, in the order the page has them, and a script written without async or defer is waited for before the next, so a snippet that uses a library still finds it. A module script goes back as a module.

The address is read however the tag was written: in double quotes, in single quotes (src='…') or with no quotes at all, as page optimisers print it. A frame that a lazy loader has written with its address in data-src or data-lazy-src, and src empty, about:blank, javascript:false or a data: image, is held back by that address. The rest of the tag is read the same way, so a title= or width= inside the address is never taken for the frame's own title or width, and a frame written with a bare sandbox comes back with it.

A script is held back whatever JavaScript type it is written with, including the older ones that old snippets and some themes still print, such as type="application/x-javascript", type="text/javascript1.2" or language="JavaScript", because browsers still run those. A block that is not a script a browser runs, such as JSON-LD structured data, a template or an import map, is left exactly as it is. Read my site lists the other sites such scripts load from in the same way.

An embedded video or map is held back the same way, and shows a Load this content button in its place. The box is exactly where the video will be (the size of WordPress's video block, or the width and height the frame was written with), so nothing on the page moves when it loads. Pressing the button loads that one video without storing any answer. When it loads, it comes back with its title and what it was allowed to do (full screen, picture-in-picture), as it was written, and a keyboard or screen-reader visitor who pressed the button is taken straight into it.

This happens for everybody, including people who have already agreed. That is deliberate: your pages are cached, so the HTML cannot depend on who is reading it. The browser does the unblocking. Any other arrangement would serve the first visitor's answer to everybody after them.

Still stuck? Ask the developers who wrote it. We aim to reply within one business day.