Jump to content

Extension:EventLogging: Difference between revisions

From mediawiki.org
Content deleted Content added
Bump current version to 0.8
Restore original description: 3 months later, still no evidence that the new description is not the opinion of a single person.
Line 29: Line 29:
|bugzilla = EventLogging
|bugzilla = EventLogging
}}
}}
The EventLogging extension facilitates the collection of metrics on how users interact with MediaWiki's interface. The Wikimedia Foundation captures and analyzes this data to better understand how readers and editors interact with our site, to identify usability or performance problems, and to provide feedback for features engineers, with the overarching goal of driving improvements to user experience.
The EventLogging extension facilitates the collection of anonymized, aggregate metrics on how users interact with MediaWiki's interface. The Wikimedia Foundation captures and analyzes this data in aggregate to better understand how readers and editors interact with our site, to identify usability or performance problems, and to provide feedback for features engineers, with the overarching goal of driving improvements to user experience.


== Features ==
== Features ==

Revision as of 16:14, 16 May 2014

MediaWiki extensions manual
EventLogging
Release status: stable
Implementation Special page , Database , ContentHandler
Description Framework for logging analytic events
Author(s) Ori.livnehtalk
Latest version 0.8 (2014-03-26)
MediaWiki 1.21+
PHP 5.3+
Database changes No
License GNU General Public License 2.0 or later
Download
  • $wgEventLoggingBaseUri
  • $wgEventLoggingFile
  • $wgEventLoggingSchemaIndexUri
  • $wgEventLoggingDBname
Quarterly downloads 38 (Ranked 96th)
Public wikis using 1,078 (Ranked 221st)
Translate the EventLogging extension if it is available at translatewiki.net
Issues Open tasks · Report a bug

The EventLogging extension facilitates the collection of anonymized, aggregate metrics on how users interact with MediaWiki's interface. The Wikimedia Foundation captures and analyzes this data in aggregate to better understand how readers and editors interact with our site, to identify usability or performance problems, and to provide feedback for features engineers, with the overarching goal of driving improvements to user experience.

Features

  • EventLogging supports client-side logging from JavaScript and server-side logging from PHP.
  • The events are JSON objects defined by JSON schemas that can be edited on a MediaWiki server in a Schema: namespace; the latter feature is generally useful for storing other structured data in wiki pages.
  • The extension includes much back-end code for transporting, parsing and loading these events into SQL tables (automatically generated from the same schemas) and MongoDB collections. The details of these components are specific to Wikimedia Foundation's configuration.

Download

The extension can be retrieved directly from Git [?]:

  • Browse code
  • Some extensions have tags for stable releases.
  • Each branch is associated with a past MediaWiki release. There is also a "master" branch containing the latest alpha version (might require an alpha version of MediaWiki).

Extract the snapshot and place it in the extensions/EventLogging/ directory of your MediaWiki installation.

If you are familiar with Git and have shell access to your server, you can also obtain the extension as follows:

cd extensions/ git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/EventLogging.git

Configure

Add these configurations to LocalSettings.php:

require_once( "$IP/extensions/EventLogging/EventLogging.php" );

$wgEventLoggingBaseUri = 'http://localhost:8080/event.gif';
$wgEventLoggingFile = '/var/log/mediawiki/events.log';

If you would like to express a conditional dependency on EventLogging in your extension, see this sample code snippet.

Documentation

See also: Event logging on Wikitech

For developers

Developer setup

Your local instance must be running some cache server, such as memcached.

$wgMainCacheType    = CACHE_MEMCACHED;
$wgMemCachedServers = array( '127.0.0.1:11211' );  // this matches Debian /etc/memcached

EventLogging.php describes the EventLogging configuration variables. The extension provides a dummy web server in server/bin that responds to EventLogging's requests to its beacon URL, by default on port 8080. See server/README.rst for Python setup instructions. So you can set

$wgEventLoggingBaseUri = 'http://localhost:8080/event.gif';

and run python EventLogging/server/bin/eventlogging-devserver in a terminal to see events. The MediaWiki-Vagrant server "appliance" uses port 8080, so you may want to use another port like 8081 for event.gif requests.

To verify your setup, browse to any page of your wiki, and in a JavaScript console enter

mw.loader.load( 'ext.eventLogging' );        // load the core module
mw.loader.getState( 'ext.eventLogging' );    // should be "ready"
mw.eventLog.logEvent( null, { "foo": 42 } );

The last line will generate console warnings in debug mode as null is not a known schema, but eventlogging-devserver should dump the event along with its own warnings.

Now read /Guide to learn about creating and using a proper schema for your event.

For server-side events, set $wgEventLoggingFile to a local file writable by the PHP/Web server, and in a terminal run tail -f on that file. This will dump any calls to the PHP efLogServerSideEvent() function.

Tips

Don't use a schema name like "MyFakeTest" during development. Since schemas are referenced by MediaWiki revision ID, development versions won't conflict with production, so you should always use a real name and can point to the production wiki holding schemas (wgEventLoggingSchemaIndexUri) during development.