简体   繁体   中英

How to load Motomo faster with Drupal?

I have a site with Drupal 8

I also have another second server with another domain name for Matomo audience analysis.

My Drupal 8 site is slow to load. How does the following advice apply with Drupal 8 ? It is a LAMP server.

Preload DNS Often a Matomo (Piwik) is hosted on a different domain and when the browser loads the JavaScript tracker file, it needs to first perform a DNS lookup to find the IP address for this domain. By adding the below snipped for your Matomo domain, it can boost the performance of loading the tracker file by 10ms to 50ms.

 <link rel="dns-prefetch" href="//example.innocraft.cloud"> 

enter image description here

You can try adding a dns-prefetch and it should work and speed up the DNS query a bit (but keep in mind that this is only a tiny fraction of the 1.8s).

For this just add the HTML tag as high up in the HTML of the site as possible (so somewhere in the <head> )

<link rel="dns-prefetch" href="http://analytics.yourdomain.example">

Also keep in mind that while your Matomo loads quite slow, this shouldn't slow down your website as Matomo only inizialises after the page has finished loading and is usable by the visitor. (so the green and blue lines in you image)

You can look at https://matomo.org/docs/optimize-how-to/ for more tips on how to optimize Matomo to be faster. (eg a newer PHP version, a SSD for the database, more RAM for the database, enabling opcache, etc.)

You could also take a look at this plugin: https://plugins.matomo.org/QueuedTracking

It dumps the raw visitor data directly into a MySQL or Redis Table (which can bring the request down to 30ms) and then when the queue is X entries long, it asynchronously runs Matomo on everything in the queue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM