Extension:Matomo

This extension inserts your Piwik tracking code to the bottom of every page. It excludes the views of the users with 'bot' privileges (bots) and the 'protect' privileges (sysops).

It also adds a Special Page to some of the statistics.

Minimum requirements

 * MediaWiki 1.14+


 * A Piwik (0.4+) installation with your site configured

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


 * Create a folder called "Piwik" in your extensions directory


 * Upload Piwik.php, Piwiki.18n.php, Piwik_specialpage.php and Piwik.alias.php to the "Piwik" folder you've just created


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

require_once('extensions/Piwik/Piwik.php');

$wgPiwikURL = "piwik-host.tld/dir/"; $wgPiwikIDSite = "piwik_idsite";
 * Then, you need to define where Piwik is installed and the idsite. To do it, just add after the require_once:

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

Change the value of $wgPiwikIDSite with your site ID. For example, in:

 var pkBaseURL = (("https:" == document.location.protocol) ? "https://piwik-host.tld/dir/" : "http://piwik-host.tld/dir/"); document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));  try { var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 3); piwikTracker.trackPageView; piwikTracker.enableLinkTracking; } catch( err ) {} <img src="http://piwik-host.tld/dir/piwik.php?idsite=3" style="border:0" alt=""/> the $wgPiwikIDSite is 3

$wgPiwikCustomJS = "piwikTracker.trackGoal(1); // logs a conversion for goal 1 piwikTracker.setDownloadExtensions( \"jpg|png|gif\" ); // we now only track clicks on images";
 * You can also set $wgPiwikCustomJS if you want to add custom javascript tags (see http://piwik.org/docs/javascript-tracking/ for further information). For example:

$wgGroupPermissions['usergroup']['viewpiwik'] = true; Where 'usergroup' is the name of the group. By default, only sysops can see the special page. If you want to allow bureaucrats to see the page, add that line with 'bureaucrat' where 'usergroup' is. The same is for normal users ('user') and anonymous users ('*').
 * If you want to change the title of your pages inside the Piwik tracker, you can set $wgPiwikActionName</tt> inside your LocalSettings.php file.
 * In case you want to include the title as, for example, "wiki/Title of the page", you can set $wgPiwikUsePageTitle to true and set $wgPiwikActionName to "wiki/".
 * Since 0.8 (1.0-RC3), you can choose which users can see the special page setting the following in LocalSettings.php</tt>.

For further installation instructions, check the README