Cookie consent banners are present in sites compliant with data protection / GDPR regulation. While it's possible to implement this banner in multiple ways with Liferay (custom widget plugin, custom theme, fragments), there is no out-of-the-box solution. This story aims to provide a first ready-for-use simple cookie consent banner.
The approach uses fragments, due to these benefits:
- Contributed fragments support auto-progapation of changes, so any fix/update in the banner will be applied automatically
- Fragments provide out-of-the-box style and configuration UI
- Fragments support out-of-the-box content internationalization
- Combined with master-pages, it's possible to display this banner only in a selected group of pages (e.g. only public pages)
Given a page/master page, I can add a cookie consent banner to my page, and select if it's position fixed on top or bottom. When I'm editing, the fix position is not applied, and if I click the Accept button, the banner is still shown.
Given a page with the cookie banner, I see the banner in the configured position until I click the button. When I come back to the page, the banner is no longer shown (unless local storage is removed or an incognito session is started).