
外掛標籤
開發者團隊
② 後台搜尋「ConsentSprout – Cookie Consent Manager」→ 直接安裝(推薦)
原文外掛簡介
ConsentSprout displays a configurable consent banner and preference panel. Visitors can accept all optional categories, reject them, or choose functional, analytics, and marketing categories separately. Necessary storage is always enabled.
Consent choices are stored in the visitor’s browser using localStorage. ConsentSprout does not send consent records to a remote server and does not set cookies or collect personal data. If browser storage is blocked, a choice remains effective only for the current page view.
This plugin is a technical consent tool. It does not guarantee legal compliance. Site owners are responsible for configuring the plugin and integrations for their own legal and operational requirements. ConsentSprout cannot automatically detect or block every script from themes, plugins, tag managers, or custom code; those integrations must be configured by the site owner.
No external services, remote assets, analytics, or telemetry are used.
Integration
For an external script, change src to data-src, set type="text/plain", and specify a category. Example:
For inline code, use the same type and category attributes and put the code in the element. Only do this for scripts you control. Do not put executable third-party code into unsanitized admin settings.
Categories are functional, analytics, and marketing. necessary is always true. This mechanism only applies to scripts explicitly marked for ConsentSprout. It cannot prevent a separate plugin or theme from loading the same script by another route.
JavaScript API
The API is available as window.ConsentSprout after the plugin script loads:
ConsentSprout.getConsent() returns the category object or null before a choice is saved.
ConsentSprout.hasConsent('analytics') returns a boolean.
ConsentSprout.openPreferences() opens the preference panel.
ConsentSprout.withdraw() withdraws optional consent by saving all optional categories as false.
ConsentSprout.onChange(function(categories) {}) registers a consent-change callback.
document emits consentsprout:consent-ready and consentsprout:consent-changed CustomEvents with consent data in event.detail.
Use [consentsprout_preferences] in a post or page to display a link-style button that opens preferences.
Privacy
ConsentSprout stores the category selection, policy version, choice time, and expiry time in localStorage on the visitor’s device. It does not transmit this data to the site or a third party. The storage key is consentsprout_consent. Clearing browser storage removes the saved choice. The site owner can change the consent lifetime in settings. Necessary storage supports remembering that choice; optional categories remain off until selected.
