Linux 软件免费装
Banner图

Geenen Cookie Banner for Google Consent Mode v2

开发者 geenenitsysteme
更新时间 2026年8月17日 16:31
PHP版本: 7.4 及以上
WordPress版本: 7.0
版权: GPL-2.0-or-later
版权网址: 版权信息

标签

cookie gtm gdpr consent google consent mode

下载

2.0.0 2.0.1 2.0.2

详情介绍:

Most consent plugins load Google's tag on every page view and rely on Consent Mode signals to keep data collection switched off. This plugin does not have to. In its default "Basic" mode the tag is not requested at all until the visitor clicks, so before that decision no connection to googletagmanager.com is made and no data leaves the browser. That is the conservative reading of the GDPR, and here it is a single setting rather than a paid tier. The "Advanced" mode is the other side of that trade: tags load immediately without cookies and send denied signals, which is what Google's conversion modeling needs. Pick one per site. Everything runs on your own server. There is no external CMP service to sign up for, no account, no license key, no phone-home, and no server-side consent log. The whole plugin is under 60 KB of vanilla JavaScript and PHP with no build step, no jQuery and no third-party libraries.

安装:

  1. Upload the geenen-cookie-banner folder to wp-content/plugins/.
  2. Activate the plugin.
  3. Under Settings -> Consent Banner enter your GA4 Measurement ID (and optionally a Google Ads ID and/or a GTM container ID) and adjust text, colors and position.
  4. Optionally place the shortcode [geencb_settings_link], e.g. in the footer, so visitors can withdraw their consent.

屏幕截图:

  • The details panel: statistics and marketing can be granted separately, essential is always on.
  • Settings: Google tag IDs, the Basic/Advanced tag mode and the banner texts.

常见问题:

Does the plugin set cookies before consent?

No. Before a click on "Accept all", "Deny" or "Save selection" no consent-requiring cookies are set. Consent Mode is "denied" and Google tags respect that. Only the functionally necessary cookie geencb_consent (your own decision) is stored after the click.

Is gtag.js or gtm.js loaded before consent?

That depends on the tag mode. In "Basic" mode (default) the scripts load only after the click on "Accept all" (or a saved selection granting a category) - before consent not a single request reaches googletagmanager.com. In "Advanced" mode the scripts load immediately without cookies, but send only denied signals (Consent Mode v2) until consent is given; this enables Google's conversion modeling.

Are any scripts loaded without a tag ID?

No. Without a configured GA4, Google Ads or GTM ID, no scripts are loaded and the banner is not shown.

Can I use Google Tag Manager?

Yes. Enter a GTM container ID (GTM-XXXXXXX) in the settings. It loads alongside GA4/Google Ads, or on its own. The same Consent Mode v2 defaults apply, because GTM shares the dataLayer.

How do I withdraw my consent?

Use the shortcode [geencb_settings_link] or the JavaScript call window.geencbShowBanner() to reopen the banner.

Can I change the banner design?

Colors and position are settings (Appearance section). Everything else is plain CSS: put it in your theme's Additional CSS panel - Appearance -> Editor -> Styles -> Additional CSS on block themes, Appearance -> Customize -> Additional CSS on classic ones - or in a child theme stylesheet. The quickest wins are the CSS custom properties --geencb-primary, --geencb-bg, --geencb-text and --geencb-primary-contrast, e.g. :root { --geencb-primary: #e11d48; }. Scope them to :root, not to #geencb-banner - the floating cookie settings button and the [geencb_settings_link] button sit outside the banner and read the same variables. The base styles use !important to survive theme CSS, so overriding those properties needs !important too.

I use a caching plugin with "delay" or "combine" JavaScript. Anything to watch out for?

Exclude the script handle geencb-consent from JavaScript delaying, combining and deferring. It carries the Consent Mode defaults and has to run before any Google tag on the page; if it is delayed while another plugin's tag is not, the tag fires before consent is signalled.

How do I add a cookie settings link to my footer menu?

Add a custom menu link (Appearance -> Menus -> Custom Links) with the URL #geencb-settings and a label such as "Cookie settings". The plugin opens the banner when it is clicked. Alternatively use the shortcode [geencb_settings_link], or give any element the CSS class geencb-open.

更新日志:

2.0.2 2.0.1 2.0.0 1.8.0