跳到内容

Kafé Consent Mode for GA4 & Google Ads

v0.1.7

kafestudio · 2026年11月27日 上架

A cookie banner built only for Google Analytics 4 and Google Ads, with Google Consent Mode v2 and Google tags held back until consent.

正在使用
10 以下
评分
暂无
累计下载
0
最近更新
2026年11月27日
需要 WordPress 6.9+已测试到 7.1.5PHP 8.0+

贡献者

截图

The banner on a visitor’s first visit: “Refuse all” and “Accept all” side by side, with exactly the same look.
The banner on a visitor’s first visit: “Refuse all” and “Accept all” side by side, with exactly the same look.
Choice by category: nothing is ticked in advance.
Choice by category: nothing is ticked in advance.
Settings: Google tag IDs, banner position and colours, texts, plugin language.
Settings: Google tag IDs, banner position and colours, texts, plugin language.
The Pro version tab: what the Pro version adds and how to install it.
The Pro version tab: what the Pro version adds and how to install it.
Pro version (not included in this plugin): the consent log, a dated record of every choice with the exact banner text shown.
Pro version (not included in this plugin): the consent log, a dated record of every choice with the exact banner text shown.
Pro version (not included in this plugin): step-by-step check-up of the installation.
Pro version (not included in this plugin): step-by-step check-up of the installation.

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.

Plums

按场景查找 WordPress 插件。安装量、评分和兼容版本来自官方目录。

导航

说明

WordPress 是 WordPress Foundation 的商标。本站与 WordPress Foundation、Automattic 没有隶属关系。这里不托管插件文件,下载和安装以 WordPress.org 上的页面为准。

© 2026 Plums