You are browsing a read-only backup copy of Wikitech. The live site can be found at

Talk:Event Platform/Instrumentation How To

From Wikitech-static
Jump to navigation Jump to search

Adding console.log() to instrumentation example

Would it be okay to update the example instrument to help developers new to this stuff?

// 'a.extiw' will match anchors that have a extiw class.  extiw is used for interwiki links.
$( '#content' ).on( 'mouseover', 'a.extiw', function ( jqEvent ) {
	var link =;
	var linkHoverEvent = {
		// $schema is required and must be set to the exact value of $id that you set in your schema.
		$schema: '/analytics/link_hover/1.0.0',
		link_href: link.href,
		link_title: link.title,
        var streamName = 'analytics.interwiki_link_hover';
        console.log("logging event with data " + JSON.stringify(linkHoverEvent) + " to stream '" + streamName + "'"); // for testing
	mw.eventLog.submit( streamName, linkHoverEvent );
} );

- Bearloga (talk) 19:20, 4 June 2020 (UTC)