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:
http://i.imgur.com/ReVnfbn.png