How to install Matomo (formerly Piwik) web analytics software on our Apache server (page 4)

botond published 2019/09/01, v - 16:04 time

Content

 

4. page content

 

 

Continuation

Az previous page For WordPress type page set to Matomo (Piwik) web statistics tracking code, and here's Drupal CMS integrated. Configuring the Drupal module is not complicated, I prefer to create this part of the description so that those who are still thinking about installing the Matomo system can anticipate the possibilities offered by the module.

 

Creating a new website in Matomo for the Drupal system

Before you start configuring the Drupal module - or pasting code into any web page at all - we first create a new web page in Matomo to create the page ID. This is because in the Drupal module we will only need this for the measurement - unlike WordPress, where we had to set an API ID, which allowed the WordPress plugin to create a new website if necessary. The Drupal Matomo module does not use an API, but only transforms and fine-tunes the JavaScript tracking code that enters the source of the content management system, so we have to create the new website separately. The process for this is a little different than creating the first page during installation, so we'll run this through quickly as well.

On the Matomo interface, click the gear icon on the right side of the header. This will bring up the settings page. Scroll down here until you reach the Websites and then click here Manage option. A list of managed websites will be displayed. Click the Add Green Website button here. You will then be asked what type of website you want to create: a live website or a website on a local network. Here, select the appropriate one. And then the form comes in:

Matomo - Creating a New Website

  • Name: Enter the name of the web page
  • URL: Specify here the URLs from which the page can be accessed. For example, if more domain name If you are also directed to the site, you should list them all, as this will prevent Matomo from being referred to as a "referer" if an alias comes from. This does not create unnecessary referral data in the statistics.
    I have a spare Drupal site that is not directed to a real domain name, I only use it for testing and experimentation. Now, through this, I present the whole process from the creation of the new page to the insertion of the Matomo measurement code ...
  • Only track visits ...: If checked, Matomo will only follow arriving from the URLs above

Matomo - Create a new website (Image 2)

  • Keep Page URLs when tracking Page URLs: If active, Matomo will also measure clicks on sitelinks separately.
  • Excluded IP addresses: Here you can exclude IP addresses or entire domains from measuring statistics.
  • Excluded Parameters: URL query parameters to exclude. Regular expressions can also be used. The system automatically excludes "phpsessid" session parameters.
  • Excluded User Agents: Here, we can exclude visits from statistics based on browser IDs.
  • Page search: If the website has its own internal search engine, here you can allow it to measure your searches.

Matomo - Create a new website (Image 3)

  • Use default Site Search parameters: If checked, the system will examine default search parameters during the measurement, such as q, query, s, search, searchword, k, keyword, and Category. If you uncheck the box, two more fields will appear (Query parameter, Category parameter) where you can specify the search and category parameters used by our site. Required for custom web pages, a default setting is good for a Drupal, WordPress, etc. page.
  • ecommerce: If enabled, Matomo can also measure the financial turnover of webshops (by placing the appropriate additional metrics, of course, that we have placed for the various purposes of the webshop).
  • Currency: Only ecommerce-type pages play a role in the reports displayed.
  • Time zone: The time zone of our website.

Once you have saved the form, you will be returned to the list view, where the summary panel of your new website will also appear, where you can also read the website ID required for the Drupal module, or if you integrate the tracking code into any website, you will need this ID everywhere.

 

 

Placing tracking code on Drupal pages

For Drupal sites, the situation is similar to WordPress: you need to install a module, and after you have made the appropriate settings, Matomo measurement is in place.

Installing the module

Visit the Drupal project pages at Matomo module side. Here, copy the link to the download tar.gz file for your version of Drupal (7 or 8) (for me, the version 8.x-1.9). Then, in the Drupal administration interface, enter Expansion main menu, and then click the Install New Module button here to copy the link and install the module:

Installing the Drupal - Matomo module

Drupal - Installing Matomo Module (2)

Here select Enable newly added modules option.

Drupal - Installing Matomo Module (3)

Here's the search for matomo, and the list for this module will be narrowed. Select it and install it. You will then go through the translation process, which may take some time.

