Giter Site home page Giter Site logo

matomo-mediawiki-extension's People

Contributors

cambid avatar camponez avatar dannyhavenith avatar daschtour avatar felipeforte avatar goldshop avatar mnival avatar samwilson avatar seb35 avatar simison avatar squirrelslair avatar tetsuo13 avatar thilp avatar your1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

matomo-mediawiki-extension's Issues

matomo dont work

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

Matomo

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 :

stats-code

and mediawiki plugin past this:

matomo-inspect-element

Thank'you for your ideas

Merge efforts?

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?

$wgMatomo settings aren't working yet ($wgPiwik works)

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

addMatomo() called twice

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.

Installation via Composer fails

Setup

  • MediaWiki | 1.27.4 (bc962b0)18:47, 5. Jan. 2018
  • PHP | 5.6.33-0+deb8u1 (apache2handler)
  • MariaDB | 10.1.26-MariaDB-0+deb9u1
  • Piwik Integration | 3.0.0

Issue

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

Track 404 errors

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?

Add bot inclusion?

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".

New (pre)release after 4.0.1 from 2019?

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!

Inconsistent (and unneeded) use of of javascript for URL generation

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.

Convert endlines from CR+LF to LF

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).

Three parameters have no effect

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.

Blank pages (MediaWiki 1.21.1, Piwik 1.12)

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

Multiple tracking IDs?

Is it possible to add more than one ID to $wgPiwikIDSite? I want to track with two IDs instead of one.

Piwik doesn't play nice with MediaWiki 1.25's wfLoadExtension()

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

Matomo extension calls a function deprecated in MediaWiki 1.36

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 made some progress ..

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:

  • added parser tag to Matomo extension for matomo opt out
  • simplified path handling and allowed for full URLs (backwards compatible)
  • restructured matomo callbacks and custom js
  • removed unused parameters, did some cleanup and improved code readability

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.