kingfisherdirect/magento2-cookieconsent

Installs: 717

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Language:JavaScript

Type:magento2-module

v0.2.0 2025-02-06 13:39 UTC

This package is auto-updated.

Last update: 2025-04-06 14:11:08 UTC


README

This Magento 2 module integrates the popular CookieConsent script into your Magento store, allowing you to comply with cookie consent regulations and enhance user privacy.

Important

Installation and using this module requires programming knowledge. This is nowhere near a module you'd expect for Magento 2. All configuration happens programmatically and there is no admin configuration at all!

Installation

composer require kingfisherdirect/magento2-cookieconsent
bin/magento setup:upgrade

Configuration

Note

This module requires Configuration / General / Web / Defalt Cookie Settings / Cookie Restriction mode to be disabled

Once module is installed you'll have to configure it with the services your website uses.

In order to do so, copy the config file into the theme dedicated to your website only.

cp vendor/kingfisherdirect/magento2-cookie-consent/view/frontend/web/js/cookieconsent.config.js app/design/YourCompany/YourTheme/KingfisherDirect_CookieConsent/web/js/

Then follow Configuration Reference to adjust configuration to make banner match your needs.

Making script respecting the choice made in banner is something that needs to be done manually and carefully. This is on per-script/service basis.

Google gtag

This module includes small change for Google gtag, since it's included by default in Magento and is commonly used. By default the consent is sent to denied as per consent mode documentation

gtag('consent', 'default', {
    'ad_storage': 'denied',
    'ad_user_data': 'denied',
    'ad_personalization': 'denied',
    'analytics_storage': 'denied',
    'wait_for_update': 500,
});