WordPress Setup
Install the CleanClicks WordPress plugin for automatic tracking, WooCommerce event capture, server-side conversion webhooks, and analytics proxy integration.
CleanClicks ships a dedicated WordPress plugin. The current Signal and Clarity plans support the guided WordPress and WooCommerce path. Available features still depend on the selected plan, current plugin version, domain configuration, consent state, and connected destinations.
Option A: Plugin Installation (Recommended)
The CleanClicks WordPress plugin is the full integration. It auto-creates the WooCommerce conversion webhook on activation, auto-derives your site domain, applies smart defaults when your CleanClicks account is fully configured, and shows live setup status in the admin UI.
Download and Install
- In your CleanClicks dashboard, go to Configuration → Ecommerce tab
- Under WordPress Plugin, click Download WordPress Plugin (.zip) to get the current plugin zip
- In WordPress Admin, go to Plugins → Add New → Upload Plugin
- Choose the zip and click Install Now
- Click Activate Plugin
Configure the Plugin
After activation:
- In your WordPress Admin sidebar, click CleanClicks
- Enter your Inbound API Key. To get one, go to CleanClicks → Configuration → Inbound keys tab, click Create Inbound Integration Key, enter a Key Name, and click Create Key. Copy the key before you close the dialog. CleanClicks shows it only once.
- Click Save Changes
That's it. The plugin auto-detects your site domain from home_url() (stripping a leading www. for WP Engine and similar www-subdomain installs), fetches your CleanClicks configuration on activation, and begins tracking immediately.
What Happens Automatically on Activation
The plugin does several things on first activation so you don't have to:
- Domain auto-detection — your CleanClicks proxy origin (
https://cleanclicks.yourdomain.com) is derived fromhome_url(). No "Client Domain" field to fill in. - Remote config fetch — the plugin calls your CleanClicks
/__cc/wp-configendpoint and caches the response for 1 hour, so the first page request doesn't pay the round trip. - GA4 First-Party Proxy on by default — the plugin serves GA4 through your own domain from the start, and skips itself if that measurement ID is already firing on your site.
- WooCommerce webhook auto-create — if WooCommerce is active, the plugin creates the
order.createdwebhook for you, pointed at your CleanClicks proxy with the correct signing secret. No manual webhook setup required. - Onboarding banner — if you haven't entered your Inbound API Key yet, the plugin shows a banner on the settings page walking you through the one-step setup.
CleanClicks's server decides whether smart defaults apply, and the plugin applies them only on a fresh install. On a plugin update or reactivation, they do not overwrite settings you set by hand.
Webhook Status Card
When WooCommerce is active, the plugin settings page includes a live WooCommerce Webhook Status card showing the current state of the auto-created WooCommerce webhook:
| What the card shows | What It Means |
|---|---|
| Status: Active | The webhook exists in WooCommerce and is active. Nothing to do. |
| Status: Paused or Disabled | The webhook exists but WooCommerce is not delivering it. Click Recreate Webhook. |
| Webhook not active, "API key not configured" | Save your Inbound API Key in the settings below. Saving it creates the webhook. |
| Webhook not active, "WooCommerce is not active" | Activate WooCommerce. |
| Webhook not active, "Webhook creation pending" | The plugin creates the webhook on the next page load. |
| Webhook not active, "Webhook was deleted outside this plugin" | Someone deleted it in WooCommerce → Settings → Advanced → Webhooks. Click Create Webhook Now to restore it. |
| Webhook not active, "Webhook has not been created yet" | Click Create Webhook Now. |
| Last error: followed by a message | The plugin's last attempt to create the webhook failed with that message. |
If the webhook is missing (e.g., you deleted it manually), click Create Webhook Now on the status card to restore it. The button is turned off while the card asks for your API key: save the key first. If the webhook exists but is paused or misconfigured, click Recreate Webhook.
What the Plugin Tracks
| Feature | Trigger | Plan Gate |
|---|---|---|
| Pageview tracking | Every page load | Signal or Clarity |
| Click ID capture | URL parameters (gclid, fbclid, ttclid, tbclid, li_fat_id, msclkid, wbraid, gbraid) | Signal or Clarity |
| Email identity hashing (SHA-256) | Form submissions + WooCommerce checkout | Signal or Clarity |
| Conversion event posting | purchase, view_item, add_to_cart, begin_checkout, custom triggers | Signal or Clarity |
view_item | Single product pages | Signal or Clarity with WooCommerce |
view_item_list | Shop, category, tag archive pages | Signal or Clarity with WooCommerce |
add_to_cart | AJAX and form-based add-to-cart | Signal or Clarity with WooCommerce |
remove_from_cart | Cart item removal | Signal or Clarity with WooCommerce |
begin_checkout | Checkout page load + checkout-intent click from cart | Signal or Clarity with WooCommerce |
purchase | Order completed (client-side + server-side webhook) | Signal or Clarity with WooCommerce |
| GA4 First-Party Proxy | Routes GA4 client-side traffic through cleanclicks.yourdomain.com | Signal or Clarity |
| Usermaven Proxy | First-party Usermaven tracking | Signal or Clarity |
| Plerdy Proxy | First-party Plerdy tracking | Signal or Clarity |
| WP Consent API integration | Honors consent state from compatible CMPs | Signal or Clarity |
Every event includes enhanced product data: SKU, brand (YITH or product taxonomy), up to 5 category levels, and variant info for variable products.
Server-Side Conversion Capture
The plugin uses three coordinated WooCommerce order paths: two server-side, plus a client-side fallback for custom thank-you pages. The two server-side paths post to the same CleanClicks webhook endpoint, /__cc/woocommerce/webhook, where CleanClicks de-duplicates by order ID so one order produces one conversion.
Layer 1: Auto-Webhook (order.created)
On activation, the plugin creates a WooCommerce webhook with these properties:
- Topic: Order created
- Delivery URL:
https://cleanclicks.yourdomain.com/__cc/woocommerce/webhook - Secret: your Inbound API Key (the same key signs the webhook and authorizes inbound API calls — one key, two jobs)
This is the primary capture path for the standard WooCommerce checkout flow. You can verify the webhook exists in WordPress Admin → WooCommerce → Settings → Advanced → Webhooks — look for "CleanClicks Conversion Capture" with topic "Order created."
Layer 2: woocommerce_payment_complete Hook
The plugin hooks the WooCommerce payment_complete action with a fire-and-forget POST to the same webhook endpoint. This backstops three scenarios where the order.created webhook isn't enough:
- Subscription renewals —
woocommerce_payment_completefires when a renewal payment is captured by the cron, even with no customer browser session present. - Offsite checkout returns — when a customer is bounced to an external payment processor (PayPal, Klarna, etc.) and returns, the standard webhook may fire before payment is confirmed. The
payment_completehook fires on actual payment. - Custom thank-you flows — sites with non-standard order-completion pages (membership signups, custom landing pages) where the client-side
purchaseevent might not fire.
CleanClicks de-duplicates by order ID across Layer 1 and Layer 2, using a 48-hour order dedupe window (configurable up to 7 days). Whichever path arrives first creates the conversion. A later arrival for the same order inside that window is logged as a duplicate and never uploaded to your platforms.
Layer 3: Configurable purchase_paths Allowlist
On every front-end page load, the plugin checks the current URL against an allowlist of paths that indicate a purchase-completion page. When matched, it fires a purchase event for the relevant order. Defaults:
/order-received/
/thank-you/
/order-confirmation/
/my-account/view-subscription/
This catches custom thank-you pages that don't trigger the standard woocommerce_thankyou hook.
Configuring Custom Thank-You Paths
If your site uses a custom thank-you URL pattern (e.g., a checkout flow that redirects to /platinum-thank-you/{order_id}/), add it on the plugin settings page under Custom Thank-You Paths. One path per line, substring match.
Example: a custom membership flow. Say a membership checkout on example.com redirects to URLs like https://example.com/membership-thanks/12345. To capture those, set:
- Custom Thank-You Paths: add
/membership-thanks/on its own line - Custom Path Regex:
^/membership-thanks/[0-9]+
The regex is optional. Substring matching covers most cases; regex is for surgical patterns where substring would over-match.
Programmatic Extension
If you need to extend purchase_paths from a child theme or companion plugin instead of through the admin UI, three filter hooks are available:
cleanclicks_purchase_paths— modify the path allowlist arraycleanclicks_purchase_path_regex— set or override the regex patterncleanclicks_resolve_order_id— supply a custom order-ID resolver for the matched page
Cookies, Storage, and Consent
This section lists what the plugin stores and how it reads consent. It does not decide your legal basis or your consent categories; those stay your decision.
Cookie and Storage Classification
The plugin registers the cookies and browser storage below with the WP Consent API under the cleanclicks service. Each item is registered under its own category, marketing, statistics, or functional, shown in the Category column. CMPs that integrate with the WP Consent API (CookieYes, Cookiebot, Complianz, iubenda, and others) read that classification.
The list covers what the plugin's own script (cc-wp.js) stores, what cc.js (the CleanClicks tracking script the plugin loads beside its own) stores, the cookie the plugin sets when CleanClicks reports an opt-out, and the cookies the CleanClicks service sets.
These are cookies:
| Name | Category | Lifetime | What It Holds |
|---|---|---|---|
cc_pid | marketing | 1 year | A random visitor identifier that links this browser's visits, advertising clicks, and purchases |
cc_sid | statistics | 30 minutes | A random session identifier that keeps one visit's page views together when Google Analytics is sent through your site's own domain. Set only where that feature is on. |
cc_ss_optout | functional | 1 year | The privacy opt-out flag. When it is set, the site limits what it sends to advertising and analytics services, as the site's privacy choices page describes. |
cc_ss_optout_m | functional | 1 year | A copy of the privacy opt-out flag in cc_ss_optout, set by CleanClicks on your tracking subdomain (cleanclicks.yourdomain.com). It lets requests from the CleanClicks Shopify pixel carry the opt-out where the browser allows third-party cookies. It holds only an opt-out. |
cc_ss_optout_relay | functional | 6 hours | The privacy opt-out flag, copied to your site from an opt-out made on the CleanClicks privacy page. It has the same effect as cc_ss_optout. |
cc_optin_chal | functional | 10 minutes | A security token for the step on the CleanClicks privacy page that allows sale or sharing again. Set only when a visitor starts that step. |
The rest are browser storage, not cookies. The WP Consent API has no type for sessionStorage, so the plugin registers its sessionStorage items with the type LOCALSTORAGE. The Where column shows the store each item uses.
Stored by the plugin's script (cc-wp.js):
| Name | Where | Category | Lifetime | What It Holds |
|---|---|---|---|---|
cc_click_ids | localStorage | marketing | 90 days for each identifier, by the device's clock | Advertising click identifiers captured from URL parameters (for example gclid, fbclid). Each one is removed on the next page view after its 90 days. A short code and the first-seen date stay for the latest identifier of each kind, to help keep it from being used again. |
cc_attribution | localStorage | marketing | Until a later visit replaces it | UTM campaign parameters, the referring page, and the landing page address, which can include an advertising click identifier |
cc_wp_hashed_email | localStorage | marketing | 90 days | A one-way hash (SHA-256) of the email address, and a short code that stands for the advertising click identifiers last sent with it. Kept so that a purchase can be matched to the visit that led to it. |
cc_wp_identity_inflight | sessionStorage | marketing | Session | A one-way hash (SHA-256) of the email address. Marks a hashed-email submission that is in progress, so that it is not sent twice. |
cc_wp_identity_retry | sessionStorage | marketing | Session | A one-way hash (SHA-256) of the email address. Counts the retries of a hashed-email submission that did not get through. |
cc_session_id | sessionStorage | statistics | Session | A session identifier that groups page views within one visit |
cc_session_num | localStorage | statistics | No expiry | A count of this browser's visits to the site |
cc_wp_deduped | localStorage | statistics | Each entry: 30 seconds while its event is being sent, then the site's deduplication window (24 hours by default) | The events already sent, so that none is counted twice: the event name with the order number, or with the page path and item identifiers. An entry past its time is removed the next time the plugin checks an event against this list. |
Stored by cc.js:
| Name | Where | Category | Lifetime | What It Holds |
|---|---|---|---|---|
_ci | localStorage | marketing | 90 days | Advertising click identifiers captured from URL parameters (for example gclid, fbclid) |
_cit | localStorage | marketing | No expiry | Each advertising click identifier and the time it was first seen, so that one older than 90 days is no longer used |
_fo | localStorage | marketing | 90 days | The Meta click identifier (fbclid) and the time it was first seen |
_at | localStorage | marketing | Until a later visit replaces it | UTM campaign parameters, the referring page, and the landing page |
_he | localStorage, with a copy in sessionStorage | marketing | 90 days | A one-way hash (SHA-256) of the email address, kept so that a conversion can be matched to the visit that led to it |
_si | sessionStorage | statistics | Session | A session identifier that groups page views within one visit |
_sn | localStorage | statistics | No expiry | A count of this browser's visits to the site |
Service-Level Consent
The plugin registers itself with the WP Consent API as the cleanclicks service. On WP Consent API v2.0 and later it checks service-level consent (wp_has_service_consent("cleanclicks")) ahead of the category check, so a visitor can grant or deny CleanClicks on its own in a Complianz, CookieYes, or iubenda service toggle without touching your other analytics tools. On v1.x it falls back to the category check (statistics by default). By default, CleanClicks treats consent as required for your site once the plugin reports that the WP Consent API is loaded on your site. If CleanClicks treats consent as required and no consent API is loaded, the plugin blocks analytics dispatch rather than treating the visitor as consenting. The plugin's Require Consent setting adds a consent check only where the WP Consent API is loaded. With no consent API, that setting on its own does not block tracking, except while the plugin cannot load your CleanClicks settings.
OneTrust Bridge
OneTrust does not integrate with the WP Consent API on its own, so the plugin bridges the two for you. It reads OnetrustActiveGroups and maps OneTrust's category IDs onto wp_set_consent() calls, syncing on page load, on a OneTrustGroupsUpdated dataLayer push, and through OneTrust.OnConsentChanged(). OneTrust customers do not need to paste a custom snippet.
For per-CMP configuration guidance, see CMP Configuration.
Option B: Manual Tag Installation
If you don't want to install the plugin — for example, if you don't have WooCommerce and only need basic page-view + click-ID tracking — you can install the CleanClicks tag manually.
Using a Theme Header
- In WordPress Admin, go to Appearance → Theme File Editor
- Open
header.php(or your theme's equivalent head template) - Add the script tag before
</head>:
<script src="https://cleanclicks.yourdomain.com/__cc/cc.js" defer></script>
- Click Update File
Using a Header Scripts Plugin
If you don't want to edit theme files:
- Install a plugin like WPCode (formerly "Insert Headers and Footers") or similar
- Add the CleanClicks script tag to the header section
- Save
Manual installation captures click IDs, attribution, and conversions on the standard /__cc/conv endpoint, but you lose the WooCommerce event capture, server-side webhook auto-create, analytics proxy injection, and admin status UI that ship with the plugin.
Plugin Updates
Update the plugin in place, over the version you have now:
- In WordPress Admin, go to Plugins → Add New → Upload Plugin
- Choose the new plugin zip and click Install Now
- When WordPress shows that the plugin is already installed, click Replace current with uploaded
- On the Plugins screen, check that CleanClicks shows the new version number. Then open the CleanClicks settings page and check that your settings still hold their values.
Warning: Never deactivate or delete the plugin to update it. Deleting the plugin erases all of its settings, including your API key, and its stored Usermaven credentials. Deactivating it removes the Usermaven credentials too. While WooCommerce is active, either one also removes the plugin's WooCommerce webhook. If WordPress does not offer Replace current with uploaded, stop and contact support before you delete anything.
An in-place update keeps your existing settings. Smart defaults only apply on fresh installs (where no cleanclicks_settings option exists), so an update does not reapply defaults over a configuration you set by hand.
After updating, clear all cache layers in this order:
- Your caching plugin (WP Rocket, W3 Total Cache, etc.)
- Your hosting CDN cache (WP Engine, Kinsta, Cloudflare, etc.)
- Your browser cache (hard refresh or Incognito test)
Verify by viewing page source and checking that the ?ver= parameter on the CleanClicks script tag matches the new version number.
Troubleshooting
| Issue | Solution |
|---|---|
| Plugin won't activate | Verify PHP 7.4+. Check your error log for class-name collisions with other plugins (CleanClicks uses the CLEANCLICKS_ prefix to avoid conflicts but a third-party plugin may use the same identifier). |
| Events not firing | Verify your domain is Active in CleanClicks. Check browser DevTools → Network for cleanclicks.yourdomain.com/__cc/cc.js returning 200. Verify the ?ver= parameter matches the installed plugin version (mismatch means cache is stale — clear all cache layers). |
| The webhook card says the webhook was deleted outside the plugin | Click Create Webhook Now on the card. The plugin re-creates the order.created webhook with the correct signing secret. |
| WooCommerce events missing | Confirm WooCommerce is active. Verify the plugin's WooCommerce integration loaded — the plugin settings page shows "WooCommerce: Active" when detected. |
| Purchase events missing on custom thank-you pages | Add your custom URL pattern to Custom Thank-You Paths on the plugin settings page (see Layer 3 above). |
| Stale JavaScript after update | Check the ?ver= query string in page source. If it matches the old version, the version didn't bump — verify the new plugin version installed. If correct but content is stale, clear caching plugin + CDN + browser cache. |
| Analytics proxies not loading | Verify GA4 or Usermaven is configured in CleanClicks → Configuration → Vendors. Then in WordPress Admin → CleanClicks, open Advanced settings and confirm the matching box is ticked under Analytics Proxies (GA4 First-Party Proxy, Usermaven Proxy, or Plerdy Proxy). Note: analytics proxies require Signal or Clarity plan. |
Site is on www.example.com and proxy origin looks wrong | The plugin strips the leading www. when it derives the origin, so www.example.com becomes cleanclicks.example.com. If the origin still looks wrong, download the current plugin from your dashboard and update it in place (see Plugin Updates above). |
| GA4 events show as "Unassigned" | Confirm you are looking at the GA4 property the plugin is configured against, and that GA4 First-Party Proxy is ticked so client-side events keep their traffic source. Installing the plugin is not on its own a reason to change the GA4 server-side setting. If GA4 shows duplicate purchases, contact support. See GA4 Connections. |