Skip to content

Accept and reject cookies#9271

Merged
ahukkanen merged 62 commits intodecidim:developfrom
mainio:feature/cookie-settings
Jun 8, 2022
Merged

Accept and reject cookies#9271
ahukkanen merged 62 commits intodecidim:developfrom
mainio:feature/cookie-settings

Conversation

@lahdeero
Copy link
Copy Markdown
Contributor

@lahdeero lahdeero commented May 6, 2022

🎩 What? Why?

Allow user to choose which cookies they want to accept and reject. Technically there is four (4) cookie categories: essential, preferences, analytics and marketing. Iframes are disabled until all categories are accepted, scripts that require cookies could be added as follows:

<script type="text/plain" data-cookiecategory="preferences">
  console.log('preferences cookies accepted');
</script>

Note that you can always change your cookie settings by clicking "Cookie settings" in the footer (participant side)

📌 Related Issues

Testing

  1. Go to admin panel -> Find WYSIWYG/quill editor -> Add youtube video using editor -> Go to participant side to view content
  2. Create meeting with embedded content -> Go to (live) meetings page
  3. Create html block to homepage with the content below -> Go to home page
<div>
  <p>TESTING TEXT PLAIN SCRIPTS</p>
  <script type="text/plain" data-consent="essential">
    console.log('essential cookies accepted');
  </script>
  <script type="text/plain" data-consent="preferences">
    console.log('preferences cookies accepted');
  </script>
  <script type="text/plain" data-consent="analytics">
    console.log('analytics cookies accepted');
  </script>
  <script type="text/plain" data-consent="marketing">
    console.log('marketing cookies accepted');
  </script>
</div>

📷 Screenshots

image

image

image

♥️ Thank you!

@lahdeero lahdeero changed the title Replace cookie consent dialog Accept and reject cookies May 6, 2022
@lahdeero
Copy link
Copy Markdown
Contributor Author

lahdeero commented May 9, 2022

EDIT: Staging changed to https://decidim-cookie-consent.herokuapp.com/

Sorry for inconvenience!

@ahukkanen ahukkanen marked this pull request as draft May 10, 2022 07:52
@ahukkanen
Copy link
Copy Markdown
Contributor

I have some styling related suggestions.

Cookie notification

I would categorize the buttons differently:

  • Use primary button with the button we want participants to click by default, i.e. the "Accept all"
  • Use "hollow" button for the reject action
  • Use "clear" button for the settings
  • Make the heading a bit smaller (h5 maybe?)

Cookie notification

Same thing for the buttons within the cookie settings modal.

Disabled content notification

I would put a bit of hightlight to the disabled content notification so that the user sees it clearly there is something missing. Colors are just example in the screenshot, use the Decidim theme colors instead.

  • Add a border to the element
  • Add a background to the element
  • Center the content within the notification, both vertically and horizontally
  • Add a bit of margin between the text and the button
  • Change the button label to "Change cookie settings"
  • Make the element a bit lower in height (only the notification, should not apply to the video when it is displayed)

Disabled content notification

lahdeero added 3 commits May 10, 2022 11:17
We used .ql-editor selector to find content inside editor (while editing), but decidim_sanitize_editor
added same class (ql-editor) when we are rendering content with editor.
Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

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

Technically this is good to go for me but could you please add the documentation page?

We maintain the developer related documentation in the decidim main repository, so we can include it in this PR.

For details, see the related issue (and Andres suggestion about the location for this):
decidim/documentation#94

Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

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

Docs looks good, just few minor things noticed when reading through.

Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

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

Great! This is good to go for me.

I'll leave this still open for @andreslucena and @carolromero to have the final review.

Copy link
Copy Markdown
Member

@andreslucena andreslucena left a comment

Choose a reason for hiding this comment

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

Foremost, great job @lahdeero! I have lots of smallish things to improve, but generally I liked the approach!

Copy link
Copy Markdown
Member

@andreslucena andreslucena left a comment

Choose a reason for hiding this comment

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

Wrong button, sorry 😅

@andreslucena
Copy link
Copy Markdown
Member

I read before that we can prevent that by applying the following meta comments around the content we want to hide from the search index:

I didn't know about this tags @ahukkanen, great finding! Just a detail, that googleoff as far as I found It's for the Google Search Appliance, a discontinued Google product for internal use, and seems like it doesn't work with Googlebot/Google Search.

@ahukkanen
Copy link
Copy Markdown
Contributor

I didn't know about this tags @ahukkanen, great finding! Just a detail, that googleoff as far as I found It's for the Google Search Appliance, a discontinued Google product for internal use, and seems like it doesn't work with Googlebot/Google Search.

Nice note @andreslucena ! I didn't catch that.

I think we should also add data-nosnippet attribute to the element wrapping the content of the cookie notification then:
https://developers.google.com/search/docs/advanced/robots/robots_meta_tag#data-nosnippet-attr

