{"id":19594977,"url":"https://github.com/zessx/cookiesplease","last_synced_at":"2026-03-11T03:31:34.522Z","repository":{"id":21356083,"uuid":"24673230","full_name":"zessx/cookiesplease","owner":"zessx","description":"Little script to quickly comply with EU cookie law","archived":false,"fork":false,"pushed_at":"2018-04-17T14:56:37.000Z","size":488,"stargazers_count":7,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-10T07:40:29.172Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://work.smarchal.com/cookiesplease","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zessx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-01T09:48:29.000Z","updated_at":"2023-01-25T16:46:46.000Z","dependencies_parsed_at":"2022-08-05T11:30:41.279Z","dependency_job_id":null,"html_url":"https://github.com/zessx/cookiesplease","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/zessx/cookiesplease","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zessx%2Fcookiesplease","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zessx%2Fcookiesplease/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zessx%2Fcookiesplease/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zessx%2Fcookiesplease/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zessx","download_url":"https://codeload.github.com/zessx/cookiesplease/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zessx%2Fcookiesplease/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30325640,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T01:36:58.598Z","status":"online","status_checked_at":"2026-03-10T02:00:06.579Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-11T08:45:23.773Z","updated_at":"2026-03-11T03:31:34.488Z","avatar_url":"https://github.com/zessx.png","language":"JavaScript","funding_links":["https://www.paypal.com/cgi-bin/webscr?cmd=_donations\u0026business=KTYWBM9HJMMSE\u0026lc=FR\u0026item_name=Buy%20a%20coffee%20to%20zessx%20%28Samuel%20Marchal%29\u0026currency_code=EUR\u0026bn=PP%2dDonationsBF%3abmac%3aNonHosted"],"categories":[],"sub_categories":[],"readme":"![cookiesplease](https://raw.githubusercontent.com/zessx/cookiesplease/master/cookiesplease.png)\n\nCookiesPlease\n=============\n\nLittle script to quickly comply with EU cookie law.  \nIt'll allow you to add a message asking the user is he accepts or not cookies' storage for your website.\n\nInstallation\n------------\n\nCookiesPlease is available on bower:\n\n    $ bower install cookiesplease\n\nIf you're not using bower you still can install it manually, cloning this repository.\n\nUsage\n-----\n\nSimply include CookiesPlease as **the very first JavaScript** in your `\u003chead\u003e` tag.  \nAs it is now self-initialized, you no longer have to call `cookiesplease.init()`.\n\nCookiesPlease offers you two functions to check if cookies were accepted, or not:\n\n    if(cookiesplease.wasAccepted()) {\n        // Run JS if user has accepted cookies' storage\n    } \n    if(cookiesplease.wasDeclined()) {\n        // Run JS if user has refused cookies' storage\n    } \n\nFurthermore, it'll dispatch an event when user accept/decline cookies. This event allows you to load others scripts without refreshing the page:\n\n    document.addEventListener('CookiesPleaseAccepted', function() {});\n    document.addEventListener('CookiesPleaseDeclined', function() {});\n\nHere's a common example, defering Google Analytics' loading while user hasn't accepted cookies:\n\n    \u003chead\u003e\n        \u003cscript src=\"vendor/cookiesplease/cookiesplease.min.js\"\u003e\u003c/script\u003e\n        \u003cscript\u003e\n            function loadGoogleAnalytics() {\n                (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n                (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n                m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n                })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');\n\n                ga('create', 'UA-XXXXXXXX-X', 'auto');\n                ga('send', 'pageview');\n            }\n            if(cookiesplease.wasAccepted()) {\n                loadGoogleAnalytics();\n            }\n            document.addEventListener('CookiesPleaseAccepted', loadGoogleAnalytics);\n        \u003c/script\u003e\n    \u003c/head\u003e\n\nOptions\n-------\n\nCookiesPlease comes with a bunch of options:\n\n| Option                  | Default value     | Usage                                                     |\n|-------------------------|-------------------|-----------------------------------------------------------|\n| `buttonAccept`          | true              | Show a button to accept cookies' storage                  |\n| `buttonDecline`         | false             | Show a button to decline cookies' storage                 |\n| `clearCookiesOnDecline` | false             | Remove every stored cookie if user refuse their storage   |\n| `storeChoiceOnDecline`  | true              | Remember user's decline (...storing a cookie!!)           |\n| `prependToBody`         | false             | If you prefer to add the div at the beginning of `\u003cbody\u003e` |\n| `buttonAcceptText`      | 'Continue'        | Text used for the accept button                           |\n| `buttonDeclineText`     | 'Decline'         | Text used for the decline button                          |\n| `message`               | 'This website...' | Message displayed                                         |\n\nAs it is self-initialiazed, you'll need to declare these options in a variable called `cookiespleaseOptions` (case sensitive) before including the script itself:\n\n    \u003cscript\u003e\n        var cookiespleaseOptions = {\n            buttonDecline: true,\n            prependToBody: true\n        };\n    \u003c/script\u003e\n    \u003cscript src=\"vendor/cookiesplease/cookiesplease.min.js\"\u003e\u003c/script\u003e\n\nWhat about the CSS ?\n--------------------\n\nCookiesPlease has it's own default CSS, but you can easily customize it. Everything is wrapped in the following element :\n\n    \u003cdiv id=\"cookiesplease\" class=\"cookiesplease\"\u003e\n        ...\n    \u003c/div\u003e\n\nCookiesPlease's default CSS use the `.cookiesplease` class, to allow you to use `#cookiesplease` id (then avoiding any conflict) :\n\n\u003c!-- language: lang-css --\u003e\n\n    #cookiesplease {\n        background-color: #eee;\n        border-top: 1px solid #222;\n        color: #222;\n    }\n    #cookiesplease p {}\n    #cookiesplease a {}\n    #cookiesplease button {}\n    #cookiesplease .cookiesplease-accept {}\n    #cookiesplease .cookiesplease-decline {}\n    #cookiesplease.cookiesplease-hidden {}\n    body.cookiesplease-shown {}\n\nPlease note that the `.cookiesplease-shown` is added to the `\u003cbody\u003e` element, until the user click on any button. This allows you to customize external elements, for pushing down the body for example.\n\nLegals\n------\n- Author : [zessx](https://github.com/zessx)\n- Licence : [MIT](http://opensource.org/licenses/MIT) \n- Contact : [@zessx](https://twitter.com/zessx)\n- Link  : [http://smarchal.com/cookiesplease](http://smarchal.com/cookiesplease)\n\nDonations\n---------\n\n[![Buy me a coffee !](http://doc.smarchal.com/bmac)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations\u0026business=KTYWBM9HJMMSE\u0026lc=FR\u0026item_name=Buy%20a%20coffee%20to%20zessx%20%28Samuel%20Marchal%29\u0026currency_code=EUR\u0026bn=PP%2dDonationsBF%3abmac%3aNonHosted)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzessx%2Fcookiesplease","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzessx%2Fcookiesplease","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzessx%2Fcookiesplease/lists"}