Queued tracking explained within Matomo Analytics
This content has been drafted thanks to the great help of Lukas Winkler.
Dealing with a Matomo means dealing with issues when a lot of traffic is coming as you are the one in charge of maintaining the server. In order to deal with this traffic one way could be to use a plugin named Queued Tracking. Typically this plugin will
ensure you that Matomo will still collect visitor traffic if a peak is coming.
What is the Queued Tracking plugin?
The basic idea is the following, each visitor will send a PHP request to your server for each interaction she/he will perform, if you have a lot of traffic, that's a lot to handle, it is like opening a thousands of tabs within your browser... at some point your browser collapse, same thing with a server, so in order to avoid your server to collapse, the queued tracking is storing the request of the visitor in order for your server to breathe a little bit.
After a condition set(depending of the number of requests to send) this database will be call in order to reinject the requests.
How to set this plugin?
This plugin is really simple to set, all you need to do is to indicate what are your preferences, either MySQL nor Redis. Redis is better in terms of performances, though going for MySQL will avoid you to install Redis so it is quick fast food fix if you are in a hurry.
What should I expect in terms of performances?
I cannot really say what are the consequences on a website with a lot of traffic but it is dividing right away the loading time of the PHP request by about two.
How to read the binary value stored by MySQL?
You will need zlib in order to convert it within an understandable format:
zlib-flate -uncompress < matomo_queuedracking_list_trackingQueueV1-list_value.bin | jq
How to use Redis as a database server?
First, you need to have Redis on your server:
sudo apt install redis-server
Then, you need PHP to support it, so perform:
sudo apt install php-redis
then restart your server with:
sudo service apache2 restart
You can perform:
sudo -u www-data php7.2 /var/www/html/mat311/matomo/console queuedtracking:process
to see the evolution of the request.
To know more about this plugin, have a look at https://plugins.matomo.org/QueuedTracking#faq.