EBernhardson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/290268

Change subject: Add time to display results logging for search satisfaction
......................................................................

Add time to display results logging for search satisfaction

This should finish off reimplementing features of the old search schema
into the satisfaction schema. Adds the number of ms to display to all
searchResultPage events.

This should *not* be merged until the textcat test is complete to keep
analysis from needing to evaluate multiple database tables.

Bug: T132516
Change-Id: Iae6cbb49a4398c06208debb51ef7e9ad2c378357
---
M extension.json
M modules/ext.wikimediaEvents.searchSatisfaction.js
2 files changed, 20 insertions(+), 7 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikimediaEvents 
refs/changes/68/290268/1

diff --git a/extension.json b/extension.json
index 4003ed3..4152696 100644
--- a/extension.json
+++ b/extension.json
@@ -113,7 +113,7 @@
                "schema.TestSearchSatisfaction2": {
                        "class": "ResourceLoaderSchemaModule",
                        "schema": "TestSearchSatisfaction2",
-                       "revision": 15357244
+                       "revision": 15644862
                },
                "schema.GeoFeatures": {
                        "class": "ResourceLoaderSchemaModule",
diff --git a/modules/ext.wikimediaEvents.searchSatisfaction.js 
b/modules/ext.wikimediaEvents.searchSatisfaction.js
index d62ef12..c91e171 100644
--- a/modules/ext.wikimediaEvents.searchSatisfaction.js
+++ b/modules/ext.wikimediaEvents.searchSatisfaction.js
@@ -423,7 +423,8 @@
         * @param {SessionState} session
         */
        function setupSearchTest( session ) {
-               var textCatExtra = [],
+               var params,
+                       textCatExtra = [],
                        logEvent = genLogEventFn( 'fulltext', session );
 
                // specific to textcat subtest
@@ -455,11 +456,15 @@
                                }
                        );
 
-                       logEvent( 'searchResultPage', {
+                       params = {
                                query: mw.config.get( 'searchTerm' ),
                                hitsReturned: $( '.mw-search-result-heading' 
).length,
                                extraParams: textCatExtra
-                       } );
+                       };
+                       if ( window.performance && window.performance.timing ) {
+                               params.msToDisplayResults = 
window.performance.timing.domComplete - 
window.performance.timing.navigationStart;
+                       }
+                       logEvent( 'searchResultPage', params );
                } else if ( search.cameFromSearch ) {
                        logEvent( 'visitPage', {
                                position: search.resultPosition
@@ -481,18 +486,26 @@
        function setupAutocompleteTest( session ) {
                var logEvent = genLogEventFn( 'autocomplete', session ),
                        track = function ( topic, data ) {
-                               if ( data.action === 'impression-results' ) {
+                               var params;
+
+                               if ( data.action === 'session-start' ) {
+                                       session.set( 'autocompleteStart', new 
Date().getTime() );
+                               } else if ( data.action === 
'impression-results' ) {
                                        // When a new search is performed reset 
the session lifetime.
                                        session.refresh( 'sessionId' );
                                        session.refresh( 'subTest' );
 
                                        // run every time an autocomplete 
result is shown
-                                       logEvent( 'searchResultPage', {
+                                       params = {
                                                hitsReturned: 
data.numberOfResults,
                                                query: data.query,
                                                inputLocation: 
data.inputLocation,
                                                autocompleteType: 
data.resultSetType
-                                       } );
+                                       };
+                                       if ( session.has( 'autocompleteStart' ) 
) {
+                                               params.msToDisplayResults = 
Math.round( new Date().getTime() - session.get( 'autocompleteStart' ) );
+                                       }
+                                       logEvent( 'searchResultPage', params );
                                } else if ( data.action === 'render-one' ) {
                                        // run when rendering anchors for 
suggestion results. Attaches a wprov
                                        // to the link so we know when the user 
arrives they came from autocomplete

-- 
To view, visit https://gerrit.wikimedia.org/r/290268
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iae6cbb49a4398c06208debb51ef7e9ad2c378357
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikimediaEvents
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to