Module setup

Go to the admin interface of the Drupal page a configuration main menu and select "Matomo Analytics" link in the right "System" panel.

general settings

Drupal - Administration - Matomo Module Configuration - General Settings

  • Visible site ID: Here you enter the ID of the new web page created on the Matomo interface.
  • Visible HTTP URL: Enter the default HTTP path for the Matomo system. It could be already previously mentioned achievements any of them. It is advisable to specify the / matomo subdirectory under the given website (this will have to be enabled later in the main Matomo configuration).
  • Visible HTTPS URL: If there is HTTPS to access the page, then enter it with the same HTTPS.

Scope of tracking

Domains tab

Drupal - Administration - Matomo Module Configuration - Tracking Scope - Domains tab

Here you can choose whether to track only the main domain or whether to statistics for multiple subdomains.

Pages tab

Drupal - Administration - Matomo Module Configuration - Tracking Scope - Pages Tab

Here you can enter black pages or white pages that you do not want or just want to measure. For example, we can exclude administration pages, content editing pages, etc.

Roles ear

Drupal - Administration - Configuring Matomo Module - Tracking Scope - Roles Tab

On this page, you can control the enabling of the measurement codes based on roles, in white or black list.

 

 

Users tab

Drupal - Administration - Matomo Module Configuration - Tracking Scope - Users Tab

We can also control who gets the tracking code from the source of the page based on our users. In addition, there is another option to aggregate user visits to the same session based on user IDs.

Hierarchy of page titles tab

Drupal - Administration - Matomo Module Configuration - Tracking Scope - Page Hierarchy Tab

If we enable the crumb menu hierarchy display mode, we get a convenient and clear display format in our statistics, where the tree shows the pages in a structure-like way instead of Matomo, a smooth linear listing.

For an even more effective crumb menu, I still recommend it Easy Breadcrumb module.

In addition, you can also choose not to include the start page in the tree structure.

Links and Downloads tab

Drupal - Administration - Matomo Module Configuration - Tracking Scope - Links and Downloads Tab

Here you can control what happens to clicks on different links:

  • mailto: links ...: If the page has a "mailto:" link, follow the stats
  • To measure external web addresses and file extensions: If enabled, the system will also measure if a visitor has clicked on a link to an external page or a file to download (works on a JavaScript basis).
  • Popup Measurement: When enabled, it also measures the display of pop-up windows.
Messages tab

Drupal - Administration - Configuring Matomo Module - Tracking Scope - Messages tab

You can also monitor the appearance of various system messages, such as status messages, warning messages, and error messages.

Search tab

Drupal - Administration - Configuring Matomo Module - Tracking Scope - Search Tab

Tracking the internal search engine of the page (requires you to enable the Search module).

Privacy tab

Drupal - Administration - Matomo Module Configuration - Tracking Scope - Privacy Tab

If enabled and the Matomo server receives a special do-not-track header, such visits will not be tracked.

Custom variables

Drupal - Administration - Configuring Matomo Module - Custom Variables

This page allows you to place custom variables in your tracking code. The variables are entered in the source code as name = value. Here you can also set fixed values, or use the Drupal token system to set variables related to a given page, such as page title, author address, creation date, or browse visitor related variables, etc. So in the Matomo system, you can see these variables in the statistics that we use to filter, group, and so on.

 

 

Advanced settings

Drupal - Administration - Matomo Module Configuration - Advanced Configuration

And here are some more options:

  • Local caching for tracking code: When enabled, it recovers the compiled and saved tracking code from the cache and rebuilds it on a daily basis.
  • Common tracking of translation units: If enabled, multilingual pages will count content in different languages ​​as one.
  • Custom JavaScript code: Here is another opportunity for us to fine-tune further Matomo tracking code. About these in full detail read here.

So that would be setting up the Drupal Matomo module. Once the form has been successfully saved, the Drupal site will begin measuring visits.

 

A next page we continue by embedding the Matomo tracking code into custom web pages.

 

 

Navigation

This description consists of several pages: