PHPackages                             generoi/genero-cmp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. generoi/genero-cmp

ActiveWordpress-plugin

generoi/genero-cmp
==================

CMP Plugin

v2.2.2(6mo ago)516.0k↓17.5%MITPHPPHP &gt;=7.0.0CI passing

Since Mar 8Pushed 6mo ago2 watchersCompare

[ Source](https://github.com/generoi/genero-cmp)[ Packagist](https://packagist.org/packages/generoi/genero-cmp)[ Docs](https://github.com/generoi/genero-cmp)[ RSS](/packages/generoi-genero-cmp/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (20)Used By (0)

genero-cmp
==========

[](#genero-cmp)

CMP Plugin

Features
--------

[](#features)

- YouTube block use `youtube-noockie.com` domain instead
- YouTube and Google Maps iframes require marketing and statistics consent before shown.
- [Event Tracking for Gravity Forms](https://wordpress.org/plugins/gravity-forms-google-analytics-event-tracking/) container code is removed.
- [Gravity Forms Analytics](https://www.gravityforms.com/add-ons/google-analytics/) analytics tag is removed.
- [CTX Feed](https://wordpress.org/plugins/webappick-product-feed-for-woocommerce/) pixel is removed.
- [WP Consent API](https://wordpress.org/plugins/wp-consent-api/) integration (required for GDPR compliant WooCommerce).
- [TikTok for Business](https://wordpress.org/plugins/tiktok-for-business/) pixel is removed until marketing consent has been given
- [Facebook for WooCommerce](https://wordpress.org/plugins/facebook-for-woocommerce/) pixel gets `fbq('consent', 'revoke');` when initialized

Block consent settings (beta)
-----------------------------

[](#block-consent-settings-beta)

Blocks in the block editor are extended with an option to either hide/show based on one or multiple consents.

Note this is likely broken in some cases at the moment.

PHP API
-------

[](#php-api)

### Define necessary cookies

[](#define-necessary-cookies)

When withdrawing consent, all non-necessary cookies are removed. You can edit this set of cookies.

```
add_filter('gds_cmp_necessary_cookies', function (array $cookies) {
    $cookies[] = CartServiceProvider::CART_COUNT_COOKIE;
    $cookies[] = CartServiceProvider::LOGGED_IN_COOKIE;
    return $cookies;
});
```

### Alter consent categories

[](#alter-consent-categories)

You can add or remove custom consent categories.

```
add_filter('gds_cmp_consents', function (array $consents) {
    $consents[] = new \GeneroWP\GeneroCmp\Models\Consent(
        id: 'custom-consent',
        label: __('Custom Consent'),
        description: __('Custom consent'),
        wpConsentApiCategory: 'marketing',
        gtmConsentModes: ['ad_storage', 'ad_user_data', 'ad_personalization'],
    );
    return $consents;
});
```

### Block additional iframe embeds

[](#block-additional-iframe-embeds)

By default iframes in `the_content` referencing *youtube.com* get blocked using ``. You can extend this to other iframe matches or all of them.

```
add_filter('gds_cmp_embed_consents', function (array $consents, string $tag) {
  // Block all iframes by default
  if (! $consents) {
    $consents[] = 'preferences';
  }
  return $consents;
}, 10, 2);
```

JavaScript API
--------------

[](#javascript-api)

```
/**
 * @param {HTMLElement} modal Reference to the  element
 * @returns {void}
 */
window.gdsCmp.modal

/**
 * Show the consent dialog
 *
 * @returns {void}
 */
window.gdsCmp.show()

/**
 * Hide the consent dialog
 *
 * @returns {void}
 */
window.gdsCmp.hide()

/**
 * Withdraw current consent.
 *
 * @returns {void}
 */
window.gdsCmp.withdraw()

/**
 * Return if user has granted the passed consents.
 *
 * @param {...Consent} consents Consent name eg. 'necessary`, `preferences`, `marketing`, `statistics`.
 * @returns {boolean} if user has granted all the consents
 */
window.gdsCmp.hasConsent(...consents)

/**
 * Evaluate and initialize all script tags using data-cmp-consent="" string
 *
 * @param {Node} context
 * @returns void
 */
window.gdsCmp.evaluateTags(context = document)
```

### Events

[](#events)

```
window.addEventListener('gds-cmp.consent', () => {
  if (window.gdsCmp.hasConsent('marketing')) {
    // ....
  }
});

window.addEventListener('gds-cmp.consent.marketing', () => {
  // ...
});
```

Utilities
---------

[](#utilities)

### Hide content using CSS

[](#hide-content-using-css)

```

  Show when consent is given for necessary and marketing cookies.

  Hide when consent is given for necessary and marketing cookies.

```

### Control cookie consent dialog

[](#control-cookie-consent-dialog)

Add `.js-gds-cmp-show` class to any element (needs to be in DOM before DOMDocumentReady).

```
Change consent
```

Add `[data-gds-cmp-trigger="show|hide|withdraw"]` selector to any element (delegates as a document click listener)

```
Change consent
```

- Run manually with `window.gdsCmp.show()`
- Run `show()` on the `` element

### Block elements from being loaded using `[data-gds-cmp-consent]` attribute

[](#block-elements-from-being-loaded-using-data-gds-cmp-consent-attribute)

You can add `data-gds-cmp-consent="marketing preferences"` to an element and once consent has been given, the element will evaluate.

Supported elements are ``, ``, `` and ``.

This is useful if content is entirely opt-in and doesnt require prompting the user for consent.

```

```

### Block elements with a message using ``

[](#block-elements-with-a-message-using-gds-cmp-embed)

```

  Content which gets rendered once consent has been given.

```

You can also use `as=""` attribute to replace eg an ``.

```

```

If you need to run JS once the embed replace has taken place, you can listen for the `gds-cmp-embed.replaced` event.

```
function init(el) {
  if (el.tagName === 'GDS-CMP-EMBED') {
    el.addEventListener('gds-cmp-embed.replaced', (e) => init(e.detail.element));
    return;
  }
  // ... do stuff
}

init(document.querySelector('[data-custom-function]'));
```

### GTM events

[](#gtm-events)

Whenever users change consent the `gds-cmp.update` event will be sent to gtag. By creating a trigger for this event and adding it together with the *Consent initialization* trigger, tags will run on the first page load after consent is updated.

Development
-----------

[](#development)

Install dependencies

```
composer install
npm install

```

Run the tests

```
npm run test

```

Build assets

```
# Minified assets which are to be committed to git
npm run build:production

# Watch for changes and re-compile while developing the plugin
npm run start

```

Translations
------------

[](#translations)

```
wp i18n make-pot . languages/genero-cmp.pot
wp i18n make-mo languages/

```

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance66

Regular maintenance activity

Popularity31

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 93.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~60 days

Recently: every ~97 days

Total

17

Last Release

199d ago

Major Versions

1.1.8 → v2.0.02024-07-15

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/302736?v=4)[oxyc](/maintainers/oxyc)[@oxyc](https://github.com/oxyc)

---

Top Contributors

[![oxyc](https://avatars.githubusercontent.com/u/302736?v=4)](https://github.com/oxyc "oxyc (125 commits)")[![bokorir](https://avatars.githubusercontent.com/u/8135560?v=4)](https://github.com/bokorir "bokorir (5 commits)")[![shayanabbas](https://avatars.githubusercontent.com/u/5176243?v=4)](https://github.com/shayanabbas "shayanabbas (3 commits)")[![JonatanStorlund](https://avatars.githubusercontent.com/u/40643485?v=4)](https://github.com/JonatanStorlund "JonatanStorlund (1 commits)")

---

Tags

wordpress

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/generoi-genero-cmp/health.svg)

```
[![Health](https://phpackages.com/badges/generoi-genero-cmp/health.svg)](https://phpackages.com/packages/generoi-genero-cmp)
```

###  Alternatives

[roots/wordpress

WordPress is open source software you can use to create a beautiful website, blog, or app.

19116.9M258](/packages/roots-wordpress)[aristath/kirki

Extending the WordPress customizer

1.3k73.0k4](/packages/aristath-kirki)[wpreadme2markdown/wpreadme2markdown

Convert WordPress Plugin readme.txt to Markdown

9564.6k4](/packages/wpreadme2markdown-wpreadme2markdown)[wpstarter/framework

The WpStarter Framework - Laravel Framework for WordPress

1810.1k4](/packages/wpstarter-framework)[tacowordpress/tacowordpress

WordPress custom post types that feel like CRUD models

232.2k](/packages/tacowordpress-tacowordpress)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
