Kafé Consent Mode for GA4 & Google Ads

Description

What makes it different. Unlike general-purpose consent plugins, it is built only for Google Analytics 4 and Google Ads: it loads the Google tag itself and implements Google Consent Mode v2 natively, in “basic” mode, so no request at all reaches Google before consent, including from Google tags added by the theme or other plugins. Its banner follows the French CNIL recommendations out of the box (refusing as easy as accepting, nothing ticked in advance, choice kept 6 months, Analytics cookies limited to 13 months), with nothing else to configure than your two Google IDs. It weighs about 4 KB of JavaScript, needs no account or outside service, and works with page caches.

Since March 2024, Google requires Consent Mode v2 for sites that advertise in Europe, and data protection authorities such as the French CNIL check cookie banners. Most consent plugins are built for every possible service and are heavy to set up. This one does one thing: a clean banner that follows the CNIL recommendations, for a site that only uses Google Analytics 4 and Google Ads. As the site owner, you remain responsible for your site’s compliance and for your privacy policy.

  • Banner with two categories: audience measurement (Google Analytics) and advertising (Google Ads).
  • Refusing is as easy as accepting: “Refuse all” and “Accept all” sit side by side on the first screen and look exactly the same.
  • No box ticked in advance, choice by category one click away.
  • Choice kept for 6 months, acceptance or refusal alike, then asked again.
  • Google Consent Mode v2: ad_storage, ad_user_data, ad_personalization and analytics_storage are set to “denied” before any Google tag, then updated with the visitor’s choice.
  • Nothing sent to Google before consent (Consent Mode “basic” implementation): gtag.js is only loaded once the visitor accepts, and only for the accepted categories.
  • Google tags added by your theme or another plugin are held back too (Site Kit, header code, Google Tag Manager…) until the matching category is accepted. DNS prefetch and preconnect hints to Google servers are removed.
  • Permanent “Manage my cookies” link: a small floating button, a shortcode [kscm_manage_link], or any menu link to #kscm-manage.
  • Google Analytics cookies limited to 13 months; Google Ads and Analytics cookies erased when consent is withdrawn.
  • Accessible: real buttons, labelled check boxes, keyboard use (Escape closes a reopened banner, focus returns where it was), placed at the top of the page for screen readers, respects reduced motion.
  • Light: about 4 KB of JavaScript and 1.5 KB of CSS once compressed, no jQuery, no request to any outside server. Works with page caches.
  • Translation-ready: the default banner texts follow the site language, or the page language set by Polylang or WPML, as soon as a translation is installed; a “Plugin language” setting can also impose an installed language or English.
  • Passes the choice to the WP Consent API when that plugin is installed.

Pro version

The Pro version adds:

  • a consent log (proof of consent): date, choice per category and exact banner text shown, anonymous consent ID, truncated IP address; search, CSV export, automatic clean-up;
  • several languages with your own texts: English, French, German, Spanish, Italian and Dutch ready to use and editable language by language, picked from the page language (Polylang, WPML, TranslatePress) or the visitor’s browser;
  • detection of the cookies present on your site, with a warning when one is set before consent, and a [kscm_cookie_list] table for your policy page;
  • a step-by-step check of your installation.

External services

This plugin loads Google services on your visitors’ pages, only after the visitor has accepted the matching category in the banner. Nothing is loaded or sent before that, and nothing at all if the visitor refuses.

  • Google Analytics 4 (Google tag gtag.js, loaded from www.googletagmanager.com), used to measure the site’s audience. Loaded only if you entered a Google Analytics measurement ID and the visitor accepts “Audience measurement”. Google then receives the pages viewed, the referring page, the browser, device and screen characteristics, the visitor’s IP address and the Google Analytics cookie identifiers (_ga, _ga_*, kept for up to 13 months), with the consent state.
  • Google Ads (same Google tag), used to measure and show your ads. Loaded only if you entered a Google Ads ID and the visitor accepts “Advertising”. Google then receives the pages viewed, conversions, ad click identifiers, the browser and device characteristics, the visitor’s IP address and the Google Ads cookie identifiers (_gcl_au, _gcl_aw), with the consent state.
  • Google tags added by your theme or another plugin (Site Kit, Google Tag Manager…) are held back the same way and only released once the matching category is accepted; they are those tools’ own connections.

Google’s terms and policies: Google Terms of Service, Google Privacy Policy, How Google uses information from sites that use its services, Google Analytics Terms of Service.

The plugin itself never contacts any server. The “See pricing and buy” button in the “Pro version” tab is a plain link to the checkout page of the Pro version (Freemius); nothing is sent until you click it.

Screenshots

Installation

  1. Install and activate the plugin.
  2. Go to Settings › Cookie consent and enter your Google Analytics 4 measurement ID (G-…) and/or Google Ads ID (AW-…).
  3. If the Google tag was already added elsewhere (theme, Site Kit, header code), remove it there to avoid counting visits twice.
  4. Click “See the banner on my site”.

FAQ

How do I check that nothing goes to Google before consent?

Open your site in a private window, press F12, open the Network tab and type “google” in the filter. Reload: the list stays empty. Click “Accept all”: the requests to googletagmanager.com appear.

Does it use Consent Mode “advanced”?

No. Advanced mode loads Google tags before consent to send cookieless pings, which many European authorities consider requires consent too. This plugin uses the basic mode: nothing is loaded before consent.

My site also uses YouTube, the Meta Pixel or other services.

This plugin only manages Google Analytics and Google Ads, so that it stays simple. If you use other services that set cookies, you need a more complete consent tool.

Does it work with page caching?

Yes: the choice is stored in a first-party cookie and applied in the browser.

Does the plugin contact any outside server?

No. The only requests are those of your Google tags, after consent. See “External services” below.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“Kafé Consent Mode for GA4 & Google Ads” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

0.1.7

  • Maintenance release.

0.1.6

  • Google tags added by other plugins are held back through the WordPress template output buffer (WordPress 6.9 or later required).
  • Plain description, without comparisons.

0.1.5

  • No translation template bundled: translate.wordpress.org builds its own.
  • Uninstall cleans every site of a multisite network.
  • Consent Mode script printed with wp_add_inline_script.
  • Wording: the banner follows the CNIL recommendations; the site owner remains responsible.

0.1.4

  • Code and settings page cleaned up after the WordPress.org review.
  • The choice cookie no longer contains any visitor identifier.
  • Banner accent colour added through wp_add_inline_style.
  • Translations are no longer bundled: they come from translate.wordpress.org; “Plugin language” only offers installed languages.
  • “External services” section in this readme.

0.1.3

  • Spanish, German and Italian translations.
  • “Plugin language” setting: Español, Deutsch and Italiano added.
  • Default banner texts follow the page language when a multilingual plugin sets it late.

0.1.2

  • Plugin renamed to “Kafé Consent Mode for GA4 & Google Ads”.

0.1.1

  • Translations loaded without load_plugin_textdomain() (Plugin Check).
  • “Plugin language” setting: site language, English or French.

0.1.0

  • First version.