-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Add GDPR-compliant cookie consent with analytics blocking #3492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
❌ Deploy Preview for relaxed-lollipop-b6bc17 failed. Why did it fail? →
|
Co-authored-by: george-gca <[email protected]>
|
Failed prettier code check. Check this file for more information. |
Signed-off-by: George Araújo <[email protected]>
Signed-off-by: George Araújo <[email protected]>
Signed-off-by: George Araújo <[email protected]>
Signed-off-by: George Araújo <[email protected]>
Signed-off-by: George Araújo <[email protected]>
Signed-off-by: George Araújo <[email protected]>
Signed-off-by: George Araújo <[email protected]>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements GDPR-compliant cookie consent functionality using the vanilla-cookieconsent library (v3). The implementation blocks all analytics scripts until users explicitly grant consent, ensuring compliance with European privacy regulations.
Changes:
- Adds vanilla-cookieconsent library integration with modal UI for user consent management
- Implements conditional script blocking for Google Analytics, Cronitor, Pirsch, and OpenPanel using
type="text/plain" data-category="analytics"pattern - Integrates Google Consent Mode v2 to signal privacy preferences to Google services before user consent
- Adds dark mode support for cookie consent modal that syncs with site theme
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
_config.yml |
Adds library configuration with CDN URLs/integrity hashes and enable_cookie_consent feature flag |
_scripts/cookie-consent-setup.js |
Implements consent modal configuration, Google Consent Mode initialization, and consent callbacks |
_includes/scripts.liquid |
Conditionally blocks analytics scripts with type="text/plain" data-category="analytics" when consent is enabled |
_includes/distill_scripts.liquid |
Mirrors analytics blocking implementation for Distill layout pages |
_includes/head.liquid |
Loads cookie consent CSS library with integrity verification |
assets/js/theme.js |
Adds setCookieConsentTheme() function to sync modal appearance with site dark mode |
Co-authored-by: Copilot <[email protected]>
|
I am not sure the current solution is enough to guarantee that no tracking is being made if not given consent. It would be useful for someone with experience on that to give feedback. |
Signed-off-by: George Araújo <[email protected]>
Implements cookie consent using vanilla-cookieconsent v3 to comply with GDPR requirements. Analytics scripts are blocked until user consent is obtained.
Changes
Library Integration
[email protected]to_config.ymlthird-party libraries with SRI hashes_scripts/cookie-consent-setup.jswith consent modal and settings configuration_includes/head.liquidand_includes/scripts.liquidAnalytics Blocking
scripts.liquidanddistill_scripts.liquidto use conditionaltype="text/plain" data-category="analytics"when consent is disabledConfiguration
enable_cookie_consentflag (default:false)necessary(always on),analytics(optional)Implementation
{% if site.enable_cookie_consent %} <script type="text/plain" data-category="analytics" async src="...gtag.js"></script> {% else %} <script async src="...gtag.js"></script> {% endif %}Enable in
_config.yml:Screenshots
Consent Modal
Settings Modal
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
cdn.jsdelivr.net/usr/bin/curl curl -s REDACTED(dns block)cookieconsent.orestbida.com/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)medium.com/usr/local/bin/ruby ruby /usr/local/bundle/bin/bundle exec jekyll serve --watch --port=8080 --host=0.0.0.0 --livereload --verbose --trace --force_polling s 6_64-linux /etc/locale.gen by/backward -binutils_2.44-3grep .deb eb /systemd-sysctl(dns block)publish.twitter.com/usr/local/bin/ruby ruby /usr/local/bundle/bin/bundle exec jekyll serve --watch --port=8080 --host=0.0.0.0 --livereload --verbose --trace --force_polling lude�� lude/ruby-4.0.0//run/containerd/io.containerd.runtime.v2.task/moby/a4760212ce4eda97e32b6dfa4d3ea/usr/sbin/iptables r/runc-log.json f8_range lude r-strong E r/wc7in709a54d7hshow(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.