MediaWiki: looking for sample php's


(Chris) #1

Dear all
I’m an absolute newbee to Matamo but it looks to me brillant!
IF ONLY… I could get it counting.

I’m using a MedaiWiki installation which is already quite settled and added Matomo yesterday only.

I’m sure, it is my mistake.
Could someone please drop me his/her snippet out of localsettings.php of his/her working MediaWiki installation?

Is it correct, that I installed the MW-installation of Matomo to the extensions folder plus the full installation of Matomo within a separate folder? At least I get the dashboard there, but it simply says “no data has been recorded” (or sth. simular.

Help is appreciated.

Thanks in advance - Chris


(Chris) #2

Maybe I should give my (NON-working) config and someone can see my error?

  1. MediaWiki: in Localsettings.php
// MatomoAnalytics
wfLoadExtension( 'MatomoAnalytics' );
$wgMatomoURL = "wiki-name.dyndns.org/matomo";
$wgMatomoIDSite = "1";

Remark: in the sub-dir “matomo” is, where the full extension sits, whereelse the downloaded Wiki-Extension resides in “wiki-name.dyndns.org/extensions/MatomoAnalytics

$wgMatomoURL contains the path to the full Matomo installtion, not to the extension of MediaWiki.

Questions:

  1. Do I need to adopt $IP/extensions/MatomoAnalytics/extension.json?
    I tried with and without - no success.
  2. Do I have to add any code to the wiki articles manually? As far as I unserstand: nope.
  3. Which user rights and owner should the main matomo dir have?

Remark: Didn’t change anything within the /matomo sub-dir (the main installation. Checking the installation by calling /matomo/index.php shows no error in the installation and that everything is properly installed, and all modules are available.

Desperately seeking help.
Kind greetz - Chris


(Chris) #3

I looked at the log files of apache and found a strange call every time a wiki article has been displayed:

  1. The Wiki call log entry:
[20/Nov/2018:19:29:00 +0100] "GET /index.php/<Wiki-Article> HTTP/1.1" 200 12572 "http://<sitename>/index.php/<Wiki-Article>" "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko"

So far this is ok.

  1. The strange call to Matomo (log entry apache):
[20/Nov/2018:19:29:01 +0100] "GET /index.php/matomo/piwik.js HTTP/1.1" 301 486 "http://<sitename>/index.php/<Wiki-Article>" "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko"

Whatever I try, it always calls matomo using the “index.php/matomo/…”
WITHOUT this preceeding index.php, it would work out correctly.

Any hint?


(Chris) #4

The solution: made an error in configuration of Localsettings.php:

$wgMatomoURL = "wiki-name.dyndns.org/matomo";
has been used.
Instead: use this (as a relative path of local webserver):
$wgMatomoAnalyticsServerURL = "/matomo/";
and don’t forget the trailing slash.

And: leave the Matomo’s extension.json unchanged!

If you have questions or problems yourself, please drop it here, maybe I can help…

Kind greetz - Chris