J4.x

J4.x:Cookie Warning Tutorial

From Joomla! Documentation

Revision as of 13:01, 27 October 2022 by Richard123 (talk | contribs) (Created page with "This page is under construction. Please do not modify until this line is removed. In some countries, there are legal requirements to issue a warning on websites when cookies...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This page is under construction. Please do not modify until this line is removed.

In some countries, there are legal requirements to issue a warning on websites when cookies are created.

Joomla automatically creates such cookies to track the session of visitors. Therefore, it is necessary to provide appropriate notices.

A simple option is to install one of the many extensions that offer to present such a warning.

Unfortunately, this simple option hides certain risks.

  • What exactly is being installed?
  • How to remove the extension if it does not suit?
  • Is there an uninstall function and is it complete or does it leave residues that affect the system?
  • Does the extension even do something else that is not wanted?

All these risks do not exist if you create your own cookie warning. Moreover, you have full control and learn a lot about Joomla, HTML, CSS and JavaScript.

This tutorial assumes that Joomla version 4 is installed and the administrator has a rough overview of the administration interface Atum. (This is the default interface)

Even though there are not so many differences in the procedure, this tutorial assumes that no extensions are installed.

Presumably there is already a main menu and a few articles. (In a very fresh test installation the sample data could be installed).

Beginners don't have to worry, everything that is created can be deactivated and also deleted with a few mouse clicks.

So no more foreplay, let's get started.

Create a Site Module for the warning message

In administrator interface click Contents and besides Site Modules click the + sign. Or click Site Modules and then click New. This starts creation of a new module.

  • Click Custom
  • Enter a Module Title (for Example: Cookie Warning)
  • In the editor field write a message. Let's start with: By using this site you accept cookies! (We are going to enhance this later)
  • Flip the switch Title to Hide
  • Select the Position main-top (That would be right under the page header before the content)
  • Select to publish the warning. (If later anything gets messed up, just unpublish the module)
  • Leave everything else in it's default settings and click Save & Close at the top of the page

That's it. We have our warning. After opening the site view of the Joomla Website in a new browser window the warning should be displayed.