Also the text that is used in place of the meta description is apparently called a "regular snippet" as per this doc:
https://developers.google.com/search/docs/advanced/appearance/featured-snippets#block-both

So this should prevent Google adding the content to the meta description.

Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

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

@andreslucena
Copy link
Copy Markdown
Member

So this should prevent Google adding the content to the meta description.

I hope so, this would be great to solve!!

Copy link
Copy Markdown
Member

@andreslucena andreslucena left a comment

Choose a reason for hiding this comment

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

Sorry for the delay. I wanted to give it a last review with fresh eyes. Everything seems great 👍🏽 🚀

@andreslucena andreslucena requested a review from ahukkanen June 8, 2022 07:18
@andreslucena
Copy link
Copy Markdown
Member

@ahukkanen can you review this one last time? Thanks!

@ahukkanen ahukkanen merged commit 326e677 into decidim:develop Jun 8, 2022
@ahukkanen ahukkanen deleted the feature/cookie-settings branch June 8, 2022 07:33
andreslucena pushed a commit that referenced this pull request Jul 6, 2022
* Replace cookie consent dialog

* Can manage cookies via modal

* Add translations and remove old route

* Update modal after accepting all or essential

* Refactor javascript

* Update cookie name

* Trigger text/plain scripts

* Disable iframes when cookies rejected

* Add tests and fix accessability issues

* Add and fix tests

* Fix dialog

* Add changelog and fix js-cookie dependency

* Fix i18n and lint errors

* Add role attributes to html

* Remove old test

* Add more logic to select_cookies

* Copy packa-lock.json to design app

* Accept essential cookies before system tests

* Fix css stylelint offenses

* Update failing tests

* Update failing tests vol2

* Comment broken seed

* Fix conflicting selectors

We used .ql-editor selector to find content inside editor (while editing), but decidim_sanitize_editor
added same class (ql-editor) when we are rendering content with editor.

* Dont continue javascript logic if modal missing

* Suggested css changes

* Revert seed

* Remove locals prefix

* Fix live meetings without cookies

* Add config for cookies

* Fix dialog mobile view

* Update tests

* normalize locales

* Add max height to disabled iframe

* Add organization variable so it sets cookie

* Prevent cookie dialog in social share tests

* Add test for cookie details

* Update changelog

* Update css for medium size screens

* Prevent search engines from indexing modals

* Clean copy paste code

* Update changelog

* Change cookie variable names

* Fix iframe disabled param

* Fix cookieName variable

* Reduce amount of custom css in dialog

* Css changes

* Make category descriptions easier to open

* i18n Essential only -> Accept only essential

* Change term in tests also

* Change cookie consent to data consent

* Change variable name

* Update file name in test

* Update cell name

* Add cookies documentation

* Update cookies documentation

* Remove colon

* Use antora docs formatting for the list

* Add session cookie and update documentation

* Tell robots not to care about the dialog
eliegaboriau pushed a commit to eliegaboriau/decidim that referenced this pull request Oct 25, 2022
* Replace cookie consent dialog

* Can manage cookies via modal

* Add translations and remove old route

* Update modal after accepting all or essential

* Refactor javascript

* Update cookie name

* Trigger text/plain scripts

* Disable iframes when cookies rejected

* Add tests and fix accessability issues

* Add and fix tests

* Fix dialog

* Add changelog and fix js-cookie dependency

* Fix i18n and lint errors

* Add role attributes to html

* Remove old test

* Add more logic to select_cookies

* Copy packa-lock.json to design app

* Accept essential cookies before system tests

* Fix css stylelint offenses

* Update failing tests

* Update failing tests vol2

* Comment broken seed

* Fix conflicting selectors

We used .ql-editor selector to find content inside editor (while editing), but decidim_sanitize_editor
added same class (ql-editor) when we are rendering content with editor.

* Dont continue javascript logic if modal missing

* Suggested css changes

* Revert seed

* Remove locals prefix

* Fix live meetings without cookies

* Add config for cookies

* Fix dialog mobile view

* Update tests

* normalize locales

* Add max height to disabled iframe

* Add organization variable so it sets cookie

* Prevent cookie dialog in social share tests

* Add test for cookie details

* Update changelog

* Update css for medium size screens

* Prevent search engines from indexing modals

* Clean copy paste code

* Update changelog

* Change cookie variable names

* Fix iframe disabled param

* Fix cookieName variable

* Reduce amount of custom css in dialog

* Css changes

* Make category descriptions easier to open

* i18n Essential only -> Accept only essential

* Change term in tests also

* Change cookie consent to data consent

* Change variable name

* Update file name in test

* Update cell name

* Add cookies documentation

* Update cookies documentation

* Remove colon

* Use antora docs formatting for the list

* Add session cookie and update documentation

* Tell robots not to care about the dialog
@alecslupu alecslupu added this to the 0.27.0 milestone Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: core project: GDPR Barcelona City Council contract

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cookie policy: accept and reject

5 participants