Skip to content

About

A module adding an Analytics tab in the admin panel to embed a Matomo dashboard.

Resources

Stars

5 stars

Watchers

4 watching

Forks

Repository files navigation

Decidim::Analytics

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

Preview of the module

Usage

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.

Installation

  1. Add this line to your application's Gemfile:
gem "decidim-analytics", git: "https://github.com/digidemlab/decidim-module-analytics"

And then execute:

bundle
  1. 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.

  1. Don't forget to set the environment variables.

Contributing

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.

License

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

About

A module adding an Analytics tab in the admin panel to embed a Matomo dashboard.

Resources

Stars

5 stars

Watchers

4 watching

Forks

Releases

Packages

Contributors

Languages