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

Implement handling of cookie consent and related logic #544

Merged
merged 6 commits into from
Aug 30, 2024

Conversation

annavik
Copy link
Member

@annavik annavik commented Aug 27, 2024

Summary of changes

  • Setup cookie consent dialog
  • Centralize handling of user preferences
    • Keep all preferences in one single object (threshold, recent identifications, column settings). This centralized handling will make it easier to also store preferences on backend as one object, when we are ready for that.
    • If user has given cookie consent, store these preferences in local storage
    • If user has not given cookie consent, handle these preferences as a global app state
  • Conditionally load and unload GTM scripts, depending on cookie consent status

Fixes #350, #351 and #541

Summary of cookie dialog logic

  • The cookie modal will be visible until the user has made a choice
  • Necessary cookies cannot be disabled
  • Cookies of category functionality or performance can be enabled or disabled
  • "Refuse cookies" will disable all cookies, except necessary ones
  • "Accept cookies" will enable all cookies

Cookie categories

This is how we currently categorize the app's stored items.

  • Necessary cookies
    • Auth token (ami-auth-token)
    • Cookie consent (ami-cookie-consent)
  • Functionality cookies (all stored in ami-user-preferences)
    • Score threshold preference
    • Recent identifications
    • Visible table columns
  • Performance cookies
    • Google tag manager (multiple with prefix _ga)

Comments

We are awaiting response from Mila Legal on approval on both copy and logic for cookie handling. The current implementation is based on previous experiences and other sites from Mila.

Screenshots

Skärmavbild 2024-08-27 kl  16 28 31 Skärmavbild 2024-08-27 kl  16 28 58

Copy link

netlify bot commented Aug 27, 2024

Deploy Preview for ami-dev ready!

Name Link
🔨 Latest commit 2620188
🔍 Latest deploy log https://app.netlify.com/sites/ami-dev/deploys/66cde65b9acee600081df9b3
😎 Deploy Preview https://deploy-preview-544--ami-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 32
Accessibility: 97
Best Practices: 92
SEO: 100
PWA: 70
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@annavik annavik changed the title Feat/cookie consent Implement handling of cookie consent and related logic Aug 27, 2024
Copy link

netlify bot commented Aug 27, 2024

Deploy Preview for ami-storybook ready!

Name Link
🔨 Latest commit 2620188
🔍 Latest deploy log https://app.netlify.com/sites/ami-storybook/deploys/66cde65bb0207400088beeed
😎 Deploy Preview https://deploy-preview-544--ami-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.


const GTM_ID = 'G-EX26RXX0YT'

export const Analytics = () => {
Copy link
Member Author

@annavik annavik Aug 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #351 we said to use a React lib for this, however the most popular one for Google Tag Manager did not work out of the box and after a closer look it seemed pretty outdated.

I suggest we use this custom implementation, at least until we have more advanced analytics. It's pretty much same as before, except we conditionally load the scripts depending on cookie consent status.

Copy link
Collaborator

@mihow mihow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! I am very excited about the new userPreferences object!

@mihow mihow merged commit 9d05e76 into main Aug 30, 2024
6 checks passed
@mihow mihow deleted the feat/cookie-consent branch August 30, 2024 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add GDPR / cookie acceptance modal
2 participants