The site has been running ok with MW for a week or so.
Yesterday I installed Matomo. Everything seemed to go perfectly well during installation and configuration, all requirements were fulfilled and I don’t believe any step was omitted.
However, after uploading LocalSettings.php with the relevant lines added, MW ceased functioning altogether. Looking at the source coming back to the browser, there’s just “1” in the top left corner.
I used these lines:
wfLoadExtension( ‘Piwik’ );
$wgPiwikURL = “Sign in - Matomo”;
$wgPiwikIDSite = “1”;
Thanks again. I just remembered seeing an alternative method somewhere, which involves putting the code on a Special MW page. I’ll try that first then go to the github forum.
OK, I tried putting the tracking code in MW:Common.js but couldn’t get that to work either so went back to using the Piwik extension, but this time with PHP error reporting, which showed this:
Fatal error: Uncaught Exception: /home/cardanowkm/www/w/extensions/Piwik/extension.json does not exist! in /home/cardanowkm/www/w/includes/registration/ExtensionRegistry.php:99 Stack trace: #0 /home/cardanowkm/www/w/includes/GlobalFunctions.php(120): ExtensionRegistry->queue(’/home/cardanowk…’) #1 /home/cardanowkm/www/w/LocalSettings.php(212): wfLoadExtension(‘Piwik’) #2 /home/cardanowkm/www/w/includes/WebStart.php(102): require_once(’/home/cardanowk…’) #3 /home/cardanowkm/www/w/index.php(40): require(’/home/cardanowk…’) #4 {main} thrown in /home/cardanowkm/www/w/includes/registration/ExtensionRegistry.php on line 99
I’ve searched and can’t find extension.json. Any suggestions?
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 extension.json and Piwik.hooks.php in the “Piwik” folder you’ve just created
Edit your LocalSettings.php and, at the end of the file, add the
following:
wfLoadExtension( ‘Piwik’ );
Configure the Piwik URL and site-id. To do so; edit the LocalSettings and set up the following variables:
$wgPiwikURL = “piwik-host.tld/dir/”;
$wgPiwikIDSite = “piwik_idsite”;
IMPORTANT Do not define the protocol of the $wgPiwikURL
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!
Sorry, I spoke too soon. These files, extension.json and Piwik.hooks.php, are now being flagged up as problematic in the System Check.
The first one, at least, appears necessary, as its absence breaks the site. But it was missing from the package I downloaded, and is now being complained about.
Sorry I did not explain clearly enough, this is a Matomo issue, not a MW one.
Following the Matomo installation, a PHP error occurred, saying Piwik/extension.json does not exist. Following advice given here I found and uploaded that file, along with another, which were missing from the Matomo package I originally downloaded. That fixed the problem, and all is now well, except only that the Matomo System Check page has a problem with these files, saying
Files were found in your Matomo but we didn’t expect them.
–> Please delete these files to prevent errors. <–
File to delete: extension.json
File to delete: Piwik.hooks.php
OK, I just realised, there must be two packages, to be installed in different places, the MW extension and the main Matomo program. But I saw no indication of that anywhere! This is all very confusing.
Why did you put these 2 files into your Matomo folder? The belong to MW and have nothing to do at all with Matomo.
The 2 files would have to be at /var/www/mediawiki/extensions/Piwik/ for my setup.
In the current situation I’m not really sure what you installed where, maybe would be best if someone like @Lukas would look at your server directly, if you are willing to give a Matomo Member credentials for that.
So the files and the instructions on using them come from Matomo sources and they go into a Piwik folder but they have nothing to do with Matomo…
I hope you can understand my confusion.
But as I said, I now realise that the MW extension and the Matomo program are two entirely distinct things that should be installed in different places.
I’m not really sure what you installed where
Very simple: everything is in the MW extension folder.
I’m no longer looking for assistance – I assume the System Check report is ignorable – I just wanted to point out that my mistake is one that’s quite easily made, given the documentation, for someone who knows nothing of Matomo and very little of MW.