Download the PHP package pixelperfectat/module-hyva-cookie-consent without Composer
On this page you can find all versions of the php package pixelperfectat/module-hyva-cookie-consent. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pixelperfectat/module-hyva-cookie-consent
More information about pixelperfectat/module-hyva-cookie-consent
Files in pixelperfectat/module-hyva-cookie-consent
Package module-hyva-cookie-consent
Short Description GDPR/ePrivacy-compliant cookie consent management for Hyva theme
License MIT
Informations about the package module-hyva-cookie-consent
Pixelperfect Hyva Cookie Consent
GDPR/ePrivacy-compliant cookie consent management for Magento 2 with Hyva theme.
Features
- Actually blocks cookies until explicit consent is given
- Google Consent Mode v2 support - GTM/GA4 automatically respect consent
- CSP Strict Mode compatible - works with Content Security Policy
- Full Page Cache compatible - consent handled client-side
- Category-based consent - Necessary, Analytics, Marketing, Preferences
- XML configuration - Define categories, services, and cookies via XML
- Built-in service templates - GTM, GA4, Facebook Pixel, Microsoft Clarity, Hotjar, Matomo
- Floating settings button - Users can change preferences anytime
- Multi-language - EN, DE, FR, ES, IT translations included
Requirements
- Magento 2.4.x
- PHP 8.3+
- Hyva Theme
Installation
Configuration
Admin Settings
Navigate to Stores → Configuration → Web → Cookie Consent (Hyva)
| Setting | Description |
|---|---|
| Enable Cookie Consent | Enable/disable the module |
| Consent Cookie Lifetime | Days to remember consent (default: 365) |
| Consent Version | Increment to force re-consent after policy changes |
| Banner Style | Modal (center overlay) or Bar (bottom fixed) |
| Floating Button Position | Left or Right |
| Banner Headline/Description | Customizable text |
| Privacy Policy URL | Link to your privacy policy |
Service Configuration
Navigate to Stores → Configuration → Cookie Consent Services
Each service can be individually enabled with its own configuration:
- Google Tag Manager - Container ID, Loading Strategy (Strict/Infrastructure)
- Google Analytics 4 - Measurement ID
- Facebook Pixel - Pixel ID
- Microsoft Clarity - Project ID
- Hotjar - Site ID
- Matomo - Tracker URL, Site ID
How It Works
Google Consent Mode v2
The module implements Google Consent Mode v2:
No GTM configuration changes required - tags with Consent Mode enabled automatically wait for consent.
Category to Consent Mode Mapping
| Category | Google Consent Mode |
|---|---|
| necessary | security_storage: granted |
| analytics | analytics_storage |
| marketing | ad_storage, ad_user_data, ad_personalization |
| preferences | functionality_storage, personalization_storage |
GTM Loading Strategies
Strict Mode (default):
- GTM is blocked until analytics consent is given
Infrastructure Mode:
- GTM loads immediately
- Consent state is pushed to dataLayer
- GTM tags should use Consent Mode or consent-based triggers
Extending the Module
XML Configuration
Categories, services, and cookies are configured via cookie_consent.xml. Create this file in your module's etc/ directory:
Service Template Example
Create a template that respects consent blocking:
JavaScript Events
Testing
Manual Testing
- Open the site in an incognito window
- Check that no
_gaor tracking cookies are set - Open browser DevTools → Console
- Run:
window.dataLayer- verifyconsent_defaultevent - Accept cookies and verify
consent_updateevent fires - Verify tracking cookies are now set
Automated Testing (Playwright)
Troubleshooting
GA cookies still being set?
- Check if another module/theme is loading GA
- Verify GTM tags have Consent Mode enabled
- Clear all caches and test in incognito
Banner not showing?
- Check if module is enabled in admin
- Clear layout cache:
bin/magento cache:clean layout
Scripts not activating after consent?
- Verify
data-consent-categorymatches a valid category code - Check browser console for JavaScript errors
License
MIT License - see LICENSE file for details.
All versions of module-hyva-cookie-consent with dependencies
magento/framework Version ^103.0
magento/module-cookie Version *
magento/module-csp Version *
hyva-themes/magento2-theme-module Version ^1.0