Using Matomo (formerly Piwik) as an Alternative to Google Analytics
Many webmasters use Google Analytics to understand how their website is accessed and used. In some cases Google Analytics is not a good fit for a website; in these cases, Matomo can be a good alternative in some situations:
- Your website is an internal Intranet site behind a firewall.
- You want information that you cannot get from Google Analytics:
- The Matomo Visitor log is enlightening for low volume sites:
- You need information on browser plugin installation to aid site design.
- You want information on how frequently search engine bots access your site.
- You want to retroactively (or actively) analyse a site using server logs.
- You don’t want Google to have access to your traffic information. This is a common issue for large businesses.
- You are big enough that you have to pay for Google Analytics, and the cost of operating your own measurement network is less expensive.
- You cannot accept Google’s Terms of Service for Google Analytics.
It is important to note that there are significant reasons to favor using Google Analytics over Matomo:
- If you comply with GA terms and conditions, Google will largely prevent you from major privacy violations with respect to analytics.
- Google Analytics is easier, since there is no installation or site maintenance.
- Google Analytics runs on their servers and does not alter your site performance.
The sections that follow describe how to install and configure Matomo on a Joomla server (WordPress is very similar), followed by a review of the major features in Matomo. The article is divided into the following sections:
- Installing Matomo
- Joomla Configuration
- Matomo Plugins
- Using Matomo
- Matomo Mobile Interface
- Plugins and the Matomo Marketplace
Prior to January, 2018, Matomo was called Piwik. The name change resolved some trademark and trademark use issues.
The Matomo installation instructions are quite good, but do not address some of the things you will need to do for external systems; these instructions are not a replacement for the standard instructions, but should be considered a supplement.
The major steps for installing Matomo are similar to to those for installing Joomla (or WordPress for that matter):
- Use cPanel to create a MySQL database and user ID
- Modify the .htaccess file to allow direct access to
- Copy the piwik.zip install file to a subdirectory on your site and unzip it
- Call install.php from browser and follow the prompts
- Configure website tracking in Matomo
- Configure Matomo plugin in Joomla (or WordPress)
Allow direct access to piwik/piwik.php in .htaccess
None of the install instructions talk about this step, and many web references will tell you that you can bypass an error in the Matomo configuration prerequisite test (see Figure 8)–you can, but Matomo won’t record any measurements. If you have Akeeba Admin Tools installed and have used it generate your .htaccess file, you will need to add
piwik.php to the direct access exceptions list, as shown in Figures 1 and 2.
In Web Hosting Manager, enable use of subdomains for piwik.yourdomain.name
Once you have modified your
.htaccess file, you will need to log in to Web Hosting Manager and/or cPanel to set up a subdomain, MySQL database, and MySQL user ID. If you plan to use a subdomain, you will need to enable this is WHM as shown in Figure 3 before creating the subdomain in cPanel as shown in Figure 4.
In cPanel, create MySQL database
The next step is to use cPanel to create the MySQL database for Matomo, as shown in Figure 5. The database can have any name, but you will need to record the name to use later during the installation process. Once you have created the database, you will need to generate a user ID for it as shown in Figure 6.
Unzip piwik.zip in a Subdirectory and Call install.php in Browser
The next step is copy the piwik installation file to a subdirectory (the one you used for the subdomain definition) and unzip it. Point your browser to the URL for
index.php and follow the dialog as shown in Figure 7. If you did not make the change to
.htaccess described earlier, you will get the error message shown in Figure 8. You can continue the install successfully, but you will not be able to get any measurement to work until you update the
When you get to the prompt for a table prefix, use a random string instead of “piwik_” as prompted by the default install. Using a random string for the table prefix makes it harder for attackers to do an SQL injection attack against your Matomo installation. The default Joomla installer does this for you, but the Matomo installer does not.
Create the Matomo super user
During the Matomo install, you will create a super user ID as shown in Figure 9. Make sure to uncheck the boxes unless you want to get marketing mailings from the company that develops Matomo.
Define a website for tracking
The last step in the install process is defining a website for tracking as shown in Figure 10. Make sure to record the site ID, as you will need this when configuring the tracking plugin on your site.
Set up Matomo settings according to privacy laws in your jurisdiction
This is an area where using Google Analytics is much easier; if you comply with the GA terms and conditions, you will probably be largely in compliance with relevant laws, since Google is a global company and wants to avoid problems. With Matomo, you will have to figure everything out on your own.
Figure 12 shows the Eorisis plugin configuration. You will need to enter the URL for the Matomo measurement server, and the site ID that you defined for this web site. For some tracking options, you will need the user or superuser API key available in the Matomo user settings.
Figure 13 shows the configuration for privacy settings; note that by default, the setting to honor do-not-track is disabled; in this screen capture it is enabled. In the Eorisis plugin, it will not insert the tracking code if do-not-track is set in the browser–you will need to remember to test using a browser that does not send the do-not-track setting.
Matomo offers a number of plugins to add function to the measurement and reporting server. Here are a few that you will almost certainly want to install:
- Provider–this provides information on the user’s ISP similar to that in Google Analytics.
- SecurityInfo–this provides a useful audit of your installation’s PHP security settings.
- BotTracker–this provides a log of when various bots visited your site, and can be useful in knowing where your webmaster tools settings are incorrect.
- TreemapVisualizer–this gives you a treemap similar to that found in Google Analytics
- ReferrerManager–this gives additional control of tracking referrers and blocking referral spam.
- IP2Location–this is an alternative to the built-in geoIP tools
- LoginLdap–for large installations, this gives you single-signon capability through LDAP
- ClickPath–this provides a behavior flow chart that is similar to the one in Google Analytics.
- UserGroups–this provides roles and user groups for larger installations.
Once you have installed Matomo, you will want to start using it. There is a great demo capability provided at the Matomo demo site. The sections that follow will help give you an idea of what Matomo can do so that you can explore the key features more thoroughly in the Matomo demo.
The Matomo dashboard shown in Figure 14 has a very concise measurement view of your web site's activity, while the Visitor Log shown in Figures 15 and 16 was probably the deciding factor in my decision to at least add Matomo and perhaps to switch to it. For small sites, the navigation path information in Matomo gives a great deal of information that Google Analytics does not.
The Matomo software log gives a lot of detail on OS and browser
The software log in Matomo gives version and plugin configuration information that Google Analytics does not. This can be useful in both website design and in determining testing configurations for other software that you may develop.
The Matomo engagement report is a concise summary
The Engagement Report is a concise summary of user engagement with your site as measured by the time they spend during a session, the number of times they come back, and the number of actions that they take while visiting your site.
The Matomo visit time report is great look at time-of-day analysis for a web site
The Visit Time report gives a great look at when people visit your site both from the perspective of their local time, and the perspective of the server. The local time report is useful comparing behavior across time zones, while the server time report is useful for planning service and maintenance outages.
The Matomo Pages report has page generation time information that is very useful
One of the most useful items in the Matomo Page Report is the page generation time–something that is not reliably available in Google Analytics–at least for my site. The page generation time can help you figure out the cause for performance problems and how to go about allocating time to address them.
The Matomo outlinks report is a very helpful summary of what links people use
The Outlinks report shown in Figure 21 shows the outbound links that were used across your site; this is invaluable in figuring out what links and link text users find helpful and what links the do not find helpful.
The Matomo downloads report shows which files people download
The Downloads Report shown in Figure 22 shows what files were downloaded; this is another way to identify the types of files that visitors find useful and link text that works in identifying useful files.
The Matomo referrer overview gives a good look at how traffic originates
The referrer overview, referrer detail and search engine reports shown in Figures 23, 24 and 25 give useful information on how visitors got to your site. They are very different from Google Analytics, in that they treat all of the search engines equally and can give a better picture of search, social media and link paths to your site.
The Matomo website/social network report gives a good look at social media effectiveness
The Website/Social Network Report shows what links on other sites are sending traffic to you, and is a good gauge of your social media effectiveness.
Matomo Mobile Interface
Matomo has a cell phone app as well, with most of the same reporting functionality as the web version, but very little of the configuration capabilities.
Plugins and the Matomo Marketplace
Matomo has a number of plugins to add functionality. These are installed from the Matomo Marketplace as shown in Figure 32. Plugins must be activated as shown in Figure 33.
The security plugin (Settings->Diagnostic) looks a PHP and other settings
The security plugin shown in Figure 34 gives recommendations on changing PHP settings to improve security for your Matomo installation.
The optional GeoLocation database gives much better location accuracy than browser language
Most Matomo users will want to enable one of the IP-based geolocation modules. The easiest approach is to download from the databases at the bottom of the Geolocation panel as shown in Figures 35 and 36. You will need to choose which of the GeoIPLite free databases or GeoIP paid databases to use.
The bandwidth plugin requires modified tracking code or tracking by log import
The bandwidth plugin provides a function that I have not found in Google Analytics, but using this plugin requires that you modify the tracking code to pass a bandwidth use parameter. For most users, this is not feasible. Figure 37 shows the bandwidth plugin instructions.
The BotTracker plugin gives you information about when bots scan (or don't) your site
The BotTracker plugin is also a function not found in Google Analytics. This plugin is useful for finding out which search engines are indexing your site and which are not. Figure 38 shows the configuration panel, while Figure 39 shows the report panel, and shows that Bing is not indexing this site regularly.
After working with Matomo for a week, it has a number of features that provide information that Google Analytics does not–and clearly lacks the demographic and ad integration features that Google Analytics supports. For some sites it could be a replacement while for others it may make sense as an additional analytics measurement tool.