Skip to main content

WordPress

The OptSens | Cookie Consent Platform for GDPR & CCPA plugin connects your WordPress site to your OptSens account and injects the banner script for you. The plugin is free. An OptSens account is required.

Install the plugin​

  1. In WordPress admin, open Plugins > Add New.
  2. Search for OptSens and open OptSens | Cookie Consent Platform for GDPR & CCPA in the results.
  3. Click Install Now, then Activate.

Connect your site​

  1. Open OptSens in the admin sidebar.
  2. Enter your Domain ID from the dashboard Integration page or the Integration step of the guided onboarding.
  3. Click Connect website.

The settings screen validates the ID against your account and shows a status of Active, Saved, awaiting verification, or an error. The ID is per-site, and each site in a multisite network needs its own ID and its own activation.

What the plugin does​

The plugin injects the OptSens script as the first element in <head> on every public page:

<script src="https://cdn.optsens.com/optsens.min.js/YOUR_DOMAIN_ID"></script>

It runs at the earliest WordPress head hook, and the script loads ahead of Google Analytics, the Meta Pixel and other trackers, which lets the auto-blocking layer intercept them. No script is added until a Domain ID is saved.

Banner design, languages, geo rules and consent records are all managed in your OptSens dashboard, not in the plugin. The plugin only injects the script and reads configuration from your account.

The WP Consent API plugin lets WordPress plugins read the visitor's consent in one standard way. Google Site Kit and other plugins use it to decide what they may load and what they send to Google.

To install it:

  1. In WordPress admin, open Plugins > Add New.
  2. Search for WP Consent API and open WP Consent API in the results.
  3. Click Install Now, then Activate. The plugin has no settings.

When WP Consent API is installed and a Domain ID is saved, the OptSens plugin passes the visitor's choice to it on its own. There is nothing to set up, and the OptSens script stays in charge of consent.

OptSens categories map to WP Consent API categories like this:

WP Consent APIOptSens
functionalAlways allowed (necessary)
preferencesFunctional
statisticsAnalytics
statistics-anonymousAnalytics or Performance
marketingAdvertising
  • Before a choice, every category reads as not allowed, so no plugin can load anything the banner has not allowed yet.
  • When the visitor chooses, the categories update on the same page.
  • When the visitor withdraws their choice, the categories go back to not allowed.

Site Kit by Google​

Site Kit follows the banner only when its own Consent Mode setting is on:

  1. Install and activate WP Consent API, as above.
  2. In WordPress admin, open Site Kit > Settings > Admin Settings.
  3. Turn on Consent Mode.

OptSens then makes Site Kit send the same Google Consent Mode values as the banner (statistics to analytics_storage, marketing to the three ad types), so both never disagree. Leave the Google tag to Site Kit: do not add a second Google tag for the same property by hand or through Google Tag Manager.

The WP Consent API and Site Kit support needs OptSens plugin version 1.0.1 or later.

After installing​

  1. Open your site in a private window. The banner shows on first visit.
  2. Run the implementation check. During first-time setup it runs as the onboarding Verify step, and you can run it at any time from the dashboard Integration page.
  3. Work through Verify installation.

If the banner does not show, start with Install troubleshooting.