Skip to content
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

feat(gtag): cookie consent banner #6376

Closed
wants to merge 8 commits into from
Closed

feat(gtag): cookie consent banner #6376

wants to merge 8 commits into from

Conversation

Josh-Cena
Copy link
Collaborator

@Josh-Cena Josh-Cena commented Jan 16, 2022

Motivation

Fix #2407.

The current approach doesn't look clean enough because we need to check local storage on every route transition, but otherwise, the tracking only starts after the user refreshed and the site reloads with the new local storage value.

Waiting to polish the banner design.

We can port this banner to google analytics after merging this one, or before it's ready to be merged.

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

Temporarily enabled the plugin in deploy preview to make it show up

@Josh-Cena Josh-Cena added the pr: new feature This PR adds a new API or behavior. label Jan 16, 2022
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Jan 16, 2022
@netlify
Copy link

netlify bot commented Jan 16, 2022

✔️ [V2]

🔨 Explore the source changes: 543b5df

🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/61e410cff398830008fbe71d

😎 Browse the preview: https://deploy-preview-6376--docusaurus-2.netlify.app

@github-actions
Copy link

github-actions bot commented Jan 16, 2022

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 68
🟢 Accessibility 98
🟢 Best practices 93
🟢 SEO 100
🟢 PWA 92

Lighthouse ran on https://deploy-preview-6376--docusaurus-2.netlify.app/

@github-actions
Copy link

github-actions bot commented Jan 16, 2022

Size Change: +1.8 kB (0%)

Total Size: 680 kB

Filename Size Change
website/build/assets/css/styles.********.css 103 kB +545 B (+1%)
website/build/assets/js/main.********.js 504 kB +1.25 kB (0%)
ℹ️ View Unchanged
Filename Size
website/.docusaurus/globalData.json 42.9 kB
website/build/index.html 29.6 kB

compressed-size-action

@Josh-Cena Josh-Cena marked this pull request as draft January 18, 2022 10:22
@slorber
Copy link
Collaborator

slorber commented Jan 19, 2022

I have an internal Meta doc (that I cannot share) and it seems blocking gtag is not enough.

We also need to be able to block localStorage usage, including in core/theme (ie no announcementBar dismiss or theme persistence)

And we need to think about this with a long-term vision: if the user needs 2 plugins requiring localstorage/tracking, only one consent banner should be presented, probably with granular options (checkboxes) and i18n messages.


Maybe this PR is a good-enough first step and we can improve later, will ask.

@Josh-Cena
Copy link
Collaborator Author

We also need to be able to block localStorage usage, including in core/theme (ie no announcementBar dismiss or theme persistence)

Really...? Everywhere I checked, our moderate usage of localStorage is permitted. GDPR doesn't forbid local storage as long as it's for the interest of the user (e.g. not annoying them by showing the announcement every time)

@slorber
Copy link
Collaborator

slorber commented Jan 19, 2022

Really...? Everywhere I checked, our moderate usage of localStorage is permitted. GDPR doesn't forbid local storage as long as it's for the interest of the user (e.g. not annoying them by showing the announcement every time)

hmm yes I found this surprising too

Re-reading that internal doc, I'll try to clarify this part.

It's not 100% clear what should be the behavior when localStorage is used but without any purpose of tracking users

@slorber
Copy link
Collaborator

slorber commented Jan 20, 2022

It's hard to read between the lines between all the online resources, but I think it's fine to use localStorage for non-tracking functional behavior after user-interactions.

Something we should refactor: we shouldn't set default values in localStorage when the user is just landing on a page. Values must only be set after interactions that require such storage usage.

Apparently, we'd still need to disclose to the user that storage is used 🤷‍♂️ https://www.reddit.com/r/gdpr/comments/s7sk3w/localstorage_to_persist_dark_mode_theme/

@PatelN123
Copy link
Contributor

🐛 Bug:
image
image

@JohannesDienst-askui
Copy link

Is this still worked on? Happy to help as we need to be GDPR compliant ;)

@Nanin22
Copy link

Nanin22 commented Sep 29, 2022 via email

@monica-m-ps
Copy link

Hi. Do we have plans to merge this sooner? Thanks

@0ptim
Copy link

0ptim commented Oct 25, 2022

I'm also interested on this kind of feature.

@wgruszczyk
Copy link

@Josh-Cena is this feature planned to be continued and merged any time soon? Adding Google Analytics via the gtag definitely requires GDPR consent and doing it right feels like a significant effort on our side. Having that built-in would be of great help.

@Shnitselon
Copy link

Hi, any news on this?

Cookie consent is a basic requirement from GDPR

@wgruszczyk
Copy link

@Shnitselon I decided to go with https://github.com/Mastermindzh/react-cookie-consent, maybe not ideal and ootb, but definitely sufficient to satisfy GDPR requirements.

@monica-m-ps
Copy link

Hello. Any update on this?

@Josh-Cena
Copy link
Collaborator Author

Sorry everyone who commented under this. I will not be working on this for any foreseeable future because we don't know what needs to be done.

Please comment under the linked issue detailing what you think (or better, what you know, backed by actual laws) the consent banner should do:

  1. Does it need to block all local storage access (including persisting the color mode choice, tab choice, etc.)?
  2. Does it need to stop sending Google analytics? If so, at which stage (not loading the script tag at all, or just not sending the page view events)? Or is there a way to send analytics in a "private mode" that does not rely on user data?
  3. Do you use other plugins that require this privacy protection too? Do they currently handle privacy issues? If so, what mechanism do they use?
  4. Any other feature you use on your site that requires cookie consent?

Thank you.

@Josh-Cena Josh-Cena closed this Jan 6, 2024
@oyatek
Copy link

oyatek commented May 9, 2024

  1. https://github.com/68publishers/cookie-consent - if all you need is add a Cookie Consent for Google Tags - this works out of the box with Docusaurus gtag plugin - without installing anything extra on your site

  2. https://cookieconsent.orestbida.com/ - this one seems to be more flexible. Needs to be installed on your site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: new feature This PR adds a new API or behavior.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make gtag compliant with GDPR