- SureCookie Installation Guide
- Installing SureCookie Pro
- Updating SureCookie
- How to Set Up SureCookie: Onboarding Wizard Guide
- SureCookie Dashboard Overview
- Connecting Your Site to SureCookie (Scanner Setup)
- Using SureCookie on Multiple Sites
- Uninstalling SureCookie & Data Cleanup
- SureCookie Shortcodes Reference
- Preferences Settings (Menu, Branding, Analytics)
- Customizing Banner Content
- Customizing Banner Layout
- Custom CSS for Banner Styling
- How to Configure the Floating Widget
- Customizing the Preference Modal
- Controlling Where the Cookie Banner Appears
- Customizing Banner Colors (Custom Colors, WCAG)
- Customizing the Blocked Content UI
- Banner Text in the Wrong Language (WPML, Polylang, and Locales)
- Re-Consent
- Understanding SureCookie Logs
- How to Set Up Geographic Targeting
- Block Scripts Until Consent (Resource Blocking)
- Setting Up Google Consent Mode v2
- Consent Models Explained (Opt-in vs Opt-out)
- Exporting Consent Logs (PDF Proof + CSV)
- Consent & Data Settings (Duration, Retention, Renew)
- Consent Forwarding Across a Multisite Network
- Resource / Script Blocking (Add Embeds + Fixes)
- Troubleshooting SureCookie
- Fix a Stuck or Failed Cookie Scan
- Why Some Cookies Aren’t Detected
- Banner Not Appearing: Troubleshooting
- Settings or Cookie Categories Not Saving or Loading
- Embeds Blocked After Consent (YouTube, Maps, Vimeo)
- Site Performance / Page Speed
- Scanning Your Site From Your Browser
- Importing and Exporting SureCookie Settings
- Verifying Your Domain With a DNS Record
WP Consent API Compatibility
Your consent banner is not the only plugin on your site that cares about consent. Statistics, marketing and e-commerce plugins each need to know whether a visitor agreed to tracking. Without a shared standard, each one has to guess. The WP Consent API is the WordPress standard that fixes this: one plugin manages consent, and every plugin that supports the standard reads it.
When the WP Consent API plugin is active, SureCookie registers itself as your site’s consent manager and shares each visitor’s choices with it. Plugins that support the standard then follow your SureCookie banner. Supporting plugins need no extra setup, and they get each new choice as soon as the visitor makes it. This integration is part of the free plugin.
Set Up the Integration
There is no setting for this integration inside SureCookie. It turns on by itself when the WP Consent API plugin is active.
- Install and activate the WP Consent API plugin from the WordPress.org plugin directory.
- Go to SureCookie → Settings → Banner → Content.
- Check that Enable Cookie Banner is on.
The other plugins on your site benefit only if they support the WP Consent API too. Check each plugin’s documentation to confirm.
Note: Use SureCookie 1.5.0 or later. In earlier versions, plugins that read consent on the server were told nothing until a visitor clicked the banner.
How Categories Map
The WP Consent API uses its own names for consent types. SureCookie translates your categories automatically.
| SureCookie Category | WP Consent API Type |
|---|---|
| Essential Cookies | functional |
| Functional Cookies | preferences |
| Analytics Cookies | statistics |
| Marketing Cookies | marketing |
| Uncategorized Cookies | marketing |
| Custom categories you add | marketing |
SureCookie shares four of the API’s types: functional, preferences, statistics and marketing. By default, it does not set the API’s statistics-anonymous type (see For Developers below).
Two details are worth knowing:
- Essential Is Always Allowed: Strictly necessary cookies do not need consent, so the
functionaltype always reads as allowed, whatever the visitor chose. - Marketing Cookies Decides the Marketing Type: The API holds one answer per type. Uncategorized and custom categories share the
marketingtype with Marketing Cookies, and the visitor’s Marketing Cookies choice decides it. A visitor who accepts Marketing Cookies but declines one of your custom categories still reads as allowed formarketing.
To add or review your own categories, see Manage Cookie Categories.
For Developers
The surecookie_wp_consent_api_category_map filter changes the type for custom and Uncategorized categories only. The four built-in categories always keep the mapping above. Pointing a custom category at a type a built-in category already uses has no effect, because the built-in category’s choice decides that type. Only statistics-anonymous, which no built-in category uses, gives a custom category a signal of its own. See Developer Reference: Hooks & Filters.
What the API Reports Before a Choice
Until a visitor responds to the banner, SureCookie reports the consent model that applies to them:
- Opt-in:
functionalreads as allowed.preferences,statisticsandmarketingread as denied. - Opt-out: Before a visitor makes a choice, the four types SureCookie sets normally read as allowed. Global Privacy Control overrides statistics and marketing, as described below.
Out of the box, SureCookie uses opt-in for every visitor. SureCookie also tells the API which model applies, as its consent type (optin or optout), so supporting plugins know the default too.
With Geographic Rules
Geographic Rules is a SureCookie Pro feature, set under SureCookie → Tracking Manager → Geographic Rules. When you choose Show only where required by law, visitors in a targeted region get that region’s consent model in the API. To set up regions, see How to Set Up Geographic Targeting.
When the Browser Sends Global Privacy Control
Some browsers send a privacy signal called Global Privacy Control (GPC), which asks every site not to sell or share the visitor’s data. Brave and DuckDuckGo send it by default, and Firefox sends it in every private window. SureCookie honors the signal, and it outranks the visitor’s banner choice, so the API reports:
| WP Consent API Type | While GPC Is On |
|---|---|
functional | Allowed |
preferences | Follows the visitor’s Functional Cookies choice |
statistics | Denied, whatever the visitor chooses |
marketing | Denied, whatever the visitor chooses |
SureCookie sends these values when the visitor makes a choice and again on every page load, in the browser and on the server. So if you test in a Firefox private window, statistics and marketing stay on deny after Accept All. That is the signal working, not a broken sync.
Note: In SureCookie 1.7 and earlier, preferences also reads as denied while GPC is on.
For everything else the signal changes, see How SureCookie Honors Global Privacy Control (GPC).
How It Works
SureCookie shares consent in the two places other plugins look for it:
- In the browser: Each choice goes to the API as the visitor makes it, and again on every page load. Scripts that listen for consent changes can react without a reload.
- On the server: Once WordPress has finished loading, SureCookie reads the visitor’s stored choice and answers consent checks from other plugins in that same request, such as a call to
wp_has_consent()while the page is built. A check made earlier, duringplugins_loadedorinit, does not get SureCookie’s answer yet. If a full-page cache serves the page, that answer is cached with it, so a plugin that needs each visitor’s own answer should read consent in the browser. See Compatibility: Caching Plugins & Page Builders.
Because SureCookie re-sends the visitor’s consent on every page load, a value you set by hand, for example with wp_set_consent() in the browser console, lasts only until the next page.
SureCookie also lists its own two cookies, surecookie_user_consent and surecookie_session_id, in the API’s cookie information, so plugins that read cookie details from the API include them.
Using It With Site Kit by Google
Site Kit’s Consent Mode setting reads consent through the WP Consent API. With both plugins active, Site Kit’s Consent Mode follows your SureCookie banner.
Use one Consent Mode implementation, not two:
- Site Kit’s Consent Mode: Keep Enable Google Consent Mode off in SureCookie. Site Kit then sends Google the choices SureCookie shares through the API.
- SureCookie’s Consent Mode: Turn on Enable Google Consent Mode under SureCookie → Settings → Consent Frameworks → Google Consent Mode, and turn off Consent Mode in Site Kit. SureCookie shows a notice in your dashboard while both are on.
To set up SureCookie’s own implementation, see Setting Up Google Consent Mode v2.
Check That It Works
You can watch SureCookie update the API in your browser’s developer tools.
- Open your site in a window that does not send GPC, such as a normal Chrome window. Press F12, open the Console tab, type
navigator.globalPrivacyControland press Enter. It should returnfalseorundefined. - Clear your site’s cookies and reload the page.
- Open the cookie list: Application → Cookies in Chrome, or Storage → Cookies in Firefox. With opt-in,
wp_consent_statisticsandwp_consent_marketingreaddeny. - Click Accept All on the banner. Both switch to
allowwithout a reload. - In the console, type
wp_has_consent('statistics'). It returnstrue.
To check a declined category, open the preferences, switch Analytics Cookies off and save. wp_consent_statistics switches back to deny.
What It Does Not Replace
The WP Consent API is a communication standard, not an enforcement tool. A plugin that ignores the standard still sets its cookies. SureCookie’s Block Scripts Until Consent handles those: it holds scripts and embeds on the page until the visitor consents, whether or not they support the API.
Use the API to share consent with supporting plugins. Use blocking rules for the scripts, embeds and other supported resources that SureCookie can match.
Troubleshooting
- A plugin still sets cookies before consent: Check its documentation for WP Consent API support. If it does not support the API, block it instead under SureCookie → Tracking Manager → Scripts and Embeds.
- You are not sure the integration is active: It runs only while the WP Consent API plugin is active. Check Plugins → Installed Plugins, then confirm Enable Cookie Banner is on.
- A supporting plugin stays off before visitors choose: This is the opt-in default. The API reports consent once the visitor accepts the matching category.
- A plugin runs after a visitor declined a custom category: Custom categories share the
marketingtype, so the visitor’s Marketing Cookies choice decides it. See How Categories Map above. statisticsandmarketingstay on deny after Accept All: The browser is sending GPC. Runnavigator.globalPrivacyControlin the console of that window. If it returnstrue, test again in a window where it does not. See When the Browser Sends Global Privacy Control above.- A value you set with
wp_set_consent()changes back: SureCookie re-sends the visitor’s consent on every page load. Make the choice on the banner instead.
Next Steps
To hold back plugins that do not support the standard, see Resource / Script Blocking (Add Embeds + Fixes). To understand the defaults the API reports, see Consent Models Explained (Opt-in vs Opt-out).
We don't respond to the article feedback, we use it to improve our support content.