Extension:Piwik Integration

From MediaWiki.org
(Redirected from Extension:Piwik)
Jump to: navigation, search


MediaWiki extensions manual - list
Crystal Clear action run.png
Piwik Integration

Release status: beta

Implementation User activity
Description Inserts Piwik script into MediaWiki pages for tracking and adds a Special Page. Based on Google Analytics Integration by Tim Laqua.
Author(s) Isb1009Talk
Last version 1.5.1-piwik0.4.3 (27 August 2009)
MediaWiki 1.11.x - 1.16.x only
1.14+ (trunk)
1.11+ (1.13.x snapshot)
License GNU General Public Licence 2.0
Download
README
Hooks used
SkinAfterBottomScripts

Check usage (experimental)

This extension inserts your Piwik tracking code to the bottom of every page. It excludes the views of the users with 'bot' privileges (bots) and the 'protect' privileges (sysops). It also adds a Special Page to some of the statistics.

Note: See PCI GUI Inserts for a working solution with MW 1.16.+

[edit] Installation

[edit] Minimum requirements

  • MediaWiki 1.14+
  • A Piwik (0.4+) installation with your site configured
  • Warning Warning: Versions of this extension before r96937 have a serious security vulnerability when the $wgPiwikUsePageTitle option is set to true. Please use a version after that revision (If using the downloader link, you want to select the version for at least MediaWiki 1.19 or trunk. It will still probably work with versions of MediaWiki before that)

[edit] Installation instructions

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 Piwik.php, Piwiki.18n.php, Piwik_specialpage.php and Piwik.alias.php to the "Piwik" folder you've just created
  • Edit your LocalSettings.php and, at the end of the file, add the following:
require_once('extensions/Piwik/Piwik.php');
  • Then, you need to define where Piwik is installed and the idsite. To do it, just add after the require_once:
$wgPiwikURL = "piwik-host.tld/dir/";
$wgPiwikIDSite = "piwik_idsite";

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!

Change the value of $wgPiwikIDSite with your site ID. For example, in:

<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://piwik-host.tld/dir/" : "http://piwik-host.tld/dir/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 3);piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script><noscript><p><img src="http://piwik-host.tld/dir/piwik.php?idsite=3" style="border:0" alt=""/></p></noscript>
<!-- End Piwik Tag -->

the $wgPiwikIDSite is 3


$wgPiwikCustomJS = "piwikTracker.trackGoal(1); // logs a conversion for goal 1
piwikTracker.setDownloadExtensions( \"jpg|png|gif\" ); // we now only track clicks on images";
  • If you want to change the title of your pages inside the Piwik tracker, you can set $wgPiwikActionName inside your LocalSettings.php file.
    • In case you want to include the title as, for example, "wiki/Title of the page", you can set $wgPiwikUsePageTitle to true and set $wgPiwikActionName to "wiki/".
  • Since 0.8 (1.0-RC3), you can choose which users can see the special page setting the following in LocalSettings.php.
$wgGroupPermissions['usergroup']['viewpiwik'] = true;

Where 'usergroup' is the name of the group. By default, only sysops can see the special page. If you want to allow bureaucrats to see the page, add that line with 'bureaucrat' where 'usergroup' is. The same is for normal users ('user') and anonymous users ('*').


For further installation instructions, check the README

Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox