转到文件
DaSch 2d038aa2a3 Merge commit 'ad2591c52963ceb02bfdb2001ee75ba7a1e581eb'
* commit 'ad2591c52963ceb02bfdb2001ee75ba7a1e581eb':
  Add feature to track user name

Conflicts:
	Piwik.php

fixing #10
2014-05-07 20:48:43 +02:00
composer.json Merged requests #7 #9 that are nearly the same. 2014-01-23 13:41:44 +01:00
Piwik.hooks.php Add feature to track user name 2014-05-06 08:00:08 -04:00
Piwik.php Merge commit 'ad2591c52963ceb02bfdb2001ee75ba7a1e581eb' 2014-05-07 20:48:43 +02:00
Rakefile Adding empty Rakefile to prevent Travis from failing 2014-01-06 08:17:20 +01:00
README Add feature to track user name 2014-05-06 08:00:08 -04:00

MediaWiki Piwik Integration extension
===========================
Version 2.2.1
 - Last update: 8 may 2013

This is the README file for the Piwik Integration extension for MediaWiki
software. The extension is only useful if you've got a MediaWiki
installation; it can only be installed by the administrator of the site.

Minimum requirements
--------------------------------

1.  MediaWiki 1.14+

2.  A Piwik (0.4+) installation with the site configured

Installation instructions
---------------------------------
Please, read them carefully. They're not very difficult to understand,
but **ALL** steps are necessary:

1. Create a folder called "piwik" in your extensions directory

2. Upload Piwik.php, Piwik.hooks.php, to the "piwik" folder you've just created

3. Edit your LocalSettings.php and, at the end of the file, add the
  following:

        ```require_once('/extensions/piwik/Piwik.php');```


4. Configure the Piwik URL and site-id. To do so; edit the LocalSettings and set up the following variables: 
      > $wgPiwikURL = "piwik-host.tld/dir/";

      > $wgPiwikIDSite = "piwik_idsite";

      **IMPORTANT** Do not define the protocol of the $wgPiwikURL

  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!

5. Enjoy our extension!
> Note: to check if the extension has succesfully installed; go to your wiki and check if the Piwik Extension is present on the bottom of the Wiki source code.


Custom variables
------------------------
* Disable cookies by setting  the ```$wgPiwikDisableCookies``` variable to ```false```.
  > For example: $wgPiwikDsiableCookies = false;

* To define custom javascript tags in the Piwik javascript code, its possible to define the $wgPiwikCustomJS variable. For example if you have a single setting to insert; use the following code:  
   > ```$wgPiwikCustomJS = "_paq.push(['trackGoal', '1']);"``` 

   If you have multiple variables to define; use an array. For example:
>`` $wgPiwikCustomJS = array( 
"_paq.push(['setCustomVariable', '1','environment','production']);",
"_paq.push(['setCustomVariable', '1','is_user','yes']);"
);``
            
* 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/```. The extension will print piwik_action_name = 'wiki/Title of the page';

* If you want to track the username of the visitor, set the
  ```$wgPiwikUsernameCustomVariable``` array variable inside
  LocalSettings.php. The array must have two indexes: the first to specify the
  index, number from 1 to 5, where this custom variable name is stored in
  Piwik; and second for the name of the custom variable in Piwik. For example,
  to set the the first custom variable spot in Piwik and have it show up as
  "User":
  > ```$wgPiwikUsernameCustomVariable = array(1, 'User');```