DigiWedge CMP for WordPress
The DigiWedge CMP plugin delivers Consent Mode v2, strict script blocking, GTM helpers, and diagnostics for WordPress sites. Install it on single sites or across a multisite network to centralise consent management while respecting regional policies.
Before You Start
- WordPress admin (or Network Admin) privileges to install/activate plugins.
- A staging environment is strongly recommended for first-time setup and theme verification.
- Remove any manually embedded DigiWedge CMP snippet or GTM helper from your theme before enabling the plugin—the plugin injects the bundle automatically.
Supported Versions
| Component | Version |
|---|---|
| WordPress | 6.5+ |
| PHP | 8.1+ |
| Node (build tooling) | 22 |
Installation
- Install ZIP
- Composer/Nx
- Download the release archive (
wp-cmp-<version>.zip) from your CI artifact or GitHub release. - WP Admin → Plugins → Add New → Upload Plugin.
- Select the ZIP → Install Now → Activate (choose Network Activate if you are on multisite).
# Inside the monorepo
pnpm install
composer install --working-dir=apps/cmp/wp-cmp
pnpm nx run wp-cmp:build
pnpm nx run wp-cmp:test:e2e --configuration=ci
Packages live under apps/cmp/wp-cmp/. Run pnpm nx run wp-cmp:release for a full build → test → zip flow.
Configuration
Once activated, navigate to Settings → DigiWedge CMP. Configure the following:
| Field | Description |
|---|---|
| Registry Base URL | Your DigiWedge registry endpoint (e.g. https://registry.example.com). |
| Site Key | The tenant site identifier. |
| Preview Token | Optional token for preview/staging configurations. |
| Region Mode | Auto uses the Region API; Force applies a fixed region code (e.g. EU, US-CA). |
| Forced Region Code | Required when Region Mode = Force. |
| E2E Region Override | Allows Playwright or QA to set x-e2e-region via localStorage. |
| GTM Helper | Adds a lightweight window.dataLayer + gtag stub if GA4 Consent Mode is absent. |
| Strict Script Blocking | Defers matching third-party scripts until the visitor grants consent. |
| Blocking Patterns | One substring per line (e.g. google-analytics.com). Matches against <script src="...">. |
Multisite Networks
Network Admins can define defaults under Network Admin → Settings → CMP (Network). Site-level pages inherit these defaults and may override them locally. The form highlights inherited values so editors know what the network mandates.
Strict Blocking & GTM Assist
- Strict Blocking converts matching
<script>tags totype="text/plain"until consent is granted. When the visitor accepts (any consent state withgranted), the original scripts are restored and executed. - GTM Helper ensures
window.dataLayerandgtagexist for legacy GA4/GTM setups. Enable it when the site hasn’t yet embedded Consent Mode v2.- Inline scripts without a
srcattribute are unaffected; keep using the DigiWedge Consent APIs inside your theme or blocks if you need custom handling.
- Inline scripts without a
Diagnostics
Visit Settings → CMP Diagnostics for a live snapshot:
- Last region + source (auto API vs forced setting).
- Config fetch status (
200or304) and ETag age. - Count of scripts currently blocked by strict mode.
The plugin stores the latest snapshot in localStorage (dw.cmp.diagnostics) for easy inspection during QA.
CI / Release Pipeline
The repo includes two workflows:
| Workflow | Purpose |
|---|---|
wp-cmp-ci.yml | Build, PHP unit checks, Playwright tests, zip artifact (matrix: PHP 8.1 / 8.2, Node 22). |
wp-cmp-release.yml | Triggered on wp-cmp-v* tags. Runs full suite, installs composer --no-dev, zips wp-cmp-<tag>.zip, and attaches it to the GitHub release. |
Troubleshooting
- Config not loading? Check diagnostics for HTTP status/ETag. Verify the registry URL/site key.
- Scripts still firing before consent? Add their CDN host to Blocking Patterns (one per line). Confirm the diagnostics page reports the expected blocking count.
- Multisite confusion? Network defaults populate site forms. Sites can override values; the description shows when a network default is in effect.
- E2E testing: Toggle the “E2E Region Override” setting, then set
localStorage.setItem('dw.cmp.e2eRegion', 'EU')during tests to force deterministic regions.
Updates & Support
- New plugin builds publish tagged archives via the
wp-cmp-release.ymlworkflow. Download the latestwp-cmp-*.zipand repeat the Upload flow, or runpnpm nx run wp-cmp:releaselocally and replace the plugin directory. - Review the changelog in
apps/cmp/wp-cmp/CHANGELOG.mdfor upgrade notes and any migration steps. - Questions or issues? Open a ticket in the DigiWedge CMP repository or contact the platform team through the usual support channel.