-
Notifications
You must be signed in to change notification settings - Fork 3
Cookie consent for the docs #78
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
Conversation
Bumps the npm_and_yarn group with 3 updates in the / directory: [esbuild](https://github.com/evanw/esbuild), [@vitest/coverage-v8](https://github.com/vitest-dev/vitest/tree/HEAD/packages/coverage-v8) and [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest). Bumps the npm_and_yarn group with 4 updates in the /demo directory: [@babel/runtime](https://github.com/babel/babel/tree/HEAD/packages/babel-runtime), [esbuild](https://github.com/evanw/esbuild), [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/tree/HEAD/packages/plugin-react) and [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite). Bumps the npm_and_yarn group with 1 update in the /docs directory: [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite). Updates `esbuild` from 0.21.5 to 0.25.6 - [Release notes](https://github.com/evanw/esbuild/releases) - [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG-2024.md) - [Commits](evanw/esbuild@v0.21.5...v0.25.6) Updates `@vitest/coverage-v8` from 1.6.1 to 3.2.4 - [Release notes](https://github.com/vitest-dev/vitest/releases) - [Commits](https://github.com/vitest-dev/vitest/commits/v3.2.4/packages/coverage-v8) Updates `vitest` from 1.6.1 to 3.2.4 - [Release notes](https://github.com/vitest-dev/vitest/releases) - [Commits](https://github.com/vitest-dev/vitest/commits/v3.2.4/packages/vitest) Updates `vite` from 5.4.19 to 7.0.4 - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v7.0.4/packages/vite) Updates `@babel/runtime` from 7.23.6 to 7.27.6 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.27.6/packages/babel-runtime) Updates `esbuild` from 0.21.5 to 0.25.6 - [Release notes](https://github.com/evanw/esbuild/releases) - [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG-2024.md) - [Commits](evanw/esbuild@v0.21.5...v0.25.6) Updates `@vitejs/plugin-react` from 4.2.1 to 4.6.0 - [Release notes](https://github.com/vitejs/vite-plugin-react/releases) - [Changelog](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite-plugin-react/commits/[email protected]/packages/plugin-react) Updates `vite` from 5.4.14 to 7.0.4 - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v7.0.4/packages/vite) Updates `vite` from 5.4.14 to 7.0.4 - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v7.0.4/packages/vite) Updates `vite` from 5.4.14 to 5.4.19 - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v7.0.4/packages/vite) --- updated-dependencies: - dependency-name: esbuild dependency-version: 0.25.6 dependency-type: indirect dependency-group: npm_and_yarn - dependency-name: "@vitest/coverage-v8" dependency-version: 3.2.4 dependency-type: direct:development dependency-group: npm_and_yarn - dependency-name: vitest dependency-version: 3.2.4 dependency-type: direct:development dependency-group: npm_and_yarn - dependency-name: vite dependency-version: 7.0.4 dependency-type: indirect dependency-group: npm_and_yarn - dependency-name: "@babel/runtime" dependency-version: 7.27.6 dependency-type: indirect dependency-group: npm_and_yarn - dependency-name: esbuild dependency-version: 0.25.6 dependency-type: indirect dependency-group: npm_and_yarn - dependency-name: "@vitejs/plugin-react" dependency-version: 4.6.0 dependency-type: direct:development dependency-group: npm_and_yarn - dependency-name: vite dependency-version: 7.0.4 dependency-type: direct:development dependency-group: npm_and_yarn - dependency-name: vite dependency-version: 7.0.4 dependency-type: direct:development dependency-group: npm_and_yarn - dependency-name: vite dependency-version: 5.4.19 dependency-type: indirect dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] <[email protected]>
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.
Summary of Changes
Hello @ozziest, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request introduces a comprehensive cookie consent solution for the documentation website. The primary goal is to enhance user privacy and ensure compliance with data protection regulations by providing clear information about cookie usage and giving users control over their preferences. This involves adding new policy pages, integrating a third-party cookie consent library, and updating existing analytics scripts to be consent-aware.
Highlights
- Cookie Consent Implementation: I've integrated the
vanilla-cookieconsentlibrary into the documentation site. This adds a cookie banner and a preferences modal, allowing users to manage their cookie choices, aligning with privacy regulations. - New Privacy and Cookie Policy Pages: Two new Markdown files,
privacy-policy.mdandcookie-policy.md, have been added. These pages provide detailed information on data collection, cookie usage, and user rights, accessible via new links in the site's footer. - Updated Google Analytics Integration: The Google Analytics script has been modified to respect user consent, loading only if analytics cookies are accepted. Additionally, IP anonymization has been enabled to enhance user privacy.
- Dependency Updates: Numerous development dependencies across both the
demoanddocsdirectories have been updated, including major version bumps forviteand related build tools, ensuring the project uses more recent and secure packages.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
Code Review
This pull request introduces cookie consent functionality for the documentation site. This includes adding the vanilla-cookieconsent library, creating cookie and privacy policy pages, and configuring Google Analytics to be consent-aware. The changes are well-structured and the implementation looks good. I've provided a couple of suggestions to improve maintainability and robustness.
| footer: { | ||
| message: "Released under the MIT License.", | ||
| message: | ||
| 'Released under the MIT License. | <a href="/privacy-policy">Privacy Policy</a> | <a href="/cookie-policy">Cookie Policy</a> | <a style="cursor: pointer" data-cc="show-preferencesModal">Cookie preferences</a>', |
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.
Using inline styles is generally discouraged for maintainability. It's better to keep styles in CSS files.
You could move the cursor: pointer style to a custom CSS file, for example docs/.vitepress/theme/custom.css, which seems to be already set up.
Example for custom.css:
[data-cc="show-preferencesModal"] {
cursor: pointer;
} 'Released under the MIT License. | <a href="/privacy-policy">Privacy Policy</a> | <a href="/cookie-policy">Cookie Policy</a> | <a data-cc="show-preferencesModal">Cookie preferences</a>',
| loadScript("/cookieconsent.umd.js").then(() => { | ||
| CookieConsent.run({ | ||
| categories: { | ||
| necessary: { enabled: true, readOnly: true }, | ||
| analytics: { enabled: true }, | ||
| }, | ||
| language: { | ||
| default: "en", | ||
| translations: { | ||
| en: { | ||
| consentModal: { | ||
| title: "We use cookies", | ||
| description: | ||
| "Hi, this website uses essential cookies to ensure its proper operation and tracking cookies to understand how you interact with it. The latter are set only after your consent.", | ||
| acceptAllBtn: "Accept all", | ||
| acceptNecessaryBtn: "Reject all", | ||
| showPreferencesBtn: "Manage individual preferences", | ||
| }, | ||
| preferencesModal: { | ||
| title: "Cookie preferences", | ||
| acceptAllBtn: "Accept all", | ||
| acceptNecessaryBtn: "Reject all", | ||
| savePreferencesBtn: "Accept current selection", | ||
| closeIconLabel: "Close modal", | ||
| sections: [ | ||
| { | ||
| title: "Strictly necessary cookies", | ||
| description: | ||
| "These cookies are essential for the proper functioning of this website. Without them, the website would not work properly.", | ||
| linkedCategory: "necessary", | ||
| cookieTable: { | ||
| headers: { | ||
| name: "Name", | ||
| domain: "Domain", | ||
| expiration: "Expiration", | ||
| description: "Description", | ||
| }, | ||
| body: [ | ||
| { | ||
| name: "cc_cookie", | ||
| domain: "validator.axe-api.com", | ||
| expiration: "6 months", | ||
| description: "Remembers your cookie preferences.", | ||
| }, | ||
| ], | ||
| }, | ||
| }, | ||
| { | ||
| title: "Performance and analytics", | ||
| description: | ||
| "These cookies collect information about how you use our website. All of the data is anonymized and cannot be used to identify you.", | ||
| linkedCategory: "analytics", | ||
| cookieTable: { | ||
| headers: { | ||
| name: "Name", | ||
| domain: "Domain", | ||
| expiration: "Expiration", | ||
| description: "Description", | ||
| }, | ||
| body: [ | ||
| { | ||
| name: "^_ga", | ||
| domain: "google.com", | ||
| expiration: "2 years", | ||
| description: | ||
| "Used to distinguish users by assigning a unique client ID.", | ||
| }, | ||
| { | ||
| name: "^_ga_", | ||
| domain: "google.com", | ||
| expiration: "2 years", | ||
| description: | ||
| "Used by Google Analytics 4 to persist session state for a specific property.", | ||
| }, | ||
| { | ||
| name: "^_gid", | ||
| domain: "google.com", | ||
| expiration: "24 hours", | ||
| description: | ||
| "Used to distinguish users and track user behavior for 24 hours after visiting the site.", | ||
| }, | ||
| { | ||
| name: "^_gat", | ||
| domain: "google.com", | ||
| expiration: "1 minute", | ||
| description: | ||
| "Used to throttle the request rate to Google Analytics servers.", | ||
| }, | ||
| ], | ||
| }, | ||
| }, | ||
| { | ||
| title: "More information", | ||
| description: | ||
| 'For any queries regarding our cookie policy and your choices, please <a href="mailto:[email protected]">contact us</a>.', | ||
| }, | ||
| ], | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }); | ||
| }); |
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.
The promise returned by loadScript should have a .catch() block to handle potential errors during script loading. If cookieconsent.umd.js fails to load for any reason (e.g., network error, file not found), the error will be unhandled and will result in a silent failure.
It's good practice to log such errors to the console for easier debugging.
For example:
loadScript("/cookieconsent.umd.js").then(() => {
// ... current code
}).catch(error => {
console.error("Failed to load cookie consent script:", error);
});
|



No description provided.