klickbeetracking
Setup guides

A CNIL-compliant cookie banner on WordPress: setup guide

Published November 9, 2026

What the CNIL expects from a cookie banner, how to add scripts on WordPress without breaking it, how to hold Meta and Google tags until consent, and how to test the result.

A cookie banner on WordPress is compliant in practice when three things hold: refusing is as easy as accepting, nothing non-essential is loaded before the visitor says yes, and the tags you added by hand are actually held back by the banner. The banner itself is the easy part. The tags pasted in your theme, a header plugin or a page builder are what usually break it.

What does the CNIL expect from a banner?

The CNIL's own guidance is short. On its page about the amended guidelines, the CNIL says that refusing trackers must be as easy as accepting them. It also says that no tracker that is not essential to the service may be placed before consent, and that consent must come from a clear positive act. Visitors must be able to withdraw consent easily and at any time. The CNIL recommends a "refuse all" button next to "accept all".

In practice that gives you a checklist:

  • Two buttons of equal weight on the first layer: accept all and refuse all.
  • No pre-ticked boxes.
  • A way to reopen the choice later, for example a link in the footer.
  • No Meta, Google Ads, LinkedIn or similar tag firing before the click.

This is the French rule set. Other countries differ, and the site owner stays responsible for the setup.

Where do scripts go on WordPress?

Every tag that must wait for consent has to be placed somewhere WordPress can load it, and that place decides whether the banner can control it.

On a self-hosted site, the official developer documentation describes wp_enqueue_script() as the recommended method of linking JavaScript to a WordPress page, called on the wp_enqueue_scripts hook. The wp_head hook prints scripts or data in the head of the front end. A script added through either route loads for everyone, consent or not, unless something gates it.

On WordPress.com, the plan matters. WordPress.com states that adding code to headers is available on the Personal, Premium, Business and Commerce plans, through the free WPCode "Insert Headers and Footers" plugin. Free sites cannot do it. Its code documentation separately says JavaScript is allowed on plugin-enabled plans with hosting features activated, so check your plan in your own dashboard before you plan the install.

Do not paste the same ad tag in three places. A tag pasted in the theme, in a header plugin and in Google Tag Manager fires three times, and only one of them is behind your banner.

How do you hold Meta and Google tags until consent?

You have two options.

  1. Use a consent tool that blocks scripts. Declare each tag in the tool and let it release them after the visitor accepts. Remove the hard-coded copies, otherwise the block is pointless.
  2. Load the ad pixels from a tool that already respects the banner, so there is one place to look.

With Klickbee, the cookieless measurement itself sets no cookie and keeps working without a banner decision. The built-in consent banner is free and off by default, follows CNIL rules (equal "Reject all", closing means refusal, the choice is asked again after 6 months) and gates the ad pixels you add in Klickbee: Meta, Google Ads, LinkedIn or custom code. It does not gate tags you pasted somewhere else on your site. The tracker is added with a script tag, not through an extension, as described in the install guide and the help center. The consent banner page shows the options.

Two caveats. Replay and ad conversions go beyond the CNIL audience-measurement exemption, so treat them as consent-based. And for the Meta side of a missing-conversions problem, read why Meta and GA4 conversions go missing behind a cookie banner.

How do you test that the banner really works?

Test as a first-time visitor, in a private window.

  1. Open your site and do not click anything. Open the browser developer tools, Network tab, and look for requests to Meta, Google Ads or other ad domains. There should be none.
  2. Check Application, Cookies and storage. Non-essential trackers should not be there yet.
  3. Click "refuse all". Reload and browse two pages. Still nothing from ad tags.
  4. Clear site data, come back, click "accept all". Now the ad requests should appear.
  5. Reopen the banner from the footer link and change your mind. The tags should stop on the next load.

Repeat on mobile and after every theme, plugin or tag manager change. Caching plugins and page builders are the usual reasons a clean setup quietly stops working.

What about the cookie declaration?

A banner tells visitors what they can choose. A declaration lists what is actually on the site. Klickbee generates a cookie declaration with cookie detection, as an embed or a hosted page, so you can link it from the banner and the footer.

Ready to try it on your WordPress site? Start on the free plan.

FAQ

Does WordPress include a cookie banner by default?

I could not confirm a built-in consent banner in the WordPress documentation. Plan on adding one through a consent tool, and make sure the tags on your site are really gated by it.

Is a banner enough to be compliant?

No. The banner is only the interface. Compliance depends on what loads before and after the choice, how long the choice is kept and whether withdrawal is easy. Test it as in the steps above.

Can I use a cookie banner on a free WordPress.com site?

WordPress.com says header code is available on its paid Personal, Premium, Business and Commerce plans, and that free sites must upgrade for that feature. Check your plan before you choose a method.

This article is information, not legal advice.

← All articles