Topic on Project:Support desk

mediawiki and StatCounter

11
HappyLarry (talkcontribs)

MW:1.23.5 PHP 5.5.37 DB 10-0-20 MAriaDB URL:alevel-computing.x10.mx/mw

I would like to install the StatCounter extension but I have read the installation instructions and I don't understand what to do when it says

"Fill in [[MediaWiki:Statcounter-project-id]] and [[MediaWiki:Statcounter-security]] with the values of the JavaScript variables sc_project and sc_security, respectively, as provided to you by StatCounter.com"

Suppose my statcounter project id (sc-project) was 123456 - what do I type and where?

87.123.0.195 (talkcontribs)

The value from sc_project, in your case 123456, belongs into the wiki page MediaWiki:Statcounter-project-id in your wiki and the value of sc_security (whatever that is) belongs into the page MediaWiki:Statcounter-security.

HappyLarry (talkcontribs)

Thanks for replying so soon.

  1. I don't have a page Mediawiki:Statcounter-project-id. Is this created automatically when the extension is installed or do I need to create it?
  2. When you say 'belongs to' does that mean I just write the number on the page or is it part of some mediawiki instruction - it says it is a javascript variable.
HappyLarry (talkcontribs)

I tried installing the Statcounter extension anyway on Mediawiki 1.23.5 but it didn't install.The instructions given result in the error

"Warning: require_once(extensions/StatCounter/StatCounter.php): failed to open stream:"

I checked and there is no StatCounter.php file in the folder. According to the instructions it should work with 1.23.5 however.

Ciencia Al Poder (talkcontribs)

It should work, but only if you download the extension for MediaWiki 1.23 and not the latest one. And yes, you should create/edit those pages adding those values

HappyLarry (talkcontribs)

Thanks

  1. When you click on the download link on the StatCounter extension page, there are options to download the extension for 1.27 and 1.26 but not for 1.23. It also says that if you have an earlier version that 1.26 then you should download the latest version and it will work.
  2. So on the page (if I can get the extension installed) I would just write a single number - 123456 - (it's not embedded in a line of code?)
87.123.57.115 (talkcontribs)

1. Ok, then use the version for MediaWiki 1.26. The error "failed to open stream" can be avoided, if you use this line:

require_once "$IP/extensions/StatCounter/StatCounter.php";

2. The page should only contain the value of the JavaScript variable, that is: The number, that is all.

121.220.43.201 (talkcontribs)

StatCounter does not support 1.23, you'll have to update MW.

87.123.11.131 (talkcontribs)

The extension does not have this file. Instead, it only has an extension.json file. This will only work with MediaWiki 1.25 or newer. In so far my advice to require the extension ith that line of code in my last post is wrong. Sorry for that!

So if you want to use the extension, you have to upgrade MediaWiki first - preferably to MW 1.27! The extension page says, the extension would only be compatible with that version and not with older ones.

HappyLarry (talkcontribs)

Thanks to all for this information.

Summary: The StatCounter extension only works on Mediawiki 1.25 or later.

NB: The StatCounter page should make this clear - at present it indicates it can work for earlier versions.

87.123.11.131 (talkcontribs)

That is not correct:

The extension registration mechanism, which this extension is using, only works with MW 1.25 and newer. The extension itself however only is compatible with MW 1.27. This also is what the extension page says:

MediaWiki 	1.27+
Reply to "mediawiki and StatCounter"