Home

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:

Prior to January, 2018, Matomo was called Piwik. The name change resolved some trademark and trademark use issues.

Installing Matomo

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 piwik.php
  • 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.

Figure 1. Use the Akeeba Admin Tools .htaccess Generator
Figure 2. Allow direct access to piwik/piwik.php in .htaccess

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.

Figure 3. To use a subdomain, you must first enable “Allow users to park subdomains of the server’s hostname.”
To use a subdomain, you must first enable Allow users to park subdomains of the server's hostname.
Figure 4. To use a subdomain, you must define it in cPanel.
To use a subdomain, you must define it in cPanel

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.

Figure 5. Create a MySQL database for Matomo using cPanel
Create a MySQL database for Matomo using cPanel
Figure 6. Create a MySQL user ID for Matomo
Create a MySQL user ID for Matomo

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 .htaccess file.

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.

Figure 7. The first panel in the Matomo installation dialog.
The first panel in the Matomo installation dialog
Figure 8. If you .htaccess file blocks direct access to piwik.php, you will get this message.
If you .htaccess file blocks direct access to piwik.php, you will get this message

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.

Figure 9. Creating the Matomo Superuser and choosing marketing mailing options.
Creating the Matomo Superuser and choosing marketing mailing options

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.

Figure 10. Defining a website to be tracked by Matomo.
Defining a website to be tracked by Matomo

Set up Matomo settings according to privacy laws in your jurisdiction

The last required step on the Matomo side of configuration is to set the privacy options that you want to use. Note that the default setting is not to honor do-not-track browser settings; Google Analytics does not honor this, but instead requires that you install a browser add-in. You will need to include instructions on how to opt out of tracking in your privacy policy, and you will need to set the IP anonymizer settings for your jurisdiction. A discussion of the relevant laws is far beyond the scope of this article.

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 11. Configuring privacy settings in Matomo
Configuring privacy settings in Matomo

Joomla Configuration

Once you have installed and configured the Matomo, side you will need to configure tracking within your Joomla (or WordPress) site. There are several plugins for Joomla, but Eorisis Matomo Plugin for Joomla is probably the most full-featured. It has the advantage of omitting tracking code when the user’s browser is set to do-not-track, which makes implementing the privacy policy easier.

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.

Figure 12. Setting up the link to the Matomo measurement server in the Eorisis Matomo plugin.
Setting up the link to the Matomo measurement server in the Eorisis Matomo plugin
Figure 13. Configuring privacy settings in the Eorisis Matomo plugin.
Configuring privacy settings in the Eorisis Matomo plugin

Matomo Plugins

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:

  • Free
    • 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
  • Paid
    • 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.

Using Matomo

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.

Figure 14. The Matomo dashboard has concise basic measurement information.
The Matomo dashboard has concise basic measurement information
Figure 15. The Matomo Visitor Log gives very useful site navigation path information for small sites
The Matomo Visitor Log gives very useful site navigation path information for small sites
Figure 16. The Matomo Visitor Log gives detailed site navigation path information
The Matomo Visitor Log gives detailed site navigation path information

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.

Figure 17. The Matomo Software Log gives detailed operating system version, browser version and browser plugin information.
The Matomo Software Log gives detailed operating system version, browser version and browser plugin information

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.

Figure 18. The Matomo Engagement Report is a concise view of the frequency of visit, length of visit and complexity of action that your users demonstrate when accessing your site.
The Matomo Engagement Report is a concise view of the frequency of visit, length of visit and complexity of action that your users demonstrate when accessing 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.

Figure 19. The Matomo Time Report gives both a user-local time zone and a server time zone perspective.
The Matomo Time Report gives both a user-local time zone and a server time zone perspective

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.

Figure 20. The Matomo Pages report contains page generation times that are useful in identifying performance problems.
The Matomo Pages report contains page generation times that are useful in identifying performance problems

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.

Figure 21. The Matomo Outlinks Report is helpful in identifying what links and link text works well for your users and what does not.
The Matomo Outlinks Report is helpful in identifying what links and link text works well for your users and what does not

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.

Figure 22. The Downloads report shows which files were downloaded and is useful in analyzing the files and file links that work well.
The Downloads report shows which files were downloaded and is useful in analyzing the files and file links that work well

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.

Figure 23. The Matomo referrer overview gives basic information on referrals to your site.
The Matomo referrer overview gives basic information on referrals to your site
Figure 24. The Matomo referrer detail report gives summary and detail information by referrer type.
The Matomo referrer detail report gives summary and detail information by referrer type
Figure 25. The Matomo Search Engine report treats all search engines equally.
The Matomo Search Engine report treats all search engines equally

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.

Figure 26. The Website/Social Media Report shows what sites are sending you traffic.
The Website/Social Media Report shows what sites are sending you traffic

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.

Figure 27. The Matomo mobile settings page lets you choose the site and date range to display.
The Matomo mobile settings page lets you choose the site and date range to display
Figure 28. The Matomo mobile app has much the same visitor information as the web version, but requires scrolling for each visit.
The Matomo mobile app has much the same visitor information as the web version, but requires scrolling for each visit
Figure 29. The Matomo mobile app has much the same visitor information as the web version, but requires scrolling for each visit.
The Matomo mobile app has much the same visitor information as the web version, but requires scrolling for each visit.
Figure 30. The Matomo mobile app has much the same visitor information as the web version, but requires scrolling for each visit.
The Matomo mobile app has much the same visitor information as the web version, but requires scrolling for each visit.
Figure 31. The Matomo mobile app has much the same visitor information as the web version, but requires scrolling for each visit.
The Matomo mobile app has much the same visitor information as the web version, but requires scrolling for each visit.

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.

Figure 32. The Matomo Marketplace contains numberous plugins to add functionality to Matomo.
The Matomo Marketplace contains numberous plugins to add functionality to Matomo
Figure 33. You must activate plugins in the Matomo Plugin Manager after installing them from the Marketplace.
You must activate plugins in the Matomo Plugin Manager after installing them from the Marketplace

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.

Figure 34. The security plugin shows software levels and recommendations for PHP settings to improve site security for your Matomo installation.
The security plugin shows software levels and recommendations for PHP settings to improve site 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.

Figure 35. The GeoIP panel has several options for identifying a visitor's location.
The GeoIP panel has several options for identifying a visitor's location
Figure 36. At the bottom of the GeoIP panel, you can download and schedule updates for GeoIPLite databases for use in Geolocation.
At the bottom of the GeoIP panel, you can download and schedule updates for GeoIPLite databases for use in Geolocation

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.

Figure 37. The Bandwidth plugin instructions show the tracking code modifications that are needed to add this function to Matomo.
The Bandwidth plugin instructions show the tracking code modifications that are needed to add this function to Matomo

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.

Figure 38. The BotTracker configuration panel allows you to decide which bots you want to track.
The BotTracker configuration panel allows you to decide which bots you want to track
Figure 39. The BotTracker report panel shows you how recently each bot visited your site, and can help identify webmaster tool configuration problems.
The BotTracker report panel shows you how recently each bot visited your site, and can help identify webmaster tool configuration problems

Conclusions

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.

We use cookies to ensure you get the best experience on our website.