This module does two things:
- it enables tracking through Matomo
- it adds a tab in the admin panel showing one Matomo dashboard (or more) of your choice
You will of course need to have Matomo running on a server or the cloud version (untested).
The module doesn't have any settings panel as I don't want to write anything in the database. It will pick the data it needs from your environment variables.
# The plugin enables when MATOMO_SERVER_ADDRESS is set
MATOMO_SERVER_ADDRESS=https://matomo.example.org/
MATOMO_SITE_ID=1
MATOMO_TOKEN_AUTH=6a710da82ecb933866507c14bdb99351
MATOMO_VIEWER_ADDRESS=https://matomo.example.org/
At Digidem Lab, we actually set the site ID dynamically when deploying through Ansible. Don't hesitate to have a look!
Follow these instructions
to get token_auth from Matomo.
The dashboard that will be shown on page load is using the default layout you set for all new dashboard. You can create several other dashboards for the user and you will be able to switch between them from Decidim.
- Add this line to your application's Gemfile:
gem "decidim-analytics", git: "https://github.com/digidemlab/decidim-module-analytics"And then execute:
bundle- To enable tracking, you will need to add the following line in the file
app/views/layouts/decidim/_head_extra.html.erb:
<%= render partial: "layouts/decidim/matomo" %>
You can use this module without the provided tracking snippet and write your own, just skip the above step.
- Don't forget to set the environment variables.
Create an issue or a PR if you want to suggest an improvement. Keep in mind I'd like to keep this module lightweight and simple to maintain.
This module is distributed under the GNU AFFERO GENERAL PUBLIC LICENSE.
