Extension:Matomo

The Matomo/Piwik Integration extension inserts your Matomo (formerly Piwik) tracking code to the bottom of every page. It can exclude the views of the users with 'bot' privileges (bots) and the 'protect' privileges (sysops).

Requirements

 * MediaWiki 1.25+ (tested up to MediaWiki 1.30)
 * Piwik 0.4+ with the site configured

Configuration parameters
Disable cookies by setting the  variable to. For example:

To define custom javascript tags in the Piwik javascript code, its possible to define the $wgPiwikCustomJS variable. For example if you have a single setting to insert; use the following code:

If you have multiple variables to define; use an array. For example:

If you want to change the title of your pages inside the Piwik tracker, set  inside your LocalSettings.php file.

In case you want to include the title as, for example, "wiki/Title of the page", you can set  to   and set   to. The extension will print piwik_action_name = 'wiki/Title of the page';

By setting  to false you can enable Piwik to also count page hits done by MediaWiki users who have the "protect" user right. By default, sysop users have this right and so - by default - their page hits are not counted. Default: $wgPiwikIgnoreSysops = true.

By setting  to false, you can enable Piwik to also count page hits done by MediaWiki users who have the bot right. By default their page hits are not counted. Default: $wgPiwikIgnoreBots = true.

When the JavaScript is deactivated, there is a fallback method using a hidden image. You can set the protocol (HTTP or HTTPS) calling this image with  with one of the following values: 'http', 'https', 'auto' (automatically set the protocol depending on the protocol used by the wiki).

If you have Piwik 2.7.0 or greater, you can set  if you want to save the username of logged-in users in Piwik.

If you use a CDN to distribute the file "piwik.js", you need the version incorporating this pull request (2.4.3+) and you can set  (do not write the protocol "http://" or "https://", it is automatically added); the parameter   must still be configured with the Piwik server collecting analytics.

Tracking with MobileFrontend
Due to a bug in Hooks/SkinAfterBottomScripts, Piwik Integration will not function when 'Mobile view' mode is used with the MobileFrontend Extension.

For those desiring to track across both views, comment or delete the Piwik Integration entries in  and add to the file:

Then paste the Piwik tracking code generated in the Piwik dashboard into http://www.example.com/wiki/MediaWiki:Common.js. Piwik will now track users in both Desktop view and Mobile view. Take care: This workaround currently breaks the VisualEditor Extension. (2015-10-01)

Search parameters
By default Piwik recognize the searches on the internal search engine (the page Special:Search), because the URL parameter used by MediaWiki ("search") is in the default recognized parameters.

This can also be slightly improved by setting the two parameters:
 * "Query parameter" = "search": this will remove some false positives compared to the default value;
 * "Category parameter" = "profile": Piwik will recognize as search category the profile on top of the MediaWiki search page.

This can be either as global parameters in Administration > Websites > Settings > Tracking Internal Site Search, but preferably in the site-specific configuration in Administration > Websites > Manage > [your wiki] > Edit and uncheck "Use default Site Search parameters" and fill the paremters.