{"id":13734561,"url":"https://github.com/pioug/cookie-choice","last_synced_at":"2025-10-29T12:30:33.664Z","repository":{"id":66258756,"uuid":"163534508","full_name":"pioug/cookie-choice","owner":"pioug","description":"Serve cookie consent banner to EU visitors with Cloudflare Workers 🌩","archived":false,"fork":false,"pushed_at":"2020-07-09T13:42:30.000Z","size":6,"stargazers_count":15,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-08-03T03:03:47.649Z","etag":null,"topics":["cloudflare-workers","cookie-banner","cookie-consent","serverless"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/pioug.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2018-12-29T19:04:19.000Z","updated_at":"2024-08-03T03:03:48.259Z","dependencies_parsed_at":"2023-02-20T21:30:56.068Z","dependency_job_id":null,"html_url":"https://github.com/pioug/cookie-choice","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pioug%2Fcookie-choice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pioug%2Fcookie-choice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pioug%2Fcookie-choice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pioug%2Fcookie-choice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pioug","download_url":"https://codeload.github.com/pioug/cookie-choice/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219857782,"owners_count":16556055,"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":["cloudflare-workers","cookie-banner","cookie-consent","serverless"],"created_at":"2024-08-03T03:00:57.428Z","updated_at":"2025-10-29T12:30:28.389Z","avatar_url":"https://github.com/pioug.png","language":"JavaScript","funding_links":[],"categories":["Localization"],"sub_categories":[],"readme":"**Cookie Choice** is a endpoint that serves a JS library for rendering a cookie consent banner. Endpoint is a Cloudflare Worker to take advantage of the geolocation.\n\n## Demo\n\n- Live demo: https://pioug.github.io/cookie-choice/example.html\n- \"Noop\" fuction if not in Europe: https://cookie-choice.pioug.workers.dev/cookie-choice.js?privacy-policy-link=https://github.com/pioug/cookie-choice\n- Function to render the banner: https://cookie-choice.pioug.workers.dev/cookie-choice.js?privacy-policy-link=https://github.com/pioug/cookie-choice\u0026force=true\n\n## Why?\n\n- Low latency thanks to Cloudflare CDN\n- Visitor's location provided by Cloudflare (neither IP geolocation service nor browser geolocation API are needed)\n- Library served only when cookie consent law applies to visitor's country\n- Small overhead when cookie consent is not required\n\n## Installation\n\n1. Build the library:\n\n```bash\nnpm ci\nnpx rollup -c\n```\n\n2. Deploy `cloudflare-worker.js` to Cloudflare Workers.\n\n## Usage\n\n```js\nconst privacyPolicyLink = \"https://my.privacy.policy/\";\nconst force = true;\nconst {\n  renderCookieChoice\n} = await import(`https://my.cloudflare.worker/cookie-choice.js?privacy-policy-link=${privacyPolicyLink}\u0026force=${force}`);\nrenderCookieChoice();\ndocument.body.addEventListener(\n  \"cookieChoice:accept\",\n  {\n    once: true\n  },\n  () =\u003e {\n    console.log(\"Thanks for the cookies!\");\n  }\n);\n```\n\n## Documentation\n\n- https://developers.cloudflare.com/workers/\n- https://blog.cloudflare.com/delivering-a-serverless-api-in-10-minutes-using-workers/\n- http://ec.europa.eu/ipg/basics/legal/cookies/index_en.htm\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpioug%2Fcookie-choice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpioug%2Fcookie-choice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpioug%2Fcookie-choice/lists"}