a-digital / cookie-consent-banner Goto Github PK
View Code? Open in Web Editor NEWAdd a configurable cookie consent banner to the website.
License: MIT License
Add a configurable cookie consent banner to the website.
License: MIT License
How should I handle users that opted out of cookies? Is there a variable that gets set which I can check to see if the user has allowed cookies or not? Or what would be the best way to handle this?
The plugin is fully configured, the .min.js is loading in from a network call, but the banner doesn't appear. I've viewed in incognito and from another browser to test. Are there any logs I can give you to help troubleshooting?
When I enter a line break in the message field, the cookie banner no longer works.
I can't install V1.1.5 through Composer but it wasn't obvious initially why. But I think it's to do with the Github Tags. They go up to v1.1.3 but there is no v1.1.4 or v1.1.5. There is 1.1.4 and 1.1.5 (WITHOUT the leading v).
Hi Guys,
The cookie banner is getting blocked by the AdGuard chrome extension: https://chrome.google.com/webstore/detail/adguard-adblocker/bgnkhhnnamicmpeenaelnjfhikgbkllg?hl=en
this is due to the injected styles that is does for the class names: .cc-banner & .cc-window.
I don't know if they are targeting your plugin directly or if its a coincidence? As css classname change would sort it.
Cheers
Any plans to update this for Craft 4?
Hi there,
I have followed the installation instructions on the readme
Unfortunately the banner is not displaying on the site.
What could be the problem?
I am using Craft CMS 3.4.16
Hi,
I installed and activated the plugin and its working but its always at the top of the page.
I change the position to bottom and the preview is correct but its always on top when I view it in actual page.
Thank you.
If there's a settings saving error and CC banner position is either bottom/bottom-left, Craft's notification banner is hidden behind CC Banner due to z-indexing.
Worked this out after a little headscratching why my plugin settings weren't being applied front end (see previous issue). Turned out I couldn't see the notification it wasn't saving due to errors.
Crafts cPanel notifications seem to be on z-index 101. CC Banner seems to be z-index 9999
As you're injecting CC markup before Crafts notification, it seems to work if CC Banner is also set to 101
I updated one of my sites to yesterday's Craft 3.7.22 update, and immediately got Internal Server Errors on every page. The Cookie Consent Banner settings are also inaccessible. Plugin can be uninstalled and removed by Composer on the command line, but not via the CP. Throws an Array to String error when attempting removal via the CP.
2021-11-24 07:33:37 [-][1][60ec7cf48e27f607b23bf4bc9592a8b3][error][TypeError] TypeError: Argument 1 passed to craft\web\AssetBundle::_prependDevServer() must be of the type string, array given in /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/craftcms/cms/src/web/AssetBundle.php:56
Stack trace:
#0 [internal function]: craft\web\AssetBundle->_prependDevServer(Array)
#1 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/craftcms/cms/src/web/AssetBundle.php(41): array_map(Array, Array)
#2 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/craftcms/cms/src/web/AssetBundle.php(29): craft\web\AssetBundle->_updateResourcePaths()
#3 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/adigital/cookie-consent-banner/src/assetbundles/cookieconsentbanner/CookieConsentBannerAsset.php(78): craft\web\AssetBundle->init()
#4 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/yiisoft/yii2/base/BaseObject.php(109): adigital\cookieconsentbanner\assetbundles\cookieconsentbanner\CookieConsentBannerAsset->init()
#5 [internal function]: yii\base\BaseObject->__construct(Array)
#6 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/yiisoft/yii2/di/Container.php(412): ReflectionClass->newInstanceArgs(Array)
#7 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/yiisoft/yii2/di/Container.php(171): yii\di\Container->build('adigital\\cookie...', Array, Array)
#8 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('adigital\\cookie...', Array, Array)
#9 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/yiisoft/yii2/web/AssetManager.php(286): yii\BaseYii::createObject(Array)
#10 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/yiisoft/yii2/web/AssetManager.php(259): yii\web\AssetManager->loadBundle('adigital\\cookie...', Array, true)
#11 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/yiisoft/yii2/web/View.php(287): yii\web\AssetManager->getBundle('adigital\\cookie...')
#12 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/twig/twig/src/Extension/CoreExtension.php(1511): yii\web\View->registerAssetBundle('adigital\\cookie...')
#13 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/craftcms/cms/src/helpers/Template.php(106): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(craft\web\View), 'registerAssetBu...', Array, 'method', false, false)
#14 /srv/users/xxuserxx/apps/xxsitexx/craft/storage/runtime/compiled_templates/32/329f9ac4de0bcefa8e1a2f30d8b6ae90056843e9e0edd0c5ea0e43d3290e3aa7.php(436): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(craft\web\View), 'registerAssetBu...', Array, 'method')
#15 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/twig/twig/src/Template.php(405): __TwigTemplate_980afcca22ae0c12438b8bf133b68f5275f66824faa8281c62fd8ad5a78c77d8->doDisplay(Array, Array)
#16 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
#17 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/twig/twig/src/Template.php(390): Twig\Template->display(Array)
#18 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/twig/twig/src/TemplateWrapper.php(45): Twig\Template->render(Array, Array)
#19 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/twig/twig/src/Environment.php(318): Twig\TemplateWrapper->render(Array)
#20 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/craftcms/cms/src/web/View.php(408): Twig\Environment->render('cookie-consent-...', Array)
#21 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/adigital/cookie-consent-banner/src/CookieConsentBanner.php(202): craft\web\View->renderTemplate('cookie-consent-...', Array)
#22 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/craftcms/cms/src/base/Plugin.php(216): adigital\cookieconsentbanner\CookieConsentBanner->settingsHtml()
#23 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/craftcms/cms/src/web/View.php(1499): craft\base\Plugin->craft\base\{closure}()
#24 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/craftcms/cms/src/base/Plugin.php(217): craft\web\View->namespaceInputs(Object(Closure), 'settings')
#25 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/craftcms/cms/src/controllers/PluginsController.php(114): craft\base\Plugin->getSettingsResponse()
#26 [internal function]: craft\controllers\PluginsController->actionEditPluginSettings('cookie-consent-...', Object(adigital\cookieconsentbanner\CookieConsentBanner))
#27 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#28 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/yiisoft/yii2/base/Controller.php(181): yii\base\InlineAction->runWithParams(Array)
#29 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/yiisoft/yii2/base/Module.php(534): yii\base\Controller->runAction('edit-plugin-set...', Array)
#30 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/craftcms/cms/src/web/Application.php(287): yii\base\Module->runAction('plugins/edit-pl...', Array)
#31 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/yiisoft/yii2/web/Application.php(104): craft\web\Application->runAction('plugins/edit-pl...', Array)
#32 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/craftcms/cms/src/web/Application.php(272): yii\web\Application->handleRequest(Object(craft\web\Request))
#33 /srv/users/xxuserxx/apps/xxsitexx/craft/vendor/yiisoft/yii2/base/Application.php(392): craft\web\Application->handleRequest(Object(craft\web\Request))
#34 /srv/users/xxuserxx/apps/xxsitexx/craft/web/index.php(27): yii\base\Application->run()
#35 {main}
2021-11-24 07:33:37 [-][1][60ec7cf48e27f607b23bf4bc9592a8b3][info][application] $_GET = [
'p' => 'admin/settings/plugins/cookie-consent-banner'
]
We need to be able to give users the choice to revoke their consent. How can we show the banner again after the user made their decision?
On the first page, where the user makes their decision, there remains a small tab at the bottom with which you can re-enable the popup. But when you navigate to another page the tab is no longer there, and there's also no global cookieconsent
variable anymore.
What happens if people click 'Decline' or 'Accept cookies'?
Hi!
When we turn on the option to preload the css the link tag with preload attribute is loaded. But the actual link tag for loading the css isn't included in the head. Which causes the styling to fail.
I think we missing something but i can't seem to find what...
Hi
We've got Administrative changes disallowed on dev/uat/prod so can't change the text/link in your plugin unless it's done locally and pushed through.
Any possibility to update the plugin so that the text and link are set on a CP Section page rather than in the settings?
The reason - we're actually using this plugin as a user notification system, so the message & link change quite often.
To ensure nothing untoward is done, maybe add another setting - 'Allow text & link override via CP Section', so if this isn't true in the plugin settings the user can't update.
PHP version | 7.3.15
Linux: 5.4.0-1025-aws
MySQL: 5.7.32
Imagick 3.4.4 (ImageMagick 6.9.7-4)
Craft Pro: 3.5.17.1
Cookie Consent Banner: 1.2.7
Thanks in advance.
Is there a way to translate the banner text?
Or use different setting in multisite (via template implementation) ?
Thanks
Hey there! This seems to have a conflict with the Blitz caching plugin. When Blitz is active, the cookie banner never displays using the auto-inject method. The code never even makes it into the DOM.
Have you seen this or have a possible solution?
Thanks!
Hi,
The Auto-inject is enabled in settings. I checked that in the website we have window.cookieconsent.initialise()
. The CSS link is generating in website:
<link href="https://example.com/web/cpresources/16b26a1a/css/cookieconsent.min.css?v=1668675871" rel="stylesheet">
but I did not get any cookieconsent.min.js.
The setting I'm using is default. Am i doing something wrong ?
Ability to select different messages for different language sites
When exporting the configuration with Schematic an error is thrown.
Exception 'yii\base\UnknownMethodException' with message 'Calling unknown method: craft\console\Request::getIsAjax()'
in /vagrant/htdocs/vendor/yiisoft/yii2/base/Component.php:300
Stack trace:
#0 /vagrant/htdocs/vendor/adigital/cookie-consent-banner/src/CookieConsentBanner.php(84): yii\base\Component->__call('getIsAjax', Array)
#1 /vagrant/htdocs/vendor/yiisoft/yii2/base/BaseObject.php(109): adigital\cookieconsentbanner\CookieConsentBanner->init()
#2 /vagrant/htdocs/vendor/yiisoft/yii2/base/Module.php(158): yii\base\BaseObject->__construct(Array)
#3 /vagrant/htdocs/vendor/craftcms/cms/src/base/Plugin.php(97): yii\base\Module->__construct('cookie-consent-...', Object(craft\console\Application), Array)
#4 [internal function]: craft\base\Plugin->__construct('cookie-consent-...', Object(craft\console\Application), Array)
#5 /vagrant/htdocs/vendor/yiisoft/yii2/di/Container.php(383): ReflectionClass->newInstanceArgs(Array)
#6 /vagrant/htdocs/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container->build('adigital\\cookie...', Array, Array)
#7 /vagrant/htdocs/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->get('adigital\\cookie...', Array, Array)
#8 /vagrant/htdocs/vendor/craftcms/cms/src/services/Plugins.php(782): yii\BaseYii::createObject(Array, Array)
#9 /vagrant/htdocs/vendor/craftcms/cms/src/services/Plugins.php(199): craft\services\Plugins->createPlugin('cookie-consent-...', Array)
#10 /vagrant/htdocs/vendor/craftcms/cms/src/base/ApplicationTrait.php(1148): craft\services\Plugins->loadPlugins()
#11 /vagrant/htdocs/vendor/craftcms/cms/src/console/Application.php(64): craft\console\Application->_postInit()
#12 /vagrant/htdocs/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\console\Application->init()
#13 /vagrant/htdocs/vendor/yiisoft/yii2/base/Application.php(206): yii\base\BaseObject->__construct(Array)
#14 /vagrant/htdocs/vendor/yiisoft/yii2/console/Application.php(89): yii\base\Application->__construct(Array)
#15 /vagrant/htdocs/vendor/craftcms/cms/src/console/Application.php(53): yii\console\Application->__construct(Array)
#16 [internal function]: craft\console\Application->__construct(Array)
#17 /vagrant/htdocs/vendor/yiisoft/yii2/di/Container.php(383): ReflectionClass->newInstanceArgs(Array)
#18 /vagrant/htdocs/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container->build('craft\\console\\A...', Array, Array)
#19 /vagrant/htdocs/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->get('craft\\console\\A...', Array, Array)
#20 /vagrant/htdocs/vendor/craftcms/cms/bootstrap/bootstrap.php(252): yii\BaseYii::createObject(Array)
#21 /vagrant/htdocs/vendor/craftcms/cms/bootstrap/console.php(31): require('/vagrant/htdocs...')
#22 /vagrant/htdocs/craft(21): require('/vagrant/htdocs...')
#23 {main}
Apologies if I am not seeing something obvious, but I am wondering - in the event of the user declining the use of cookies, how can I apply this to the website?
Am I to check the presence of cookieconsent_status at every request and then have my scripts act accordingly?
Hello.
I have installed and configured the Banner. How do I make it show up on the front end? Am I missing something?
How to use it in a multi-language website? Fields can be translated?
Hi
Thanks for this handy plugin. I was just wondering if there are any plans to upgrade this plugin to support craft 4?
Using project.yaml requires adminstration access to be revoked on production and staging. This means that there is no way to currently add/edit the cookie text in anything other than dev/local and copy the database over.
Will there be support for this anytime soon?
We have a full eCommerce project and the cookie banner is appearing for all pages except for those within our commerce templates directory (cart, product, shop landing etc).
Is this by design, a bug or something we've misconfigured?
CraftCMS: 3.5.14
Commerce: 3.2.8.1
Cookie Banner: 1.2.7
Thanks!
Hi!
I just installed the plugin and chose the "Opt-In" type, but do I set the script, that should be included now?
In the console, it says "Opt in function not defined!" but I can't find any information in the settings or documentation.
Oliver
Hi Mark!
It would be great to have a setting where one could follow the Do Not Track Option of the user. So if the user has chosen this option, the cookie consent bar isn't shown and it is handled like the user has opted-out.
What do you think about it?
Thanks for this great plugin, btw!
Oliver
Is it possible to set the banner text and link for each language?
I've run composer update on a project today and it will only update to 1.2.3. I've checked the composer.json file and the version constraints look fine.
I did notice in my Craft install it is showing 1.2.4 and 1.2.5 but they both are showing dates of 20/01/2019 and it should be 2020! I don't know whether the earlier dates are causing the problem or whether that is a red herring.
A Google Ads campaign of a client of mine seems to have problems with tracking. I don't know the exact error but is this a known issue? They said that they need a Google compatible cookie banner, such as Cookiebot. Any feedback would be greatly appreciated.
Hi, installation fails on Craft 3.4.17.1, it failed on CL and also via Control Panel.
UPDATE: Just noticed the plugin IS actually installed after the error is shown?!?
Would be great if we could set the background colors of the banner and buttons to be optional (i.e transparent).
Currently, saving settings fails if background colors are left empty.
Is it possible to exclude the banner on certain templates? In my case an amp.html
template. Here itβs causing validation errors since it injects css and js.
I was just testing a site for keyboard-only users that navigate via tabs and because the dismiss button doesn't have an empty href property using 'return' doesn't dismiss it.
Is it possible to set the Learn More link so that it does not use target="_blank"? In our case we're linking to a privacy policy that exists on the same site the visitor is currently on, so there is really no need to open a new window.
Might make for a flexible option in the control panel - whether the Learn More opens in new window or not.
I'm having trouble upgrading to the latest version, this is the error I get when updating via Composer:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package adigital/cookie-consent-banner v1.1.6 exists as adigital/cookie-consent-banner[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 1.0.7, 1.0.8, 1.0.9, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.3-beta.1, 1.1.4, 1.1.5, dev-master] but these are rejected by your constraint.
I'm a little unsure about what I should be doing here.
If I run ./craft update cookie-consent-banner
I get a PHP Fatal Error message about memory :/
Just checking in if an update for Craft 5 support is in the works?
Thanks, Jan
I get the following error upon deploying to another environment.
Failed to instantiate component or class "adigital\cookieconsentbanner\assetbundles\cookieconsentbanner\CookieConsentBannerAsset"
On the latest Craft version 3.4.4 I seem to get an internal server error whenever I deploy the site with the plugin enabled. Had a similar issue with CP-Nav so this might be Craft related though.
Hi, Getting this error for only some users which is causing an Internal Server Error.
Undefined variable: entryTypeUid in .../vendor/adigital/cookie-consent-banner/src/CookieConsentBanner.php:166
On Craft 3.4.30
I would like to prevent the banner from popping up on certain templates. Can't find any way to accomplish this.
Thanks!
The colour options stopped working for me. It seems to be related to the hash sign for hexadecimal colours.
The colour information is saved without the "#" character, which causes problem when the banner is displayed (the banner is transparent).
Any idea on how to solve this (appart from overriding the styling)? Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.