| 开发者 | harborplugins |
|---|---|
| 更新时间 | 2026年7月20日 02:23 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.0 |
| 版权: | GPL-2.0-or-later |
| 版权网址: | 版权信息 |
Sec-GPC: 1 on every HTTP request. This plugin detects that header server-side, requiring no user interaction with a banner. A small JavaScript snippet also reads navigator.globalPrivacyControl and sets a first-party cookie (gpcg_gpc_js) so GPC is honored even when the header is absent (some proxies strip it).
Google Consent Mode v2
The plugin emits gtag('consent','default',{...}) before GTM loads, at wp_head priority 1 — the integration point Google's Consent Mode v2 documentation requires. Google's GA4 behavioral modeling needs this consent signal to be present even for visitors who deny tracking; the plugin supplies it so modeling continues to work for users who have denied or not yet responded.
California CPRA Opt-Out Audit Trail
California's CPRA regulations (effective January 2026) require stores to log opt-out signals with a timestamped record. This plugin stores consent decisions in a dedicated database table ({prefix}gpcg_opt_out_log) rather than wp_options. Opt-outs are recorded where they happen — when a visitor declines (or accepts) the banner, when an automatic GPC signal is detected (deduplicated to once per visitor per day), and at WooCommerce checkout — so the trail covers non-purchasers, not only completed orders. Each row records the hashed IP address (SHA-256 with a dedicated, stored plugin salt kept separate from WordPress auth keys so it survives key rotation — the raw IP is never written to disk), the consent state (granted / denied / gpc), the signal source (banner / gpc_header / gpc_js / default), the WooCommerce order ID, the page URL, and a UTC timestamp. A confirmation notice is displayed on the WooCommerce thank-you page to satisfy the California requirement that users receive visible confirmation of their opt-out.
Minimal Performance Impact
On the fast path — consent granted, no GPC signal — there is no output buffering and no HTML rewriting; the expensive work never runs. To keep per-visitor consent state correct, responses that depend on a consent cookie or GPC signal are automatically excluded from full-page caches (and the consent cookies are registered with WP Rocket and LiteSpeed Cache); first-visit pages remain cacheable. Output buffering for script stripping is a Pro feature and is never activated for consented users.
Free vs Pro
| Feature | Free | Pro |
|---|---|---|
| GPC header detection (Sec-GPC) | ✓ | ✓ |
| GPC JavaScript detection | ✓ | ✓ |
| Block WooCommerce Google Analytics integration | ✓ | ✓ |
| Block Facebook / Meta Pixel | ✓ | ✓ |
| Block TikTok Pixel | — | ✓ |
| Block Bing / Microsoft UET | — | ✓ |
| Google Consent Mode v2 dataLayer defaults | ✓ | ✓ |
| Consent banner (accept / decline) | ✓ | ✓ |
| Opt-out confirmation on WooCommerce thank-you page | ✓ | ✓ |
| Audit log of banner, GPC, and checkout consent events (hashed IP, order ID, state, source) | ✓ | ✓ |
| Output-buffer script stripping (catches inline + third-party injected scripts) | — | ✓ |
| Custom domain blocklist | — | ✓ |
| CSV compliance export | — | ✓ |
| Multi-state consent UI (California vs Virginia vs Colorado) | — | ✓ |
How It Works
Sec-GPC header and the gpcg_gpc_js cookie (set by a tiny JS snippet that reads navigator.globalPrivacyControl).gtag('consent','default',{ad_storage:'denied',...}) fires before GTM at wp_head priority 1..zip file.It can, but it also works alongside one. If you already run another consent-management plugin, consider disabling its visitor-facing banner so your store does not show two banners; its other features (cookie scanning, privacy-policy pages) can remain active alongside this plugin.
GPC is a browser-level opt-out signal (like Do Not Track, but legally binding in 12 US states). When a user enables it in their browser or privacy extension, their browser sends Sec-GPC: 1 on every HTTP request. This plugin detects that header server-side and blocks tracking without requiring the user to interact with a banner.
No. The plugin only dequeues scripts that are enqueued through WordPress's script system. It does not modify orders, prices, or checkout logic. If you use a tracking script that is injected outside of wp_enqueue_scripts (for example, hardcoded into a theme), the free tier will not block it — that case is handled by the Pro output-buffer feature.
Yes, for Consent Mode v2 purposes. The plugin emits gtag('consent','default',...) before GTM loads so GTM respects the consent state and suppresses or permits its tags accordingly. Note: the free tier does not prevent the GTM container script itself from loading — it only controls what GTM does once loaded. If you need to block the GTM script entirely when consent is denied, enable the Pro output-buffer mode.
The consent log is stored in the {prefix}gpcg_opt_out_log database table. A monthly summary is shown at the bottom of the WooCommerce > GPC Compliance settings page. Pro users can download a full date-ranged CSV from that same page.
IPs are hashed with SHA-256 and a site-specific salt before storage. The raw IP is never stored. Hashed IPs cannot be reversed to identify individuals, which means the log does not constitute personal data under most interpretations of GDPR. You should still mention the log in your privacy policy and confirm with your legal counsel whether your specific jurisdiction requires additional disclosures.
The server detects Sec-GPC: 1 on every request independently. No cookie or session is required for GPC to be honored — the header is checked fresh on each page load. The JavaScript fallback cookie (gpcg_gpc_js) is also checked on each request but is only a fallback for environments where the HTTP header is stripped.
Yes for script blocking. The plugin dequeues scripts by WordPress handle name, which works regardless of which page builder renders the page. The Consent Mode v2 defaults are emitted via wp_head at priority 1, which fires before any page builder output. If your page builder injects tracking scripts by hardcoding them into a template (outside of wp_enqueue_scripts), those scripts will not be blocked by the free tier — use the Pro output-buffer mode in that case.
Deleting the plugin via Plugins > Delete removes all plugin options and all plugin transients from wp_options on every site of the network. The consent audit log table ({prefix}gpcg_opt_out_log) is also dropped. This is irreversible — export a CSV before uninstalling if you need to retain the log for compliance purposes.
The plugin only blocks tracking for visitors who have actively opted out (declined the banner or enabled GPC) or who have not yet interacted with the banner. Visitors who accept cookies are unaffected. For opted-out visitors, GA4's consent mode modeling can still estimate conversions from anonymized signals — which requires the gtag('consent','default',...) call this plugin provides.
Version 1.1 introduces automatic jurisdiction detection using CDN headers (Cloudflare, CloudFront, Vercel). When Jurisdiction-aware mode is enabled in the advanced settings, visitors from opt-out US states (Virginia, Texas, Utah, and others) are allowed tracking by default unless they actively decline — matching the legal standard for those states. Visitors from strict opt-in states (California, Colorado, Connecticut, Oregon) and the EU/EEA always require an explicit consent grant. Conservative mode (the default) requires opt-in everywhere regardless of jurisdiction.
Yes. Because script blocking is a per-visitor decision, the plugin automatically marks any response that depends on a consent cookie or GPC signal as non-cacheable (via the DONOTCACHEPAGE constant and no-cache headers), registers the gpcg_consent / gpcg_gpc_js cookies with WP Rocket and LiteSpeed Cache, and bypasses Cache Enabler for those requests. In the default Conservative mode this is fully safe: the only cacheable page (a first visit with no cookie and no GPC) renders with tracking already stripped, so a cached copy can never leak tracking to anyone.
Two configuration notes for maximum safety:
gpcg_consent and gpcg_gpc_js to that list so a visitor who already made a choice is always served a fresh page. WP Rocket and LiteSpeed are handled automatically.DONOTCACHEPAGE; configure them to vary on the gpcg_consent / gpcg_gpc_js cookies and the Sec-GPC request header.No. The free tier works entirely without a Freemius account. Freemius is only used for the Pro license key activation and upgrade flow.
The plugin itself sends nothing off-site: consent decisions and the audit log stay in your WordPress database. The bundled Freemius SDK powers optional Pro licensing and is strictly opt-in: on first activation it shows a consent screen, and no data is transmitted unless you explicitly opt in. If you choose Skip, the plugin remains fully functional and nothing is ever sent. Details: freemius.com/privacy (Freemius privacy policy).
gpcg_consent and gpcg_gpc_js, the audit table is {prefix}gpcg_opt_out_log, and cache-exclusion lists should be updated accordingly:focus rules updated to :focus-visible (keyboard-only focus indicators)aria-hidden added to thank-you notice checkmark icon