Skip to content

[00] Subset Opt-Out, User guide

Global Privacy Control

Last updated

How Subset Opt-Out reads Global Privacy Control, which scripts it holds back, how it updates Google Consent Mode, and how to check it in DevTools.

Subset Opt-Out honours Global Privacy Control (GPC) with no banner and no setup. A small script near the top of <head> reads navigator.globalPrivacyControl. If it’s true, the visitor is opted out before your trackers load, even if they allowed selling and sharing on an earlier visit. Held ad scripts stay switched off, and Google tags are told ad_storage: denied through Consent Mode. This page explains each step and how to check it in your browser.

GPC is a browser setting or extension that asks every site not to sell or share the user’s data (globalprivacycontrol.org (opens in a new tab)). For what California requires of you, read the Do Not Sell or Share link.

How the head script reads the signal

Subset Opt-Out prints two things at the start of wp_head: a JSON settings block at priority 0, then the head script at priority 1. Both are the same for every visitor, so page caching keeps working. The script makes one decision when the page loads:

const gpc = win.navigator.globalPrivacyControl === true;

// Global Privacy Control is an opt-out, recorded without a click (CCPA regs § 7025(c)(3)).
const now = get().categories;
const out = decide(config, 0, 1).categories.statistics;
if (gpc && !(state && (state.gpc || (!now.marketing && now.statistics <= out)))) {
  set({ statistics: now.statistics && out, marketing: false }, "gpc");
}

state is the visitor’s saved choice, read from the subset_cm_consent cookie. With GPC on, the script records an opt-out with the source gpc and writes the cookie, unless the saved choice is already an opt-out or was made with GPC on. Anything the visitor had already turned off stays off. The cookie lasts 12 months and is set with path=/, SameSite=Lax, and Secure on HTTPS.

What the opt-out denies depends on your settings:

  • marketing is always denied
  • statistics is denied too if you’ve ticked Opt-out also covers analytics
  • under Pro’s opt-in mode, every optional category is denied

Three cases change the outcome:

  • GPC overrides an earlier opt-in. A visitor who allowed selling and sharing, then turned GPC on, is opted out on their next page view, as § 7025(c)(3) of the CCPA regulations requires. The Do Not Sell or Share link covers the rule.
  • A choice made with GPC on sticks. If the visitor then turns the switch back on and saves, with GPC still on, the cookie records that the choice was made with the signal on ("gpc": true). That’s their answer to the signal, so GPC doesn’t override it on later pages.
  • Earlier scripts run first. The head script is the first one WordPress prints, but a script your theme prints above wp_head() runs before it. Move that script below wp_head() or hold it with a custom rule.

What gets blocked

Subset Opt-Out holds tracking scripts for every visitor and lets the browser release them. On the server, any script that matches a service you’ve left on in Services to stop after an opt-out, or one of your Custom blocking rules, is rewritten so it can’t run:

<script
  type="text/plain"
  data-subset-cm-category="marketing"
  data-subset-cm-service="meta-pixel"
  src="https://connect.facebook.net/en_US/fbevents.js"
></script>

It catches scripts that are enqueued, printed with WordPress’s script functions, or written into the page by hand. In the browser, the deferred bundle swaps each held script for a live copy if the visitor allows its category. For a GPC visitor, marketing scripts stay as text/plain, so the browser never requests them.

Other parts of the plugin follow the same signal:

  • Notice bar. It never shows to a browser that sends GPC.
  • Preferences panel. It says “Your browser is sending a Global Privacy Control signal, so we treat you as opted out, even if you allowed sale/sharing before. To allow it anyway, turn on the switch and save.”, with the switch off.
  • PHP. On a request with the Sec-GPC: 1 header, wp_has_consent() from the WP Consent API applies GPC to the saved choice by the same rules and answers as opted out. Server-side events from supported pixel plugins do the same. A page served from a page cache never reaches PHP, so only the browser side applies there.

Cookies that a tracker set on an earlier visit, before GPC was on, aren’t deleted on the first GPC page view. Subset Opt-Out deletes a service’s cookies when a visitor opts out during a visit. On a GPC page view nothing changes during the visit, and the tracker that would read those cookies doesn’t run.

Subset Opt-Out can’t hold tags that Google Tag Manager adds while the page runs. Gate those with the subset_cm_consent_ready event in the developer reference.

Google tags aren’t blocked. A second inline script, at wp_head priority 2, sends them Consent Mode v2 signals before any Google tag loads at the usual priority 10:

  1. It defines dataLayer and a gtag() function if they don’t exist yet.
  2. It sends gtag('consent', 'default', …) with every type granted, the same for every visitor on an opt-out site.
  3. It reads the visitor’s state from subsetCM.get() and sends gtag('consent', 'update', …) straight away.
  4. It sends another update every time the visitor changes their choice.

The update maps Subset Opt-Out’s categories to Google’s consent types:

Google consent typeFollows
ad_storagemarketing
ad_user_datamarketing
ad_personalizationmarketing
analytics_storagestatistics

With Redact ad click identifiers while ad storage is denied ticked (the default), it also sends gtag('set', 'ads_data_redaction', true). Turn the whole integration off with Send Consent Mode signals to Google tags.

Check it in your browser

These steps use Chrome’s DevTools. Firefox has the same panels, with cookies under Storage instead of Application.

  1. Turn GPC on. Brave and DuckDuckGo send it by default, and Firefox has a setting under Settings → Privacy & Security. In Chrome, install an extension that sends it, such as Privacy Badger or OptMeowt. globalprivacycontrol.org (opens in a new tab) lists more.

  2. Open a private window, so no saved choice gets in the way, and load a page on your site.

  3. Open DevTools and go to Console. Run navigator.globalPrivacyControl. It should return true. If it returns undefined or false, GPC isn’t on in this window.

  4. Run subsetCM.get(). You should see source: "gpc" and marketing: false:

    { v: 1, source: "gpc", categories: { functional: true, statistics: true, marketing: false } }

    statistics is false too if your opt-out covers analytics.

  5. Run this to see what Google tags were told:

    dataLayer.filter((entry) => entry[0] === "consent");

    You should see a default entry with everything granted, then an update entry with ad_storage, ad_user_data and ad_personalization set to "denied". If there’s no entry, Consent Mode is switched off in the settings.

  6. Go to Application → Cookies and select your site. subset_cm_consent holds the same state, URL-encoded, including "source":"gpc".

  7. Go to Elements, press Ctrl+F (Cmd+F on a Mac) and search for data-subset-cm-category. Every match should still have type="text/plain". A tracker script without that attribute isn’t held. Add a custom rule for it.

  8. Go to Network, reload, and type a tracker’s domain into the filter, such as facebook or tiktok. There should be no requests.

  9. Click your Your Privacy Choices link. The panel should show the GPC message, with the switch off.

To compare, repeat the steps in a private window with GPC off. source is null, every category is true, the held scripts turn into live ones and the trackers’ requests appear.

On the server side, wp subset cookie-manager check <url> lists the scripts on a page that Subset Opt-Out would hold.

If the result isn’t what you expect

  • source is "user". This browser has a choice the visitor saved while GPC was on, so GPC doesn’t override it. The cookie shows "gpc":true. Delete subset_cm_consent or use a fresh private window.
  • subsetCM is undefined. The head script didn’t print. Check that Subset Opt-Out is active and that an optimiser isn’t moving or delaying its inline scripts.
  • A tracker still sends requests. It’s printed above wp_head(), added by Tag Manager, or not matched by any service or rule. An optimiser may also have changed it before Subset Opt-Out saw it. Clear the optimiser’s cache and check again.