Phase 2, week 3. Who's there?
This week's goal for Zodiac Zingers, as I mentioned in my previous post, was to install visitors statistics/analytics tool.
10 years ago, I would choose Google analytics without having a second thought. These days are long gone.
First, as it (unfortunately) happens to some other Google products, you don't expect the new version to be an improvement anymore. Instead, you hope the new version to be not worse than the previous one. And this hope not always comes true.
Second, having in mind user privacy and consent, it is more convenient to self-host the analytics and avoid transferring any user data to the third parties.
Third, the central idea of #ZodiacZingers challenge was to try as many new things as possible.
I was looking for a free, self-hosted web analytics tool, that has some consent management, preferably installable as a Drupal module.
Welcome to Matomo (previously Piwik),
Google Analytics alternative that protects your data and your customers' privacy
(I wish all the sites have their purpose stated that clear)
Matomo has an accompanying Drupal module and a whole ecosystem of modules extending its functionality. There are 2 versions: hosted and on premise (self-hosted), and we will use the second one. That should be straightforward, using official Docker image.
The quicker path would be to define one-off additional service in ddev configuration, but I decided to create a ddev plugin, to make it easier for the people who'd like to try self-hosted Matomo with their ddev projects.
Writing a ddev plugin was an interesting experience that deserves its own blog post (maybe some day!), but for now, let's jump to the part where the plugin can be downloaded from https://github.com/valthebald/ddev-matomo with
ddev add-on get valthebald/ddev-matomo
(maybe one day it becomes stable enough and I dare ask Randy Fay to include it to the list of officially supported ddev plugins)
The installation itself was straightforward, so I enabled Matomo module in Drupal, pointed it to the new service (https://matomo.zodiaczingers.ddev.site locally) and Website ID 1 and visited the home page as anonymous user.
领英推荐
Hm. There are some cookies that I haven't agreed to be set. This is not good.
Luckily, Matomo takes user consent seriously, and there is a documentation page on how to configure the tool with different consent managers.
It was good to see Klaro among supported consent managers, as it's likely to become recommended way to manage user consent in the upcoming Drupal CMS. Even better, it is possible to configure Matomo to not use cookies at all, which I did until I figure things with Klaro:
Now, let's see what happens in Matomo dashboard. I've visited the site from different devices on my household, using landline and mobile connections, but all of them are suddenly detected as coming from the US. What's that?
After some digging on the Matomo website (great resource and vibrant community!) I found that the issue comes from missing geoip database:
and the fix was suggested by configuration page itself.
Now, I have the database, and see visitors from the US, China and Bulgaria (finally :) ) Another goal accomplished.
The goal for this week? Make it possible to move the whole series of blog posts to the site itself. Let's see how that goes. Stay tuned!
Independent Solution Engineer | Drupal and WordPress Developer | Symfony, Laravel, Vanilla PHP | React, Vanilla JS | Tailwind CSS | StoryBook
3 个月yeah, many years ago we set Piwik, because the client objected to pass any information and statistics to 3rd party. At that time I thought that it was paranoia, but now I can see that he was a visioner. The existing news is that we now have Drupal integration!