{"id":21890895,"url":"https://github.com/statikbe/craft-cookie-banner","last_synced_at":"2025-04-15T13:40:10.569Z","repository":{"id":57059209,"uuid":"406687957","full_name":"statikbe/craft-cookie-banner","owner":"statikbe","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-21T14:39:37.000Z","size":329,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":6,"default_branch":"develop","last_synced_at":"2025-03-28T20:37:10.231Z","etag":null,"topics":["craft-plugin","craftcms"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/statikbe.png","metadata":{"files":{"readme":"README.MD","changelog":"CHANGELOG.MD","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-15T09:04:32.000Z","updated_at":"2024-11-21T14:40:05.000Z","dependencies_parsed_at":"2023-01-22T01:46:51.184Z","dependency_job_id":"4e2bb9fc-6a36-45fd-95c9-9bbfb0a6b982","html_url":"https://github.com/statikbe/craft-cookie-banner","commit_stats":{"total_commits":40,"total_committers":4,"mean_commits":10.0,"dds":0.4,"last_synced_commit":"871b3505c9d907294f98692a0eceab15bc063960"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statikbe%2Fcraft-cookie-banner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statikbe%2Fcraft-cookie-banner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statikbe%2Fcraft-cookie-banner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statikbe%2Fcraft-cookie-banner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/statikbe","download_url":"https://codeload.github.com/statikbe/craft-cookie-banner/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249081516,"owners_count":21209712,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["craft-plugin","craftcms"],"created_at":"2024-11-28T12:18:08.010Z","updated_at":"2025-04-15T13:40:10.550Z","avatar_url":"https://github.com/statikbe.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cookie banner for Craft CMS 3.x\n\nThis is an internal Statik.be plugin for use with our Tag Manager consent management solution.\n\n⚠️ The plugin will only render templates out of the box, it won't do anything to prevent tracking without proper configuration.\n\n## Requirements\n\nThis plugin requires Craft CMS 3.0.0 or later.\n\n## Installation\n\nTo install the plugin, follow these instructions:\n\n```console\ncd /path/to/project\ncomposer require statikbe/craft-cookie-banner\n./craft  plugin/install cookie-banner\n```\n\n## Usage\n\nThe plugin uses a Twig function to render the initial popup and the cookie settings modal.\n\n```PHP\n{{ craft.cookieBanner.render() }}\n```\n\nYou can also pass an array of options:\n\n- modal: path to the template for the modal\n- banner: path to the template for the banner\n- overlay: HTML string with styling that will you use as overlay behind the banner\n- supportIE: wether or not the Javascript used should be compiled for ES6 or ES5 (defaults to false so using ES6)\n- cookiePage: the entry where the cookie policy content is defined. This is used on the modal template to show the possible settings.\n\nFor example:\n\n```PHP\n{{ craft.cookieBanner.render({\n        modal: '_site/_snippet/_cookie/_modal',\n        banner: '_site/_snippet/_cookie/_banner',\n        overlay: '\u003cdiv class=\"fixed inset-0 hidden bg-black opacity-80 z-99\" id=\"cookiebanner-overlay\"\u003e\u003c/div\u003e',\n        supportIE: true,\n        cookiePage: craft.entries.section('cookiePolicy').one(),\n        showCookieBanner: (entry.type is defined and entry.type.handle != 'cookiePolicy')\n}) }}\n```\n\nIt's adviced to not overwrite the templates just for styling, only for more fundamental and structural changes.\n\n[Modal](https://github.com/statikbe/craft-cookie-banner/blob/master/src/templates/_modal.twig), [banner](https://github.com/statikbe/craft-cookie-banner/blob/master/src/templates/_banner.twig) and [overlay](https://github.com/statikbe/craft-cookie-banner/blob/develop/src/templates/_overlay.twig) templates have generic classes that can be used for styling.\n\nTo trigger the settings modal after closing the cookie banner, you can use the following code:\n\n```HTML\n\u003ca href=\"#\" class=\"js-cookie-settings\" role=\"button\"\u003e{{ 'Cookie settings'|t }}\u003c/a\u003e\n```\n\n## Listeners\n\nYou can listen to the following events:\n\n```\ncookie-banner-opened\ncookie-closed\ncookie-modal-opened\ncookie-prop-performance-disabled\ncookie-prop-performance-enabled\ncookie-prop-marketing-disabled\ncookie-prop-marketing-enabled\n```\n\nExample:\n\n```js\nwindow.addEventListener('cookie-closed', () =\u003e {\n  console.log('cookie-closed');\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatikbe%2Fcraft-cookie-banner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstatikbe%2Fcraft-cookie-banner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatikbe%2Fcraft-cookie-banner/lists"}