{"id":20085408,"url":"https://github.com/klaxit/cookie-consent","last_synced_at":"2025-04-07T06:09:21.392Z","repository":{"id":41874431,"uuid":"342054233","full_name":"klaxit/cookie-consent","owner":"klaxit","description":"🍪 Neat cookie consent popup for the EU, GDPR and California Cookie Laws","archived":false,"fork":false,"pushed_at":"2022-04-25T09:56:00.000Z","size":1116,"stargazers_count":204,"open_issues_count":1,"forks_count":14,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-03-31T05:06:49.808Z","etag":null,"topics":["ccpa","cookie-consent","eu-cookie","gdpr"],"latest_commit_sha":null,"homepage":"","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/klaxit.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":"2021-02-24T22:33:16.000Z","updated_at":"2025-02-26T09:50:59.000Z","dependencies_parsed_at":"2022-08-11T20:00:21.259Z","dependency_job_id":null,"html_url":"https://github.com/klaxit/cookie-consent","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klaxit%2Fcookie-consent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klaxit%2Fcookie-consent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klaxit%2Fcookie-consent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klaxit%2Fcookie-consent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/klaxit","download_url":"https://codeload.github.com/klaxit/cookie-consent/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247601448,"owners_count":20964864,"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":["ccpa","cookie-consent","eu-cookie","gdpr"],"created_at":"2024-11-13T15:55:51.285Z","updated_at":"2025-04-07T06:09:21.376Z","avatar_url":"https://github.com/klaxit.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![MIT License][mit-badge]](LICENSE)\n\n# Cookie Consent\n\nA lightweight JavaScript plugin to handle cookie consent.\n\nIt is designed to help you comply with data privacy laws like [EU Cookie Law][eu-cookie-law], [European GDPR][gdpr] or [California CCPA][ccpa].\n\n\u003cimg src=\"examples/demo.gif\" alt=\"Cookie consent demo image\" width=\"540\"/\u003e\n\n## Installation\n\n```bash\nnpm install @klaxit/cookie-consent\n```\n\nor\n\n```bash\nyarn add @klaxit/cookie-consent\n```\n\nor\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/@klaxit/cookie-consent@X.Y.Z/dist/cookie-consent.js\"\u003e\u003c/script\u003e\n```\n\n\u003csub\u003e**NOTE:** the latter isn't advised if you want to have one build for all your libraries. Mostly great for tests. And don't forget to replace X.Y.Z with current package version!\u003c/sub\u003e\n\n## Usage\n\n```javascript\n  // Module\n  import CookieConsent from \"@klaxit/cookie-consent\"\n  // or (Classic)\n  const CookieConsent = window.CookieConsent\n\n  // Initialize the popup and open it\n  const cc = new CookieConsent({\n    title: \"We use cookies 🍪\",\n    // ... other options\n  })\n\n  // Events\n  cc.on(\"accept\", (cc /* your CookieConsent instance */) =\u003e console.log(\"Accepted !\"))\n  cc.on(\"reject\", (cc) =\u003e console.log(\"Rejected !\"))\n  cc.on(\"change\", (cc) =\u003e console.log(\"Any change !\"))\n  // All events can also be binded to `CookieConsent`.\n\n\n  // Main accessors\n  console.log(cc.status)              // accepted, rejected\n  console.log(cc.acceptedCategories)  // [\"essential\", \"analytics\"]\n  // also available under `CookieConsent`\n\n  // Re-open the popup to allow user to change its consent\n  cc.open()\n  // also available under `CookieConsent` once initialized\n```\n### Options\n\nAvailable configuration options are documented in [default options](./src/default_options.js).\n\n### Integration with trackers\n\nYou can see an example integration with Google Analytics in [examples/index.ejs](./examples/index.ejs).\nIf you want to try further, `git clone git@github.com:klaxit/cookie-consent \u0026\u0026 yarn \u0026\u0026 yarn start` will\nrun this example.\n\nBy using the interface described [above](#usage), you should be able to load scripts on demand depending\non the three given events.\n\n### Custom design\n\nWe won't integrate custom themes BUT\n\nwe will do our best to keep current HTML structure and CSS classes in place. And use semantic versioning to indicate any breaking change. So you can rely on these to build your own !\n\n### Internationalization (i18n) ?\n\nTo keep things as simple as possible, and because there are many ways to handle i18n, we didn't provide built-in i18n capabilities. But you can easily support multiple languages by doing something like this :\n\n```javascript\n  const userLang = navigator.language || navigator.userLanguage\n  const titles = {\n    \"fr-FR\": \"Nous utilisons des cookies\",\n    \"default\": \"We use cookies\"\n  }\n  const cc = new CookieConsent({\n    title: titles[userLang] || titles[\"default\"],\n    // ...\n  })\n```\n\n## Compatibility\n\nWe do our best to support these configurations.\n\n### Browsers\n\n| DEVICE  | BROWSER          | VERSIONS |\n| ------- | ---------------- | -------- |\n| DESKTOP | Chrome           | N / N-1  |\n| DESKTOP | Safari           | N / N-1  |\n| DESKTOP | Firefox          | N / N-1  |\n| DESKTOP | MS Edge          | N / N-1  |\n| DESKTOP | Samsung internet | N / N-1  |\n| DESKTOP | Opera            | N / N-1  |\n| DESKTOP | IE               | 11       |\n\n### Definitions\n\nMinimum supported definition is **320 x 568**.\n\n## License\nPlease see [LICENSE](LICENSE)\n\n[mit-badge]: https://img.shields.io/badge/license-MIT-brightgreen.svg\n[eu-cookie-law]: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=OJ:L:2009:337:0011:0036:En:PDF\n[gdpr]: https://gdpr.eu/\n[ccpa]: https://oag.ca.gov/privacy/ccpa\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklaxit%2Fcookie-consent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fklaxit%2Fcookie-consent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklaxit%2Fcookie-consent/lists"}