Go to file
Seb35 b74fca9f8b Version 5.0.0
This requires MediaWiki 1.34 and works up to (at least) MediaWiki 1.40.

New features since v4.0.0:
* Ignore wiki editors, to restrict analytics to anonymous users

Maintenance since v4.0.0:
* Replace global $wgUser deprecated in MediaWiki 1.35.2
* Replace User::isLoggedIn() deprecated in MediaWiki 1.34
* PSR-4 autoloading
* Added CI and quality checks
* Improved documentation

Thanks to the following people since v4.0.0 🥳

Eduardo Elias (2):
      Ignore wiki editors
      Make README to be parsed

Goldshop (1):
      Update extension.json

Sam Wilson (2):
      Add CI and linting, and fix errors
      Move Matomo.hooks.php to src/Hooks.php and adjust loading

Youri vd Bogert (1):
      Update README.md

felipeforte (1):
      Updated hook

mnival (2):
      Replace deprecated $wgUser by RequestContext::getMain()->getUser()
      Delete empty line

previously contributed as ttenbergen (1):
      allow plugins

Daniel Schuba (5):
      Merge pull request #32 from Goldshop/patch-1
      Merge pull request #26 from YOUR1/patch-1
      Merge pull request #35 from samwilson/phpcs
      Merge pull request #36 from samwilson/classname
      Merge pull request #37 from mnival/master

Seb35 (10):
      Rebase IgnoreEditors feature on 4.0.0
      Fix $wgMatomo* and $wgPiwik* parameters
      Merge pull request #40 from felipeforte/patch-1
      Restrict plugins to composer/installers
      Merge branch 'fix-ci'
      Make explicit the parameter $wgMatomoIgnoreEditors
      Avoid to silently ignore non-existing parameters
      Fix documentation issues
      Update CI
      Version 5.0
2023-10-27 17:46:10 +02:00
.github/workflows Update CI 2023-10-27 10:55:37 +02:00
src Avoid to silently ignore non-existing parameters 2023-10-26 17:52:36 +02:00
.gitignore Add .gitignore 2018-01-31 22:23:05 +01:00
.phpcs.xml Move Matomo.hooks.php to src/Hooks.php and adjust loading 2021-12-09 07:44:32 +08:00
README.md Version 5.0.0 2023-10-27 17:46:10 +02:00
Rakefile Adding empty Rakefile to prevent Travis from failing 2014-01-06 08:17:20 +01:00
composer.json Restrict plugins to composer/installers 2023-10-26 16:45:02 +02:00
extension.json Version 5.0.0 2023-10-27 17:46:10 +02:00


Mamoto extension for MediaWiki

Version 5.0.0

  • Last update: 27 October 2023

This the Mamoto (ex-Piwik) integration extension for MediaWiki software. The extension is only useful if you've got a MediaWiki installation; it can only be installed by the administrator of the site.

Minimum requirements

  1. MediaWiki 1.34+

  2. A Matomo (0.4+) installation with the site configured

Installation instructions

Please, read them carefully. They're not very difficult to understand, but ALL steps are necessary:

  1. Create a folder called "Matomo" in your extensions directory

  2. Upload extension.json and Matomo.hooks.php in the "Matomo" folder you've just created

  3. Edit your LocalSettings.php and, at the end of the file, add the following:

     wfLoadExtension( 'Matomo' );
  4. Configure the Matomo URL and site-id. To do so; edit the LocalSettings and set up the following variables:

    $wgMatomoURL = "matomo-host.tld/dir/";

    $wgMatomoIDSite = "matomo_idsite";

    IMPORTANT Do not define the protocol of the $wgMatomoURL

Note: Change the value of $wgMatomoURL with the URL, without the protocol but including the domain name, where you installed Matomo. Remember to add the trailing slash!

  1. Enjoy our extension!

Note: to check if the extension has succesfully installed; go to your wiki and check if the Matomo extension is present on the bottom of the Wiki source code.

Custom variables

  • Disable cookies by setting the $wgMatomoDisableCookies variable to false.

    For example: $wgMatomoDisableCookies = false;

  • Ignore regular editors: set $wgMatomoIgnoreEditors to true

  • Do not ignore Bots: set $wgMatomoIgnoreBots to false (by default bots are ignored)

  • Do not ignore sysop users: set $wgMatomoIgnoreSysops to false (by default sysops are ignored)

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

    $wgMatomoCustomJS = "_paq.push(['trackGoal', '1']);"

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

    $wgMatomoCustomJS = array( "_paq.push(['setCustomVariable', '1','environment','production']);", "_paq.push(['setCustomVariable', '1','is_user','yes']);" );

  • If you want to change the title of your pages inside the Matomo tracker, you can set $wgMatomoActionName inside your LocalSettings.php file.

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

  • If you want to track the username of the visitor with the Matomo feature User ID (needs Matomo >= 2.7.0) set the $wgMatomoTrackUsernames to true in LocalSettings.php.


On MediaWiki and 1.40.0, the tracking code is included twice: this can be fixed by upgrading MediaWiki to 1.39.5 and 1.40.1 (see this Phabricator task.