PHP logging

EventLogging::logEvent( 'WikipediaPortal', 15890769, $event );

extension.json setup for JavaScript logging

{
	"attributes": {
		"EventLogging": {
			"Schemas": {
				"WikipediaPortal": 15890769
			}
		}
	}
}

JavaScript logging

mw.eventLog.logEvent( 'WikipediaPortal', { /* ... */ } );

Schema:WikipediaPortal

From Meta, a Wikimedia project coordination wiki
Revision 15890769
Jump to: navigation, search
description"Logs basic information about the use of the Wikipedia portal (www.wikipedia.org). Most of the things we want (user agent, say) are already tracked. It is important to note that the sessions can last an arbitrary length of time as session ID is set to expire 15 minutes after the initial landing, with the expiration timer resetting every time the user comes back to the page within the 15 minute timer. This means that we can (and do) have sessions that last for hours with thousands of events logged to them."
properties
session_id
type"string"
requiredtrue
description"A unique session ID that identifies events from a single user, resetting on every portal view. In other words, both 'landing' and 'clickthrough' events from a single user in a single session can be clumped together."
event_type
type"string"
requiredtrue
enum
"landing"
"clickthrough"
"select-language"
description"The type of event we're logging. Options are 'landing' - the start event, when someone shows up on a portal; 'clickthrough', indicating that they chose a link or the search bar or whatever and went somewhere else; and 'select-language', which means the user has selected a different language to search in"
section_used
type"string"
requiredfalse
enum
"primary links"
"search"
"language search"
"secondary links"
"other languages"
"other projects"
description"The overall section interacted with. This could be 'primary links' (the called-out project links around the globe', 'search' (the main search box), 'language search' (' Find Wikipedia in a language'), 'secondary links' (the less-prominent plaintext links) 'other languages' (this page in other langauges) or 'other projects' (links to wikisource, wiktionary, et al, portals). NULL in the case that 'event_type' is landing"
destination
type"string"
requiredfalse
description"Where the user clicked through to. This may be NULL if the event type is 'landing'"
referer
type"string"
requiredfalse
description"The referer the user came from, if known. May be NULL."
country
type"string"
requiredfalse
description"The ISO code for the country the user geolocates to. May be NULL."
accept_language
type"string"
requiredtrue
description"The accept_language header from the user's request"
cohort
type"string"
requiredfalse
description"A cohort identifier. We can use this for running A/B tests or unrelated experiments, with the population who are *not* in any tests getting a NULL cohort field, meaning we can base our dashboards off those users and A/B test from the same schema in peace."
selected_language
type"string"
requiredfalse
description"The language that the user has selected to search in. In most cases, we expect this to be the same as the first language in 'accept_language' since that is selected automatically. When the user searches ('event_type' is 'clickthrough' and 'section_used' is 'search'), this field contains the language the user searched in, in case they went to a SERP rather than a specific article."