A cookie banner usually asks a question. It does not always make the answer matter. A banner can look perfect while analytics scripts load before anyone has chosen anything, or while a plugin quietly overrides the visitor's stored choice.
Three of the WordPress sites I run each had their own consent banner, written into the theme. I have built one plugin to replace them, Adaptive Consent Engine, and I am rolling it out site by site. It is built around a single idea: the banner is the visible part, and the gate behind it is the part that counts.
The cookie banner gate comes first, before any tag runs
The first thing in the page head is a small gate. It sets Google Consent Mode v2 defaults to denied, creates a consent API for other scripts to ask, and fires an event when the choice changes. Nothing that tracks can run before it.
Because the gate reads the stored choice in the browser, not on the server, it is safe on a fully page-cached site. The same cached HTML works for someone who accepted, someone who refused and someone who has not answered yet.
A stored choice must win over plugin defaults
This was the bug that started it. On one client's site, a visitor who had accepted analytics was being treated as if they had refused. Google's Site Kit plugin prints its own denied default later in the head, after the banner had applied the stored choice, and the later default won.
The fix is to send a consent update whenever a stored choice exists, not just set a default. In Consent Mode, an update outranks any default, however late that default arrives.
Trackers that wait
Some services cannot be controlled through Consent Mode, so the plugin holds them back until analytics consent is given: Microsoft Clarity, Jetpack Stats and a manually added Cloudflare Web Analytics beacon. Google's own tag runs in Consent Mode's advanced form, which means it loads in a denied state and sets no cookies until consent is granted.
Anything the plugin does not know about has to wait too, through the same API: aceConsent.onGrant('analytics', fn) runs the function immediately if consent exists, or later when it is given, and never under a refusal.
Do Not Track and Global Privacy Control are answers
If the browser sends Do Not Track or Global Privacy Control, the visitor has already answered. The plugin treats either as a refusal, shows no banner, and explains why if they open the cookie settings. A browser signal also overrides a stored grant.
List only what is really there
Many cookie policies list every service a plugin has ever heard of. This one detects what is actually active on the site: comment cookies only if comments are open, WooCommerce only if it is installed, Site Kit's modules only if they are on. The banner's categories, the cookie table on the policy page and the cookies cleared when someone withdraws consent all come from that one list.
A category appears only if something uses it. With only necessary cookies in use, no banner is shown at all, which is the best banner of all.
Fair choices
- Optional boxes are never ticked in advance.
- Accept and reject have the same visual weight.
- Any link to
#cookie-settingsreopens the banner, so withdrawing is as easy as agreeing. - The plugin registers with the WP Consent API, so other plugins that support it hear every choice.
Check yours
Open a private window and look at the network requests before you click anything. If an analytics or advertising request goes out, the banner is decoration. Then accept, reload and check that the choice is honoured, and that no plugin's later default undoes it. I wrote about testing that sequence in more detail in a consent banner is only one part of analytics.