{"id":14956029,"url":"https://github.com/frizbee/cookieconsent","last_synced_at":"2025-10-26T19:03:14.699Z","repository":{"id":62556240,"uuid":"83864522","full_name":"frizbee/cookieconsent","owner":"frizbee","description":"The most popular solution to the EU cookie law for Rails applications","archived":false,"fork":false,"pushed_at":"2017-03-04T08:53:08.000Z","size":54,"stargazers_count":7,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-07T14:58:02.304Z","etag":null,"topics":["gem","rails","ruby","ruby-on-rails"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/frizbee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-04T04:20:46.000Z","updated_at":"2025-05-23T21:04:59.000Z","dependencies_parsed_at":"2022-11-03T06:00:21.689Z","dependency_job_id":null,"html_url":"https://github.com/frizbee/cookieconsent","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/frizbee/cookieconsent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frizbee%2Fcookieconsent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frizbee%2Fcookieconsent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frizbee%2Fcookieconsent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frizbee%2Fcookieconsent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frizbee","download_url":"https://codeload.github.com/frizbee/cookieconsent/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frizbee%2Fcookieconsent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281155551,"owners_count":26452905,"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","status":"online","status_checked_at":"2025-10-26T02:00:06.575Z","response_time":61,"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":["gem","rails","ruby","ruby-on-rails"],"created_at":"2024-09-24T13:12:12.413Z","updated_at":"2025-10-26T19:03:14.661Z","avatar_url":"https://github.com/frizbee.png","language":"Ruby","readme":"[![Gem Version](https://badge.fury.io/rb/cookieconsent.svg)](https://badge.fury.io/rb/cookieconsent)\n# Cookie Consent\n\nThe most popular solution to the EU cookie law for Rails applications. Cookie Consent is a free JavaScript plugin for alerting users about the use of cookies on your website. For more information visit: https://cookieconsent.insites.com\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'cookieconsent'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install cookieconsent\n\nRun the installation generator:\n\n    $ bundle exec rails g cookieconsent:install\n\nOr manually add in application.js:\n```ruby\n//= require cookieconsent\n```\nAnd in application.css:\n```ruby\n*= require cookieconsent\n```\n\n## Usage\n\nAdd js snippet to your `views/layouts/application.html.erb` file before `\u003c/head\u003e`\n\n###Select palette:\n\n#### Light blue\n\n![Alt text](/images/light-blue.png?raw=true \"Light blue\")\n\n```\n\u003cscript\u003e\nwindow.addEventListener(\"load\", function(){\nwindow.cookieconsent.initialise({\n  \"palette\": {\n    \"popup\": {\n      \"background\": \"#eaf7f7\",\n      \"text\": \"#5c7291\"\n    },\n    \"button\": {\n      \"background\": \"#56cbdb\",\n      \"text\": \"#ffffff\"\n    }\n  },\n  \"content\": {\n    \"message\": \"This website uses cookies to ensure you get the best experience on our website.\",\n    \"dismiss\": \"Got it!\",\n    \"link\": \"Learn more\",\n    \"href\": \"http://cookies.insites.com/about-cookies\"\n  }\n})});\n\u003c/script\u003e\n```\n\n#### Dark yellow\n\n![Alt text](/images/dark-yellow.png?raw=true \"Dark yellow\")\n```\n\u003cscript\u003e\nwindow.addEventListener(\"load\", function(){\nwindow.cookieconsent.initialise({\n  \"palette\": {\n    \"popup\": {\n      \"background\": \"#000\"\n    },\n    \"button\": {\n      \"background\": \"#f1d600\"\n    }\n  },\n  \"content\": {\n    \"message\": \"This website uses cookies to ensure you get the best experience on our website.\",\n    \"dismiss\": \"Got it!\",\n    \"link\": \"Learn more\",\n    \"href\": \"http://cookies.insites.com/about-cookies\"\n  }\n})});\n\u003c/script\u003e\n```\n\n\n#### Dark blue\n\n![Alt text](/images/dark-blue.png?raw=true \"Dark blue\")\n```\n\u003cscript\u003e\nwindow.addEventListener(\"load\", function(){\nwindow.cookieconsent.initialise({\n  \"palette\": {\n    \"popup\": {\n      \"background\": \"#252e39\"\n    },\n    \"button\": {\n      \"background\": \"#14a7d0\"\n    }\n  },\n  \"content\": {\n    \"message\": \"This website uses cookies to ensure you get the best experience on our website.\",\n    \"dismiss\": \"Got it!\",\n    \"link\": \"Learn more\",\n    \"href\": \"http://cookies.insites.com/about-cookies\"\n  }\n})});\n\u003c/script\u003e\n```\n\n#### Gray blue\n\n![Alt text](/images/gray-blue.png?raw=true \"Gray blue\")\n```\n\u003cscript\u003e\nwindow.addEventListener(\"load\", function(){\nwindow.cookieconsent.initialise({\n  \"palette\": {\n    \"popup\": {\n      \"background\": \"#edeff5\",\n      \"text\": \"#838391\"\n    },\n    \"button\": {\n      \"background\": \"#4b81e8\"\n    }\n  },\n  \"content\": {\n    \"message\": \"This website uses cookies to ensure you get the best experience on our website.\",\n    \"dismiss\": \"Got it!\",\n    \"link\": \"Learn more\",\n    \"href\": \"http://cookies.insites.com/about-cookies\"\n  }\n})});\n\u003c/script\u003e\n```\n\n#### Gray green\n\n![Alt text](/images/gray-green.png?raw=true \"Gray green\")\n```\n\u003cscript\u003e\nwindow.addEventListener(\"load\", function(){\nwindow.cookieconsent.initialise({\n  \"palette\": {\n    \"popup\": {\n      \"background\": \"#efefef\",\n      \"text\": \"#404040\"\n    },\n    \"button\": {\n      \"background\": \"#8ec760\",\n      \"text\": \"#ffffff\"\n    }\n  },\n  \"content\": {\n    \"message\": \"This website uses cookies to ensure you get the best experience on our website.\",\n    \"dismiss\": \"Got it!\",\n    \"link\": \"Learn more\",\n    \"href\": \"http://cookies.insites.com/about-cookies\"\n  }\n})});\n\u003c/script\u003e\n```\n\n### Select theme\nTheme layouts are: `\"classic\"`; `\"edgeless\"`; block by default and no need\nto add theme.\n\n```\nwindow.addEventListener(\"load\", function(){\nwindow.cookieconsent.initialise({\n  ....\n  \"theme\": \"classic\",\n  ....\n})});\n```\n\n### Select position\nPositions are: `\"top\"`; `\"bottom-right\"`; `\"bottom-left\"`; and top (pushdown)\nadd `\"position\": true` ;\nbottom is by default, no need to add position if it is bottom.\n\n```\nwindow.addEventListener(\"load\", function(){\nwindow.cookieconsent.initialise({\n  ....\n  \"position\": \"top\",\n  \"static\": true /* if top (pushdown) only */\n  ....\n})});\n```\n\n### Compliance Type\n1. Just tell users that we use cookies\n  * You tell your users that you use cookies, and that by continuing to use your website they accept them.\n2. Let users opt out of cookies (Advanced)\n  * You tell your users that you use cookies, and give them one button to disable cookies, and another to dismiss the message.\n3. Ask users to opt into cookies (Advanced)\n  * You tell your users that you wish to use cookies, and give them one button to enable cookies, and another to refuse them.\n\n```\nwindow.addEventListener(\"load\", function(){\nwindow.cookieconsent.initialise({\n  ....\n  \"type\": \"opt-out\",\n  \"content\": {\n    \"deny\": \"Refuse cookies\"\n  }\n  ....\n})});\n```\n\n```\nwindow.addEventListener(\"load\", function(){\nwindow.cookieconsent.initialise({\n  ....\n  \"type\": \"opt-in\",\n  \"content\": {\n    \"allow\": \"Allow cookies\"\n  }\n  ....\n})});\n```\n## References\nFor more information please visit `https://cookieconsent.insites.com/documentation/about-cookie-consent/`\ncookieconsent.js currently `v 3.0.3`\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/frizbee/cookieconsent. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrizbee%2Fcookieconsent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrizbee%2Fcookieconsent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrizbee%2Fcookieconsent/lists"}