Yurik has uploaded a new change for review. https://gerrit.wikimedia.org/r/324248
Change subject: Implement second phase of event logging ...................................................................... Implement second phase of event logging Bug: T149834 Change-Id: Ie741fc5f306e9ff14173e50339131b8faaf06120 (cherry picked from commit 9cb61685986012e2951c2a0c7871dd809b5a289b) --- M modules/ext.wikimediaEvents.kartographer.js 1 file changed, 45 insertions(+), 11 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikimediaEvents refs/changes/48/324248/1 diff --git a/modules/ext.wikimediaEvents.kartographer.js b/modules/ext.wikimediaEvents.kartographer.js index 1fc2ad7..d49789c 100644 --- a/modules/ext.wikimediaEvents.kartographer.js +++ b/modules/ext.wikimediaEvents.kartographer.js @@ -95,6 +95,10 @@ options = options || {}; + if ( options.sampling && !randomOneIn( options.sampling ) ) { + return; + } + if ( options.extra ) { event.extra = ( $.type( options.extra ) !== 'string' ) ? JSON.stringify( options.extra ) : options.extra; } @@ -102,7 +106,13 @@ event.duration = options.duration; } event.sampling = ( options.sampling || 1 ) * userSampling; - mw.eventLog.logEvent( 'Kartographer', event ); + + mw.loader.using( [ + 'ext.eventLogging', + 'schema.Kartographer' + ] ).then( function () { + mw.eventLog.logEvent( 'Kartographer', event ); + } ); } /** @@ -140,6 +150,39 @@ }; switch ( data.action ) { + case 'initialize': + data.feature.on( 'click contextmenu', function () { + options = $.extend( {}, options, { sampling: 100 } ); + logEvent( data.feature.featureType, 'map-click', data.isFullScreen, options ); + } ); + data.feature.on( 'zoomend', function () { + options = $.extend( {}, options, { sampling: 100 } ); + logEvent( data.feature.featureType, 'zoom', data.isFullScreen, options ); + } ); + data.feature.on( 'dragend', function () { + options = $.extend( {}, options, { sampling: 100 } ); + logEvent( data.feature.featureType, 'drag', data.isFullScreen, options ); + } ); + data.feature.on( 'popupopen', function () { + logEvent( data.feature.featureType, 'marker-click', data.isFullScreen, options ); + } ); + data.feature.$container.on( 'click', '.leaflet-popup-content a', function () { + var $link = $( this ), + destination; + + if ( $link.hasClass( 'extiw' ) ) { + destination = 'interwiki'; + } else if ( $link.hasClass( 'external' ) ) { + destination = 'external'; + } else { + destination = 'internal'; + } + options = $.extend( {}, options ); + options.extra.destination = destination; + + logEvent( data.feature.featureType, 'discovery', data.isFullScreen, options ); + } ); + return; case 'view': options.sampling = 100; break; @@ -160,16 +203,7 @@ break; } - if ( options.sampling && !randomOneIn( options.sampling ) ) { - return; - } - - mw.loader.using( [ - 'ext.eventLogging', - 'schema.Kartographer' - ] ).then( function () { - logEvent( data.feature.featureType, data.action, data.isFullScreen, options ); - } ); + logEvent( data.feature.featureType, data.action, data.isFullScreen, options ); } ); } ); -- To view, visit https://gerrit.wikimedia.org/r/324248 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie741fc5f306e9ff14173e50339131b8faaf06120 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikimediaEvents Gerrit-Branch: wmf/1.29.0-wmf.4 Gerrit-Owner: Yurik <yu...@wikimedia.org> Gerrit-Reviewer: JGirault <julien.inbox.w...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits