It depends on how fast your Matomo server is. Keep in mind that this shouldn’t slow down your website as it is loaded asynchronously and deferred, so only after the user can interact with the website.
If this is still bugging you and you want to get it down to <30ms you can take a look at the Queued Tracking - Matomo Plugins Marketplace plugin. It makes the piwik.php only store the raw request in MySQL or Redis (which is faster) and then asynchronously handles the requests once the query is longer than x.
360ms is definitely to long, a normal pageview should maybe take 20-60ms depending on your server. Are you sending more than the default parameters with your tracking script?
I give Matomo second chance today. Response of piwik.php is still 300ms. I don’t have redis in the server. But I have memcached PECL module. Everything in my server is working blazing fast except piwik.php file.
Features of my server;
Nginx
PHP7.2-FPM
MariaDB
Memcached
My question is that, If I set a special cache rule for the piwik.php on Cloudflare, it helps me to reduce response time?
You don’t need redis, you can also use the MySQL database for queued tracking.
Yes, it will strongly reduce the response time as the data will stop ending up in Matomo, but just be sent to cloudflare. So you would stop recording the user page views as they never reach Matomo.
Same here. Matomo’s php script is awfully slow. I test it often at GTmetrix and others, and it has always around 1.3 secondsor more of delay. It is simply too much to slow down the landing page by almost 1.5 second.
@Lukas@fdellwing@ViKol@Pak_Kriss Actually when I first created this thread, I was very beginner about web optimization. Now, I realized that, Google doesn’t care about when your page will completely be loaded. Instead, Google cares about “First contentful paint”, “Index speed”, “First byte time” and etc. for better SEO. It means how fast your page is rendered. Matomo files are already deferred and very ligthweigth. So piwik.php starts loading after the page load only. It has no affect on your webpage at all. You can simply ignore piwik.php.