Skip to content

OpenSourcePolitics/decidim-module_cookies

Repository files navigation

cookies_banner-02

Decidim::Cookies

This module provide a cookies banner using Orejime (https://github.com/empreinte-digitale/orejime).

Usage

The banner is visible on every page except the administrators section.

This banner allows to accept all cookies, or refuse all cookies, or choose the cookies wanted or not. Furthermore, a description is configurable to explain each cookies and the purpose.

Installation

Add this line to your application's Gemfile:

gem "decidim-cookies", git: "https://github.com/OpenSourcePolitics/decidim-module_cookies.git"

And then execute:

bundle install

More informations

By default, the decidim's required cookies are enabled (cf: Javascript configuration file)

  • decidim-cc
  • _decidim_session

An optional cookie is defined by default in the engine configuration file

  • matomo

Add new cookies to the banner

You can add specific cookies to the banner using initializers. Cookies list is fetched from Rails.application.config.cookies.

Example of cookie in initializer :

Rails.application.config.cookies = [
  {
      name: "matomo",
      title: "Matomo",
      cookies: %w(matomo_session pk_id pk_ses _pk_ref _pk_cvar),
      purposes: %w(tracking analytics)
  }
]

When you add new cookie, you have to provide translation for language activated on platform

  1. Add your translations in respective locales files
  2. Add those new translations to the Orejime banner configuration (Configuration has to be outside the JS file because of assets precompilation)

Repeat this process if you create new purpose

List of cookies used by Decidim

Cookies by default on Decidim application

Name Description Required
decidim-cc Allows to check if the user has accepted the cookies [x]
_decidim_session Allows to keep the user session active for a limited time [x]

Non exhaustive list of cookies you may encounter in a Decidim instance. Those cookies are not by default in Decidim applications.

Name Description Required Documentation
JSESSIONID The JSESSIONID cookie is used to store a session identifier so that New Relic can monitor session counts for an application. [ ] Link
Matomo Allows to track to improve user experience [ ] Link
Google Analytics Allows to track to improve user experience [ ] Link

Bugs ?

Please check the known issues file

Contributing

See Decidim.

License

This engine is distributed under the GNU AFFERO GENERAL PUBLIC LICENSE.

About

Decidim external module to let users choose what cookies they allow

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5