jenkins-bot has submitted this change and it was merged.
Change subject: Add tracking to see use of examples
..
Add tracking to see use of examples
This tracks usage of example queries as well
as clicks to edit queries and to preview them.
Change-Id: If1bd92c15aed8ced47900cd64bc23cb203ef759e
---
M wikibase/queryService/ui/QueryExampleDialog.js
1 file changed, 30 insertions(+), 2 deletions(-)
Approvals:
Smalyshev: Looks good to me, approved
Jonas Kress (WMDE): Looks good to me, but someone else must approve
Thiemo Mättig (WMDE): Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/wikibase/queryService/ui/QueryExampleDialog.js
b/wikibase/queryService/ui/QueryExampleDialog.js
index 20408ef..8a4022c 100644
--- a/wikibase/queryService/ui/QueryExampleDialog.js
+++ b/wikibase/queryService/ui/QueryExampleDialog.js
@@ -5,6 +5,8 @@
wikibase.queryService.ui.QueryExampleDialog = ( function( $ ) {
'use strict';
+ var TRACKING_NAMESPACE = 'wikibase.queryService.ui.examples.';
+
/**
* A ui dialog for selecting a query example
*
@@ -46,6 +48,12 @@
SELF.prototype._examples = null;
/**
+* @property {wikibase.queryService.api.Tracking}
+* @private
+*/
+ SELF.prototype._trackingApi = null;
+
+ /**
* Initialize private members and call delegate to specific init methods
*
* @private
@@ -53,6 +61,10 @@
SELF.prototype._init = function() {
if ( !this._querySamplesApi ) {
this._querySamplesApi = new
wikibase.queryService.api.QuerySamples();
+ }
+
+ if ( !this._trackingApi ) {
+ this._trackingApi = new
wikibase.queryService.api.Tracking();
}
this._initFilter();
@@ -216,9 +228,15 @@
SELF.prototype._addExample = function( title, query, href, tags ) {
var self = this,
link = $( ''
).text( title ).attr( 'href', '#' )
- .click( function() { self._callback(
query, title );} ),
+ .click( function() {
+ self._callback( query, title );
+ self._track( 'select' );
+ } ),
edit = $( '' ).attr( 'href', href
).attr( 'target', '_blank' )
- .append( '' ).addClass(
'glyphicon glyphicon-pencil' ),
+ .append( '' ).addClass(
'glyphicon glyphicon-pencil' )
+ .click( function() {
+ self._track( 'edit' );
+ } ),
source = $( '' ).addClass( 'glyphicon
glyphicon-eye-open' ).popover(
{
@@ -239,6 +257,9 @@
content: $( '' ),
html: true
+ } )
+ .click( function() {
+ self._track( 'preview' );
} );
$( '.exampleTable' ).scroll( function() {
if ( preview.clickover ) {
@@ -290,5 +311,12 @@
} );
};
+ /**
+* @private
+*/
+ SELF.prototype._track = function( metricName, value, valueType ) {
+ this._trackingApi.track( TRACKING_NAMESPACE + metricName,
value, valueType );
+ };
+
return SELF;
}( jQuery ) );
--
To view, visit https://gerrit.wikimedia.org/r/309285
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If1bd92c15aed8ced47900cd64bc23cb203ef759e
Gerrit-PatchSet: 2
Gerrit-Project: wikidata/query/gui
Gerrit-Branch: master
Gerrit-Owner: Addshore
Gerrit-Reviewer: Jonas Kress (WMDE)
Gerrit-Reviewer: Smalyshev
Gerrit-Reviewer: Thiemo Mättig (WMDE)
Gerrit-Reviewer: jenkins-bot <>
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits