matomo | Cheatsheet¶
Matomo, formerly Piwik, is the most common free and open source web analytics application to track online visits to one or more websites and display reports on these visits for analysis.
Requirements¶
Installation¶
wget https://builds.matomo.org/matomo-latest.zip -P /var/www/
cd /var/www
unzip matomo-latest.zip
rm matomo-latest.zip How\ to\ install\ Matomo.html
chown -R apache:apache /var/www/matomo
find /var/www/matomo/tmp -type f -exec chmod 644 {} \;
find /var/www/matomo/tmp -type d -exec chmod 755 {} \;
find /var/www/matomo/tmp/assets/ -type f -exec chmod 644 {} \;
find /var/www/matomo/tmp/assets/ -type d -exec chmod 755 {} \;
find /var/www/matomo/tmp/cache/ -type f -exec chmod 644 {} \;
find /var/www/matomo/tmp/cache/ -type d -exec chmod 755 {} \;
find /var/www/matomo/tmp/logs/ -type f -exec chmod 644 {} \;
find /var/www/matomo/tmp/logs/ -type d -exec chmod 755 {} \;
find /var/www/matomo/tmp/tcpdf/ -type f -exec chmod 644 {} \;
find /var/www/matomo/tmp/tcpdf/ -type d -exec chmod 755 {} \;
find /var/www/matomo/tmp/templates_c -type f -exec chmod 644 {} \;
find /var/www/matomo/tmp/templates_c -type d -exec chmod 755 {} \;
Mysql¶
This is just examples, don't use root or your real name for security reasons
create database matomo;
CREATE USER 'root'@'%' IDENTIFIED BY 'password';
GRANT PRIVILEGE ON *.** TO 'wuseman'@'%';
GRANT ALL PRIVILEGES ON *.* TO 'wuseman'@'%';
FLUSH PRIVILEGES;
quit;
Configure subdomain¶
cat<< EOF > /etc/apache2/vhosts.d/stats.nr1.nu.conf
<VirtualHost *:80>
ServerAdmin wusema@nr1.nu
ServerName stats.nr1.nu
DocumentRoot /var/www/matomo/
<Directory /var/www/matomo>
DirectoryIndex index.php
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Files "console">
Options None
Require all denied
</Files>
<Directory /var/www/matomo/misc/user>
Options None
Require all granted
</Directory>
<Directory /var/www/matomo/misc>
Options None
Require all denied
</Directory>
<Directory /var/www/matomo/vendor>
Options None
Require all denied
</Directory>
ErrorLog /var/log/apache2/stats.nr1.nu_matomo_error.log
CustomLog /var/log/apache2/stats.nr1.nu_matomo_access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =stats.nr1.nu [OR]
RewriteCond %{SERVER_NAME} =stats.nr1.nu
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
EOF
Archive the Reports (default)¶
Archive the Reports (not default)¶
cat <<! > /etc/cron.d/matomo-archive
MAILTO="youremail@example.com"
5 * * * * www-data /usr/bin/php /var/www/matomo/console core:archive --url=http://example.org/matomo/ > /home/example/matomo-archive.log
!
Create Signed SSL Certificates¶
After following install Matomo, browse to: http://localhost/matomo
Configure Matomo via console¶
List available plugins¶
Core update¶
Disable two-factor authentication for a user.¶
- Useful if a user loses the device that was used for two-factor authentication. After it was disabled, the user will be able to set it up again