daschtour / matomo-mediawiki-extension Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://www.mediawiki.org/wiki/Extension:Piwik_Integration
Home Page: https://www.mediawiki.org/wiki/Extension:Piwik_Integration
Hello,
I've noticed there is a composer.json file in the repo. I was wondering where there is already a package in https://packagist.org using that. So far I've not found it.
I'm not a programmer and not so familiar with github. I was trying to find out, if there are newer versions available as listed on MediaWiki Extension page of Matomo (https://www.mediawiki.org/wiki/Extension:Matomo). Some months ago I've asked there in the discussion regarding my issue:
Since MediaWiki update from 1.36.2 to 1.37.1 I see on top of my Wiki the following debug messages caused by Matomo extension:
Use of $wgUser was deprecated in MediaWiki 1.35. [Called from MatomoHooks::MatomoSetup in ***/extensions/matomo/Matomo.hooks.php at line 23] in ***/includes/debug/MWDebug.php on line 375
$wgUser reassignment detected [Called from MatomoHooks::MatomoSetup in ***/extensions/matomo/Matomo.hooks.php at line 23] in ***/includes/debug/MWDebug.php on line 375
Any hint how to avoid or is an extension updated planned? Or is there any newer version available to test?
Thank you!
As of MediaWiki 1.25, usage of require_once() is no longer needed, but a call to wfLoadExtension() is called. Code must be ported from Piwik.php to extension.json: auto tool provided by MediaWiki (core/maintenance/convertExtensionToRegistration) doesn't work sadly enough
I intend to change the newlines from CR+LF (DOS newlines) to LF (Unix newlines), following MediaWiki conventions. Only the file Piwik.hooks.php is concerned (the main file).
I saw it was CR+LF newlines because a git diff on command line showed ^M before newlines. There should not be a lot of disavantages given most tools support both types of newlines, at least when they are not mixed in a same file. The main disavantage will be a git blame will first show the commit converting the newlines (see test here), but GitHub has a nice feature to easily display the changes before a commit (the small window in the middle column), hence it can be easily worked around if needed.
I intend to commit the newlines in the next commit, before adding more features, hence the new features will correctly appear in git blame, and the effect of the “newlines commit” will begin to disappear (a bit).
Even though 4.0.1 is "released", the extension version is stil 4.0.0.
The three parameters wgPiwikUsePageTitle
, wgPiwikActionName
, and wgPiwikUsernameCustomVariable
are declared in extension.json but they have absolutely no effect: the two former are used in the code but the result is not taken into account in the JS code, and the latter is not used in the code.
For the first two, the result (the variable wgPiwikFinalActionName
) was removed in 90b47cd. The latter still has to be searched in the history.
The README file suggests that $wgMatomoIgnoreSysops
defaults to false
and could be set to true
to ignore actions by sysops. However, the extension.json
file sets this to true
by default.
When setting the parameter $wgMatomoTrackUsernames = true;
, MediaWiki reports:
Deprecated: Use of User::isLoggedIn was deprecated in MediaWiki 1.36. [Called from MediaWiki\Extension\Matomo\Hooks::addMatomo in /mediawiki/extensions/Matomo/src/Hooks.php at line 173] in /mediawiki/includes/debug/MWDebug.php on line 375
MediaWiki 1.36's Release notes mention this:
The confusingly-named User->isLoggedIn() method has been deprecated in favour of the method it wraps, User->isRegistered().
I confirmed that renaming the functions fixes the issue
I just added this extension, and $wgMatomoURL and $wgMatomoIDSite didn't work. I got the "You need to set the settings for Matomo" message when viewing my wiki's page source.
Using $wgPiwikURL and $wgPiwikIDSite solved the problem. So this isn't critical, but it looks like the recent rename changes are still incomplete.
Thanks,
Devin
Is it possible to add more than one ID to $wgPiwikIDSite? I want to track with two IDs instead of one.
In the javascript portion, the URL is dynamically generated. This seems rather silly given that in the section, the Image-tracker URL is hard-coded with these values. Simply generate them in PHP.
I also wanted to argue that the prefixing with 'http' or 'https' is obsolete for 15 years, when RFC 1808 was written. It specifies that //pwiki-trackerhost.org/piwik.php
will work in any modern web-browser. However, this is not true for emailed or saved HTML pages. A page that is viewed in Outlook will not have a protocol context. Thus, the image-tracker should probably always use a configured or configurable fallback.
When the Piwik MediaWiki extension is installed (specifically, when the "extensions/piwik" directory has been installed, and the LocalSettings.php file has been modified to load the Piwik.php file), all MediaWiki pages become blank. That is, the page source has no contents. There are no errors in the Apache logs. I followed all of the instructions in the readme file, and the only way to fix the problem is to remove the lines from LocalSettings.php, thereby disabling the Piwik extension. More details are below.
MediaWiki Piwik Extension 2.2.1 (same result with Master)
MediaWiki 1.21.1
Piwik 1.12
Apache 2.2.24
PHP 5.3.24
The Piwik extension hosted on MediaWiki.org is very old, and every fork of it here on GitHub seems improved. There are a bunch of forks off of @DaSchTour's with additional improvements. @akzhan @kghbln @legoktm @orangebandit @Undev @YOUR1 and @thingles now have forks as well. Is there any interest in getting these merged back into one codebase that people could use with some more confidence? Personally I'd rather see one healthy extension instead of all these forks.
What do you all think?
I am not sure this is still supported but if I install via Composer, the software get move into /../extensions/PiwikiIntegration
. As soon as I add wfLoadExtension( 'Piwik' );
the wiki starts to error due to a missing "extension.json" file which obviously was indeed available.
@Seb35 FYI
Hello there,
I was looking for an extension to add Matomo tracking and an opt out to my MediaWiki project.
After playing around a bit with your extension I decided to make some additional development and came up with this:
https://gitlab.com/gruniversal/erwin/-/tree/master/src/extensions/Matomo
Basically I did the following:
I think this will fix some issues here:
I am a bit new to MediaWiki development and I don't want to start another fork, but I found my progress good enough to share it with you. Maybe you can look over my changes and decide, if you want to take them into your repo. Then I could switch back to the official version. This might help other people too.
Best regards,
David
The Matomo code is added twice to a page, triggering a JS error. This seems to be because the SkinAfterBottomScripts hook is also called twice by the OutputPage object.
This appears to be an upstream bug.
The Matomo docs suggest tracking 404 errors like this:
Setup a custom 404 page: you can easily do this if you use a CMS (for example, in wordpress, all 404 pages are loading a custom 404 template). If you don’t use a Content Management System, you can usually specify a 404 custom page in your webserver configuration file.
Add the Matomo tracking code in this custom 404 page. In the Javascript tracking code, add the following:
_paq.push(['setDocumentTitle', '404/URL = ' + encodeURIComponent(document.location.pathname+document.location.search) + '/From = ' + encodeURIComponent(document.referrer)]);
Is this something that this extension could handle?
Hello,
I just built a wiki with mediawiki (docker) and a matomo (docker) publish on the same network card.
My problem is that I don't get any stats.
I have the impression that the plugin does not give the correct configuration in the matomo pages.
My configurations:
mediawiki Localsetting
wfLoadExtension( 'Matomo' );
$wgPiwikURL = "myfqdn.fr";
$wgMatomoIDSite = "1";
The module is succeful charged because i view it in the code
But i think i have in error.
Matomo demand to past this :
and mediawiki plugin past this:
Thank'you for your ideas
By default Matomo does not track the bots (in the general sense on the Web: automatic agents doing some task, like crawling), but it is possible to add this tracking.
Is it something useful to add it in this extension? I mean a parameter $wgMatomoTrackWebBots
, which will be false
by default and could be set to true
.
It is already possible to add $wgMatomoCustomJS = "_paq.push(['appendToTrackingUrl', 'bots=1']);";
but it is not possible to add &bots=1
in the image tracker, so the parameter $wgMatomoTrackWebBots
would set both JS and non-JS parts.
Another more general way to solve this issue would be to add a free parameter $wgMatomoCustomImageParameters
which could contain "&bots=1"
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.