Site Analytics – Matomo

As a part of the 2017-18 rotation, the Web Chair was requested to provide more information in her reports about site usage. Typical information requested include:

  1. How many times the site is visited?
  2. Where people are from who are visiting the site?
  3. What parts of the site are people visiting?
  4. etc.

Past rotations have used tools available from the web hosting service (currently Hostmonster.com) such as Webalizer and Awstats to provide reports but, since they are based only on Apache access logs using parsing tools and heuristics over which we have little or no control, the reports seem to vary widely in reported numbers and information.

Currently, the best “free” analytics package on websites such as Area 10’s would be Google Analytics but this requires placing some software on each page that communicates with and runs on a Google server. While there are assurances that this tracking is generally anonymous (no personal identifying information is tracked by Google), lots of stories exist of individuals believing that Google is “following them” on the web and there is a possibility that using the Google Analytics interface could provide data that could associate a given visitor to coloradoaa.org with other web browsing activities.

Rather than either debating the potential use of Google Analytics at Area 10 or attempting to definitively “prove” the security using this tool, we put a post up on tiaa-forum.org to ask other AA entities what they were doing with (or rationales for not dealing with) Google Analytics.

We found out from responses to that poll that AAWS/GSO are using a tool called Matomo (previously called Piwik) for analytics in order to collect analytics information similar to Google Analytics and get around the issue of sending data to Google since, by running the service on our own server, data will only exist in the domain of control of coloradoaa.org (data will be collected by and stored on our own hosting account – currently at Hostmonster) and the Area 10 Web Committee.

Lew Grothe installed the server and tested it on another Hostmonster instance that was under his control. Based on that preliminary success, he set out to install the software on the coloradoaa.org hosted account.

These are the steps required to set that up:

  1. Set up a subdomain instance for matomo.coloradoaa.org which points to a directory of ~/public_html/matomo
  2. Download the software from matomo.org into it’s root directory (~/public_html/matomo)
  3. Install the software
    1. the software installs automatically when you browse to: https://matomo.coloradoaa.org/piwik/
    2. the software checks the system for compatibility. It requires a different setting for one PHP parameter than the Hostmonster default so we needed to copy a php.ini file into the directory where the script is run (~/public_html/matomo/piwik/) with:

      always_populate_raw_post_data = -1

    3. set up a new database and user using cpanel and tie that to matomo as a part of the installation
    4. create the administrative user for matomo:
      user name: matomo-admin
      pw: bM6gP7G3jJS
    5. Log into the server using the admin account and set up a user account for looking at and managing coloradoaa.org statistics:
      user name: coaa-matomo
      pw: Q62kPp3tgrj

Setting up tracking for the site

The “tracking code” is the Javascript that appears on the page that calls the server (in our case at matomo.coloradoaa.org) to log information when a browser “hits” a page on our site. There are several ways to accomplish this:

  1. The Piwik tracking plugin. This plugin is minimal (supports tracking code only on specified pages) and, as of 3/19/18, has 4,000+ downloads with a high rating and has been tested on our current release of WordPress.
  2. The WP-matomo plugin. This plugin is well featured (includes more powerful tracking options as well as reports from the server) and, as of 3/19/18, has over 70,000 downloads with a very high rating. While it’s not tested with our current WordPress release, it has passed tests with the previous release and seems pretty well supported.
  3. Various header/footer insertion plugins. There are several and a few are popular and tested with our current version of WordPress. The simplest of these are free and offer very simple functionality for inserting the requisite code.
  4. Edit the header.php in the theme (Appearance->Editor). This has the disadvantage in that, if there’s an update to the theme, you will need to remember to add changes back into the file. As the current theme in use (Smpl Skeleton) seems to no longer be supported, this may not be an issue.

For at least a “trial phase,” we will opt for the option of editing the header.php file.

The tracking code for coloradoaa.org is located under the matomo.coloradoaa.org Matomo admin site.

Update 2018/03/23:

I added the cities database for tracking per Matomo->settings->system->geolocation. Reading around on the MaxMind (provider of the IP address to city location database) website, it would appear that the free version of the cities database will no longer be distributed after 4/1/18 and will be removed completely by 2/1/19. Bummer. We will need to plug into the Matomo community and see if there will be another way of supporting this sort of IP->city mapping. One would expect something to be available soon.

After setting this up, I had to rebuild the database archives for the existing reports on existing data using the tools contained here.

This entry was posted in Site Maintenance. Bookmark the permalink.