Rozszerzenie:EventLogging
Status wydania: stabilne |
|
|---|---|
| Realizacja | Strona specjalna, Bazy danych, ContentHandler |
| Opis | Provides a framework for logging analytics events |
| Autor(zy) | Ori.livnehdyskusja |
| Ostatnia wersja | continuous updates |
| MediaWiki | 1.33+ |
| PHP | 5.5+ |
| Zmiany w bazie danych | Nie |
| Licencja | Licencja GNU General Public License 2.0 lub nowsza |
| Pobieranie | |
|
|
| Przetłumacz rozszerzenie EventLogging jeżeli jest dostępne na translatewiki.net | |
| Rola Vagrant | eventlogging |
| Problemy | Otwarte zadania · Zgłoś błąd |
The EventLogging extension makes it possible to collect structured data on how users interact with MediaWiki sites.
Funkcje
- EventLogging supports client-side logging from JavaScript and server-side logging from PHP.
- Logging behavior can be dynamically configured using Extension:EventStreamConfig.
- The events are JSON objects defined by versioned JSONSchemas stored in a schema git repository.
- The extension does not include any back-end code for transporting, parsing, or loading these events. If you're interested in the separate components that Wikimedia uses for these purposes, see #EventLogging at Wikimedia.
EventLogging at Wikimedia
This page is about general use of the EventLogging extension.
Wikimedia uses the EventLogging extension as part of a broader system for collecting, aggregating, storing, and analyzing user data within the limits set out by its privacy policy and data retention guidelines. For documentation on this system, see wikitech:Event Platform.
Installation
- Pobierz i umieść plik(i) w katalogu o nazwie
EventLoggingw folderzeextensions/.
Developers and code contributors should install the extension from Git instead, using:cd extensions/ git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/EventLogging
- Dodaj poniższy kod na dole twojego pliku LocalSettings.php:
wfLoadExtension( 'EventLogging' ); $wgEventLoggingBaseUri = '/beacon/event'; $wgEventLoggingServiceUri = '/beacon/intake-analytics'; $wgEventLoggingStreamNames = false;
Zrobione – Przejdź do Special:Version na twojej wiki, aby sprawdzić czy rozszerzenie zostało pomyślnie zainstalowane.
Instalacja Vagranta:
- Jeżeli korzystasz z Vagranta, zainstaluj poprzez
vagrant roles enable eventlogging --provision
Configuring the schema location
By default, the extension will look for schemas on Meta-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 the Schema namespace of the local wiki, set
$wgEventLoggingSchemaApiUri = $wgServer . '/w/api.php';
$wgEventLoggingDBname = $wgDBname;
(and ensure the user account that will create the schemas is autoconfirmed).
Logging events using EventLogging
- Extension:EventLogging/Guide - to developing and deploying EventLogging schemas, and more
- Extension:EventLogging/Programming - tips and suggestions for developers writing code to log events
Developing the EventLogging extension
Developer setup
As a developer, you will want to set up and use EventLogging on your development wiki to simulate its use in production.
Using Docker
Zobacz MediaWiki-Docker/Configuration recipes/EventLogging
Używanie mediawiki-vagrant
If you develop using mediawiki-vagrant, everything you need is encapsulated in the eventlogging role.
To enable it, run:
$ vagrant roles enable eventlogging
$ vagrant provision
For JavaScript development
If working on the JavaScript client, you'll need to install dependencies with npm install from the folder you're developing in.
Then you can use npm test to run ESLint for example.
The "How to run tests" section below points out how to see JavaScript test results.
When adding the parameter trackdebug=true to the URL, the console in the browser's devtools will show the event logging being triggered.
How to run tests
There are PHP tests, Python tests, and JavaScript tests.
To run JavaScript tests, visit Special:JavaScriptTest/qunit on your development wiki. (Zobacz Manual:JavaScript unit testing.)
To run PHP tests, we use PHPUnit. Upewnij się, że to jest zainstalowane, a potem:
$ vagrant ssh
vagrant@mediawiki-vagrant:/vagrant/mediawiki$ composer phpunit:entrypoint -- extensions/EventLogging/testsEventLoggingExtensionFunctionsTest.php
| To rozszerzenie jest wykorzystywane przez jeden lub więcej projektów Wikimedia. Oznacza to prawdopodobnie, że to rozszerzenie jest stabilne i działa wystarczająco dobrze, aby wykorzystywać je na stronach o dużym natężeniu ruchu. Odnajdź nazwę tego rozszerzenia w plikach konfiguracyjnych Wikimedia CommonSettings.php oraz InitialiseSettings.php, aby zobaczyć gdzie są zainstalowane. Pełną listę rozszerzeń zainstalowanych na określonej wiki można znaleźć na stronie Special:Version na danej wiki. |
| To rozszerzenie jest dołączone do następujących farm/hostów wiki lub pakietów: |
- Stable extensions/pl
- Special page extensions/pl
- Database extensions/pl
- ContentHandler extensions/pl
- GPL licensed extensions/pl
- Extensions in Wikimedia version control/pl
- ApiMain::moduleManager extensions/pl
- BeforePageDisplay extensions/pl
- CanonicalNamespaces extensions/pl
- CodeEditorGetPageLanguage extensions/pl
- EditFilterMergedContent extensions/pl
- GetPreferences extensions/pl
- MovePageIsValidMove extensions/pl
- All extensions/pl
- Extensions used on Wikimedia/pl
- Extensions included in Canasta/pl
- Extensions included in Miraheze/pl
- Analytics extensions/pl
- Statistics extensions/pl
