Solving the Missing Graphs and Icons Issue in Matomo: GD & Freetype to the Rescue

Recently, while setting up Matomo on my server, I encountered an issue where several icons and graphs were broken or not displaying at all. At first, I thought it was related to file permissions or missing assets, but after digging deeper, I realized that the problem was more technical and related to the GD and Freetype libraries, which Matomo relies on to generate graphical elements.


Broken Icons and Missing Graphs

Upon inspecting the Matomo dashboard, I noticed that several small icons and graphs (like the sparkline graphs) were either not rendering or appeared as broken images. Initially, I suspected that it could be a file permission issue or perhaps some missing assets in the installation, but after verifying file permissions and caching, the problem persisted.

By enabling my F12 browser’s developer console, I saw that all requests to the images were returning a 200 status, meaning the images were being served, but they were still broken.


Root Cause

During the Matomo system check, I found the following warning:

GD > 2.x + Freetype (graphic functionality) missing.
Mini graphs (sparklines) and images in Matomo mobile app and email reports will not display!

That was the clue I needed. Matomo relies on the GD library with Freetype support to generate graphs and other images dynamically. Without these libraries, Matomo can’t render the small graphs (e.g., sparklines) and other image-based elements.


The Solution

To resolve this, I needed to install and enable the GD and Freetype libraries for PHP. Here’s how I did it on my Ubuntu server:

1. Install GD with Freetype support

First, I updated the package list and installed the php-gd package, which includes Freetype support:

   sudo apt update
   sudo apt install php-gd

2. Restart Apache

After installation, I restarted Apache to ensure the changes took effect:

   sudo systemctl restart apache2

3. Check Matomo System Report

After verifying the installation, I returned to Matomo’s system check page. The warning about GD and Freetype was gone, and all my broken icons and graphs started displaying correctly!


Conclusion

If you encounter broken icons or missing graphs in your Matomo installation, check the system report for missing libraries like GD and Freetype. These libraries are essential for rendering graphical elements within Matomo. Once installed, your graphs, icons, and images in reports should work as expected.

In case you’re using a different OS or server environment, the installation process might vary slightly, but the core solution remains the same: ensure GD and Freetype are installed and properly configured.

Happy analytics!