ckanext-matomo-dsgvo
Table of Contents
- Overview
- Requirements
- Installation
- Configuration
- Additional Languages
- Support
- Credits
- Author and License
Overview
This extension integrates the tracking snippet of the web analytics tool Matomo into your CKAN portal,
and adds a cookie banner that allows website users to give or decline their consent for Matomo tracking.
The cookie banner is an open-source cookie-consent solution by orestbida.
Figure 1: Cookie Banner
Figure 2: Cookie Banner Options
Requirements
The extension was created for CKAN 2.10.0 and tested with CKAN 2.9.8.
The cookie-consent version 2.9 from Orestbida is used.
Installation
The installation instructions assume an Ubuntu operating system and can be executed directly in the console.
If a different operating system or CKAN setup is used, the instructions must be adjusted accordingly.
The extension is delivered as a ZIP file.
Unpack the ZIP file into the source directory of the CKAN website:
# e.g., in /usr/lib/ckan/default/src
unzip ckanext-matomo-dsgvo.zip -d /usr/lib/ckan/default/src
# or in /srv/app/src
unzip ckanext-matomo-dsgvo.zip -d /srv/app/src
Activate the CKAN virtual environment:
# e.g.:
. /usr/lib/ckan/default/bin/activate
Install the extension in the virtual environment:
$ pip install ckanext-matomo-dsgvo/.
Add the extension to the plugin list in the CKAN configuration file ckan.ini.
By default, it is located at /etc/ckan/default/ckan.ini:
# Plugins
ckan.plugins = ... matomo_dsgvo
The plugin is now installed.
The Configuration section describes how to set custom options such as Matomo Site ID and URL.
Configuration
Configure the extension in ckan.ini.
Add the following variables with their corresponding values to the [app:main] section:
# Matomo Site ID
matomo_dsgvo.site_id = <matomo-site-id>
# Matomo URL
matomo_dsgvo.matomo_url = <matomo-url>
# Privacy URL of the website, e.g.:
matomo_dsgvo.privacy_url = /pages/privacy
# Contact URL of the website, e.g.:
matomo_dsgvo.contact_url = /pages/contact
If an opt-out function for Matomo should be included on the privacy page,
HTML usage in CKAN pages must be allowed.
For this, locate and adjust the following setting in ckan.ini:
# Allow HTML IFRAME
ckanext.pages.allow_html = True
Then include the Matomo Opt-Out IFRAME on the privacy page, e.g.:
<iframe style="border: 0; height: 200px; width: 600px;"
src="{Matomo-URL}/index.php?module=CoreAdminHome&action=optOut&idsite=4&language=de">
</iframe>
Finally, restart CKAN to complete installation and configuration:
# For host installation
$ supervisorctl restart ckan-uwsgi
# For Docker installation
$ docker restart ckan
There is an option to reopen the cookie banner after closing.
Simply insert the following code at the desired location:
<button type="button" aria-label="View cookie settings" data-cc="c-settings">Cookie Settings</button>
Additional Languages
Currently, the extension is offered in the following languages:
If the required language for your website is not listed,
you can send a translation suggestion to info@ondics.de.
Support
For questions about the extension or to report a bug,
please send an email to info@ondics.de.
If you have general CKAN issues, contact the official CKAN support.
More information can be found in the official CKAN repository on GitHub.
Credits
The ckanext-matomo-dsgvo extension was made possible by:
- orestbida: Integrated open-source cookie-consent solution
- CKAN: Open-source data portal
Author and License
Not open source, all rights reserved
(C) 2023, Ondics GmbH