Skip to content

Consent Manager

Consent Manager is an optional module that adds a native cookie-consent banner with categories, Google Consent Mode v2 signalling, and a log of the decisions visitors made. Other modules can “gate” their scripts and iframes so they only run once the visitor grants the matching category.

The module provides tools that help you collect and honour consent choices. It does not by itself guarantee any particular legal outcome and is not a substitute for legal advice.

The module is off by default. Enable it in WooCommerce > Polski > Modules (the “Consent Manager” section, module key consent_manager). Once enabled, the banner is rendered in the storefront footer and a Consent records view becomes available in the admin. That view and the CSV export require the manage_woocommerce capability.

The banner uses a fixed set of categories. The “Necessary” category is always granted and cannot be switched off. The other three are optional and the visitor can toggle them on or off.

CategoryKeyDefaultDescription
Necessarynecessaryalways onRequired for the store to work. Always granted, cannot be disabled.
AnalyticsanalyticsonTraffic measurement and statistics.
MarketingmarketingonAdvertising and remarketing.
PreferencespreferencesonPersonalisation and features that remember choices.

By default all three optional categories are active in the banner. You can disable any of them in the module settings if your store does not use it.

When Google Consent Mode is enabled (the default), the module prints the default consent state before any gtag/GTM code (on wp_head at priority 0). All signals start denied, except security_storage, and are then updated immediately from the stored cookie if the visitor has already decided. This guarantees gtag/GTM see the correct state from their first call.

The banner categories map onto Consent Mode signals as follows:

CategoryConsent Mode v2 signals
Analyticsanalytics_storage
Marketingad_storage, ad_user_data, ad_personalization
Preferencesfunctionality_storage, personalization_storage

Once the visitor makes a choice, the banner calls gtag('consent', 'update', ...) with the current state.

The module exposes a contract that lets other modules run scripts and iframes only after the matching category is granted. Gated code is rendered as <script type="text/plain" data-polski-consent="CATEGORY">, so the browser never executes it on load. The front-end controller rewrites it into an executable script once the category is granted (immediately if the cookie already allows it, otherwise on the polskiConsentChange event).

When the choice changes, the banner:

  • writes the polski_consent cookie with the list of granted categories,
  • calls gtag('consent', 'update', ...),
  • fires the polskiConsentChange window event that gated scripts react to,
  • POSTs the decision to the REST recorder.

Every decision saved from the banner is written to the consent log. It is a read-only admin view, available while the module is enabled, for documenting the choices visitors made. The log is not a substitute for legal advice.

ColumnDescription
DateDate and time of the stored decision.
CategoryThe category the decision applies to.
Decision”Granted” or “Denied”.
UserThe user ID, or “Guest” for logged-out visitors.
IP addressThe visitor’s IP address (when available).
Wording versionA hash of the banner wording the visitor actually saw.

Each stored choice is tied to the banner wording version (a hash of the heading, text, and category list), so you can tell exactly which wording the visitor accepted.

The Export CSV button downloads the full log as a CSV file. The export includes the columns: id, created_at, category, granted, user_id, ip_address, user_agent, consent_version. The export requires the manage_woocommerce capability and is protected by a nonce.

Settings live on the module card in WooCommerce > Polski > Modules.

SettingDefaultDescription
Category: AnalyticsonWhether the analytics category is shown in the banner.
Category: MarketingonWhether the marketing category is shown in the banner.
Category: PreferencesonWhether the preferences category is shown in the banner.
Heading(empty)Optional banner heading.
Banner textdefault textThe main banner text (allows basic HTML).
Accept-all label”Accept all”Text of the accept-everything button.
Reject-all label”Reject all”Text of the reject-optional-categories button.
Manage label”Manage”Text of the button that opens the category choices.
Save-choices label”Save choices”Text of the button that saves the selected categories.
PositionbottomBanner placement: top, bottom, or center.
Google Consent ModeonWhether to print Google Consent Mode v2 signals.

The banner does not appear - make sure the module is enabled in WooCommerce > Polski > Modules and that the theme calls wp_footer(). The banner is rendered in the footer.

Google tags do not react to consent - check that Google Consent Mode is enabled and that your gtag/GTM code loads after the Consent Mode signals (they are printed very early in wp_head).

A gated script does not run - the script only starts after the matching category is granted. Verify that the visitor granted the category and that the script was emitted through the gating contract.

Reporting issues: github.com/wppoland/polski/issues

This page is for information only and is not legal advice. Consult a lawyer before deploying. Polski for WooCommerce is open source software (GPLv2) provided without warranty.