Skip to content

Instantly share code, notes, and snippets.

@simbo
Last active February 12, 2021 19:10
Show Gist options
  • Save simbo/e28f8be050c0fc411f80256a43d604ea to your computer and use it in GitHub Desktop.
Save simbo/e28f8be050c0fc411f80256a43d604ea to your computer and use it in GitHub Desktop.
Setup Matomo on Uberspace with GDPR Compliance

Setup Matomo on Uberspace with GDPR Compliance

About

These are my setup notes for my personal Matomo installation on my Uberspace at analytics.simbo.de.

I just wanted some statistics to get an idea of what's up on my private web projects while respecting the privacy of my visitors. Regarding this simple goal, this whole approach seems a bit over the top but likewise necessary.

Setup

Support and enforce HTTPS

Make sure the domain of your Matomo installation supports and enforces HTTPS.

Install Matomo

TL;DR

Place the extracted files in the respective docroot and open the URL to click through the installation process. Afterwards, login and customize your settings.

Geolocation Settings

TL;DR

Enable GeoIP 2 (php) - installer and options at Settings > Geolocation

  • Location Database URL:
    https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz

  • ISP Database URL:
    http://geolite.maxmind.com/download/geoip/database/GeoLite2-ASN.tar.gz

GDPR Compliance Settings

TL;DR

Offer clearly visible and transparent informations about your tracking, how visitors can avoid it and how you handle personal data of your visitors.

Checklist for not processing any personal data at all:
  • anonymize IP adresses by at least 2 bytes (192.168.xxx.xxx)

  • use anonymized IP adresses for data enriching like geolocation

  • anonymize user and order IDs (if the website uses them after all)

  • let users opt-out of tracking

  • support do-not-track preference

If you are instead processing personal data, there are further steps to take. Like offering your visitors access to their personal data and the possibility to delete it.

Disabling Cookies

TL;DR

In your website code, call disableCookies before trackPageView:

_paq.push(['disableCookies']);
_paq.push(['trackPageView']);

Setup Cron to automatically archive Reports

Regulary archived reports allow automated deletion of daily logs. Also, with reliable archives, archiving on browser view can be deactivated to allow faster responses for our matomo website.

Run crontab -e to edit your crontab.

23 * * * * /var/www/virtual/simbo/analytics.simbo.de/console core:archive --url=https://analytics.simbo.de/ > /home/simbo/matomo-archive.log

This will run every hour at minute 23. Set path, URL and logfile according to your environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment