elgentos / magento2-consentmode-v2

elgentos/magento2-consentmode-v2

Consent Mode V2 magento extension for the Hyva theme

  • Wouter Steenmeijer
magento2-module Compatibility: Not compatible Code Quality: Fail Tests: N/A Security: Pass OSL-3.0, AFL-3.0

magento2-consentmode-v2

This extension is based on the Hyva default cookie bar. All features that are in that extension are in this one.

This extension:

  • removes the default Hyva cookie bar
  • sets default consentMode

gtag('consent', 'default', { 'ad_storage': 'denied', 'ad_user_data': 'denied', 'ad_personalization': 'denied', 'functionality_storage': 'denied', 'personalization_storage': 'denied', 'security_storage': 'denied', });

  • This fires the GTM build in trigger like this:

[image: build-in-trigger.png]

  • shows banner when consentMode is not set in localstorage or isUserAllowedSaveCookieName (default magento cookie) is null

[image: banner.png]

  • You can click 3 buttons
    • Deny: routes you to the noCookies url you can set in the backend
    • Customize: set the cookies you selected above
    • Allow All: All cookies are allowed (all checkmarks are set)

Logic behind this:

{
    'functionality_storage': consent.necessary ? 'granted' : 'denied',
    'security_storage': consent.necessary ? 'granted' : 'denied',
    'personalization_storage': consent.preferences ? 'granted' : 'denied',
    'analytics_storage': consent.statistics ? 'granted' : 'denied',
    'ad_storage': consent.marketing ? 'granted' : 'denied',
    'ad_user_data': consent.marketing ? 'granted' : 'denied',
    'ad_personalization': consent.marketing ? 'granted' : 'denied',
};
  • When gtag consent default is set, an event is fired in GTM called: default When the settings are changed, the update event is fired.

As you can see in this example:

[image: consent-example.png]

  • It adds a button on the absolute bottom of the page so you can always open the cookie settings (this is intentionally not fixed on the viewport)

Would be nice to have multiple events on multiple levels of consent you can add in GTM.

No changelog yet

The vendor hasn't published a changelog. Tagged releases appear in the Versions tab.

Versions
Version Stability QA Status Compatibility Released
1.0.6 stable Fail Not compatible Details 2024-07-11 11:17:28
1.0.5 stable Not tested Not yet tested Details 2024-07-10 10:24:03
1.0.4 stable Not tested Not yet tested Details 2024-07-09 09:58:34
1.0.3 stable Not tested Not yet tested Details 2024-06-18 08:30:59
1.0.2 stable Not tested Not yet tested Details 2024-06-17 12:52:01
1.0.1 stable Not tested Not yet tested Details 2024-06-05 09:59:32
1.0.0 stable Not tested Not yet tested Details 2024-06-04 12:11:43

Requires 4

Package Constraint
php >=8.1.0
magento/framework ^103.0
magento/module-cookie ^100.4
magento/module-store ^101.1

Compatibility

Each Magento release line is installed on its supported PHP versions, then the module is built (DI compilation + static-content deploy) and its unit and integration suites are run. The matrix shows the lines and PHP versions the module is confirmed to install and run on. Code-quality results further down (phpstan, phpcs, …) are reported separately and never affect compatibility.

Compatibility matrix (Magento × PHP)
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 not tested Pass
2.4.8 Pass Fail di error
2.4.9 Fail di error Fail di error

Code Quality

Advisory checks against the module's source. Static analysis runs once across the whole module; PHPStan re-runs per Magento + PHP version because resolvable symbols differ between releases. These NEVER affect the Compatibility badge — a phpcs finding can't make a module incompatible.

Static analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

Static analysis results
Tool Status Findings Summary
PHPCS Warning 1 1 warning (ruleset: Magento2)
PHPMD Pass 0
Cpd Pass 0
Composer validate Pass 0

PHPStan

Type-checks the module's PHP against a real Magento install at the configured gate level. Re-runs per Magento and PHP version because resolvable symbols differ between releases. Cell → details modal.

PHPStan results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 Pass Pass
2.4.8 Pass 5
2.4.9 5 5

Tests

Unit and integration suites, run for each applicable Magento and PHP version. A test failure speaks to the module's behaviour, not its compatibility with a Magento line, so it is reported here separately and never reddens the compatibility matrix.

Unit tests

Unit tests results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 N/A N/A
2.4.8 N/A N/A
2.4.9 N/A N/A

Integration tests

Integration tests results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 N/A N/A
2.4.8 N/A N/A
2.4.9 N/A N/A

Security

Security checks run directly against the module: an audit of its declared dependencies for known vulnerabilities (composer audit) and a scan of its source for malware and web-shell signatures. Each runs once. A malware detection fails the version outright.

Security results
Tool Status Findings Summary
Composer audit Pass 0
License
OSL-3.0, AFL-3.0
Authors

More from elgentos

View vendor
Make it pay

Turn an existing module into recurring revenue.

If you already maintain a Magento 2 module on GitHub or GitLab, listing it on Packagento takes about five minutes. We mirror your tags, handle distribution signing, and route paid licenses through Stripe Connect, so you can keep shipping the way you already do.