![]() Release status: stable | |
---|---|
Implementation | Special page,Database,ContentHandler |
Description | Provides a framework for logging analytics events |
Author(s) | Ori.livnehtalk |
Latest version | continuous updates |
MediaWiki | 1.33+ |
PHP | 5.5+ |
Database changes | No |
License | GNU General Public License 2.0 or later |
Download | |
| |
Translate the EventLogging extension if it is available at translatewiki.net | |
Vagrant role | eventlogging |
Issues | Open tasks ·Report a bug |
The EventLogging extension makes it possible to collect structured data on how users interact with MediaWiki sites.
The Wikimedia Foundation uses the EventLogging extension as part of abroader system for collecting, aggregating, storing, and analyzing user data within the limits set out by ourprivacy policy anddata retention guidelines.
This page is about general use of the EventLogging extension.The Wikimedia Foundation uses EventLogging with WMF specific backend components andschema repositories.For Wikimedia specific and maintained documentation, seewikitech:Analytics/Systems/EventLogging andwikitech:Event Platform.
EventLogging
folder to yourextensions/
directory.cdextensions/gitclonehttps://gerrit.wikimedia.org/r/mediawiki/extensions/EventLogging
wfLoadExtension('EventLogging');$wgEventLoggingBaseUri='/beacon/event';$wgEventLoggingServiceUri='/beacon/intake-analytics';$wgEventLoggingStreamNames=false;
Vagrant installation:
vagrant roles enable eventlogging --provision
By default, the extension will look for schemas onMeta-Wiki.The relevant default settings are:
# (default) $wgEventLoggingSchemaApiUri = 'https://meta.wikimedia.org/w/api.php';# (default) $wgEventLoggingDBname = 'metawiki';
To use local schemas, or schemas from the central wiki of your own wikifarm, you need to override these. E.g. to use theSchema
namespace of the local wiki, set
$wgEventLoggingSchemaApiUri=$wgServer.'/w/api.php';$wgEventLoggingDBname=$wgDBname;
(and ensure the user account that will create the schemas isautoconfirmed).
As a developer, you will want to set up and use EventLogging on your development wiki to simulate its use in production.
SeeMediaWiki-Docker/Configuration recipes/EventLogging
If you develop using mediawiki-vagrant, everything you need is encapsulated in theeventlogging
role.To enable it, run:
$vagrantrolesenableeventlogging$vagrantprovision
If working on the JavaScript client, you'll need to install dependencies withnpm install
from the folder you're developing in.Then you can usenpm test
to run ESLint for example.The "How to run tests" section below points out how to see JavaScript test results.
When adding the parametertrackdebug=true
to the URL, the console in the browser's devtools will show the event logging being triggered.
There are PHP tests, Python tests, and JavaScript tests.
To run JavaScript tests, visit Special:JavaScriptTest/qunit on your development wiki.(SeeManual:JavaScript unit testing.)
To run PHP tests, we use PHPUnit.Make sure it is installed, then:
$vagrantsshvagrant@mediawiki-vagrant:/vagrant/mediawiki$composerphpunit:entrypoint--extensions/EventLogging/testsEventLoggingExtensionFunctionsTest.php
![]() | This extension is being used on one or moreWikimedia projects. This probably means that the extension is stable and works well enough to be used by such high-traffic websites. Look for this extension's name in Wikimedia'sCommonSettings.php andInitialiseSettings.php configuration files to see where it's installed. A full list of the extensions installed on a particular wiki can be seen on the wiki'sSpecial:Version page. |
![]() | This extension is included in the following wiki farms/hosts and/or packages:This is not an authoritative list.Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here.Always check with your wiki farms/hosts or bundle to confirm. |