One of the persistent pain-points for teams using EventLogging seems to be the ease with which schema violation errors can slip through to production and linger unnoticed. Validation errors are written to the browser console, where they are easy to miss.
There are several things we could do to make it easier to spot problems in client-side analytics code. I'd like to have live graphs showing the volume of data (valid and invalid) currently being logged under a particular schema integrated into the schema page in MetaWiki, and I'd like us to have some automatic alerting for that. Nuria is also working on making the process of testing analytics code in labs clearer and more useful.
One thing you can do right now (and that I hope you will do) is to add a small piece of custom JavaScript to your global.js that will flash validation errors in an error bar on the page you are viewing. To do that, edit both https://meta.wikimedia.org/wiki/User:<your username>/global.js (for production) and http://meta.wikimedia.beta.wmflabs.org/wiki/User:<your username>/global.js (for labs), and add the following:
// Show EventLogging validation errors in a dismissible bar at the top of page. var $el = $( '<pre style="background: yellow; margin: 0; padding: 8px; position: fixed; top: 0; width: 100%; z-index: 99"></pre>' ); $el.click( function () { $el.empty().detach(); } ); mw.trackSubscribe( 'eventlogging.error', function ( topic, err ) { $el.text( function ( idx, text ) { return ( text && text + '\n' ) + err; } ).appendTo( 'body' ); } );
This code won't do anything to change your user experience unless there are schema violations in the JavaScript code that is loaded by the page. If there are any errors, they will looks like this:
On Thu, Jan 8, 2015 at 6:11 PM, Ori Livneh ori@wikimedia.org wrote:
One thing you can do right now (and that I hope you will do) is to add a small piece of custom JavaScript to your global.js that will flash validation errors in an error bar on the page you are viewing. To do that, edit both https://meta.wikimedia.org/wiki/User:<your username>/global.js (for production) and http://meta.wikimedia.beta.wmflabs.org/wiki/User:<your username>/global.js (for labs), and add the following:
Special:MyPage ftw! https://meta.wikimedia.org/wiki/Special:MyPage/global.js http://meta.wikimedia.beta.wmflabs.org/wiki/Special:MyPage/global.js ;-)
I added this to https://www.mediawiki.org/wiki/Extension:EventLogging/Guide#QA . Is there a way the guide can transclude someone's "master" copy of the JS into a <source> tag so it remains up-to-date? Or vice-versa, can developers do a labelled transclude of a code snippet from wikitext into their own user JS? [1]
I clicked a link in a TOC on testwiki and a yellow section appeared
undefined] Missing property "action" [undefined] Value null is the wrong type for property "duration" (integer expected)
\o/ ! But I had no idea what this was, so maybe a badge or header "EventLogging validation error" that links to https://www.mediawiki.org/wiki/Extension:EventLogging/Guide#QA would be useful.
(I filed a bug against Popups which is logging this, https://phabricator.wikimedia.org/T86378 )
[1] Another fine topic for the MW Developer Summit 2015 documentation session https://www.mediawiki.org/wiki/MediaWiki_Developer_Summit_2015#Discussion_sessions, come with ideas, enjoy pastries!