EBernhardson has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/334491 )

Change subject: [WIP] Enable Sister project search AB test
......................................................................

[WIP] Enable Sister project search AB test

Sets up the AB test for sister project search. Collects information
about clicks to the sidebar.

Bug: T149806
Change-Id: I4ccbb887cfcdd28ccd07891f178f7e83abddb06c
---
M modules/ext.wikimediaEvents.searchSatisfaction.js
1 file changed, 50 insertions(+), 10 deletions(-)


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

diff --git a/modules/ext.wikimediaEvents.searchSatisfaction.js 
b/modules/ext.wikimediaEvents.searchSatisfaction.js
index 92a6d9c..ae6ee6e 100644
--- a/modules/ext.wikimediaEvents.searchSatisfaction.js
+++ b/modules/ext.wikimediaEvents.searchSatisfaction.js
@@ -115,14 +115,18 @@
                        var sessionId = session.get( 'sessionId' ),
                                sampleSize = ( function () {
                                        var dbName = mw.config.get( 'wgDBname' 
),
+                                               // Currently unused, but 
provides a place
+                                               // to handle wiki-specific 
sampling
                                                subTests = {
-                                                       thwiki: {
-                                                               // 1:5 overall 
sessions into test
-                                                               test: 5,
-                                                               // 1:39 of test 
sessions reserved for dashboard
-                                                               // 38:39 
sessions split evenly between test buckets
-                                                               subTest: 39
-                                                       }
+                                                       enwiki: {
+                                                               // 1 in 200 
users search sessions will be recorded
+                                                               // by event 
logging
+                                                               test: 200
+                                                               // 1 in 10 (of 
the 1 in 200) will be bucketed into
+                                                               // the 
sub-test. The other 9 in 10 are reserved for
+                                                               // dashboarding.
+                                                               subTest: 10
+                                                               
                                                };
 
                                        if ( subTests[ dbName ] ) {
@@ -184,10 +188,11 @@
                                        return;
                                }
 
-                               if ( sampleSize.subTest !== null && !oneIn( 
sampleSize.subTest ) ) {
+                               if ( sampleSize.subTest !== null && oneIn( 
sampleSize.subTest ) ) {
                                        session.set( 'subTest', chooseBucket( [
-                                               'bm25:control',
-                                               'bm25:inclinks_pv'
+                                               'recall_sidebar_results',
+                                               'random_sidebar_results',
+                                               'no_sidebar',
                                        ] ) );
                                }
                        }
@@ -562,6 +567,36 @@
                                search.wprovPrefix + 'dymo1'
                        ) );
 
+                       // Sister-search results
+                       if ( session.has( 'subTest' ) ) {
+                               $( '#mw-content-text' ).on(
+                                       'click',
+                                       '.mw-interwiki-results a.extiw, 
.mw-interwiki-results .iw-result__mini_gallery a',
+                                       function ( evt ) {
+                                               var $target = $( evt.target ),
+                                                       href = $target.attr( 
'href' );
+
+                                               // Shouldn't happen, but just 
in case.
+                                               if ( href === undefined ) {
+                                                       href = '';
+                                               }
+
+                                               logEvent( 'sisterclick', [
+                                                               // This is a 
little bit of a lie, it's actually the
+                                                               // position of 
the interwiki group, but we only
+                                                               // show one 
result per so it seems to work.
+                                                               position: 
$target.closest( '.iw-result' ).data('iw.resultset-pos' ),
+
+                                                               // Attach the 
url that was clicked. Analysis can
+                                                               // use this to 
decide which wiki the user went to,
+                                                               // along with 
if it was an article or search link.
+                                                               extraParams: 
href
+                                               ] )
+                                       }
+                               );
+                       }
+
+                       // Primary search results
                        $( '#mw-content-text' ).on(
                                'click',
                                '.mw-search-result-heading a, 
#mw-search-DYM-suggestion, #mw-search-DYM-original, #mw-search-DYM-rewritten',
@@ -569,6 +604,11 @@
                                        var wprov,
                                        // Sometimes the click event is on a 
span inside the anchor
                                                $target = $( evt.target 
).closest( 'a' ),
+                                       // Distinguish between standard 
'on-wiki' results, and interwiki results that point
+                                       // to another language
+                                               clickType = $target.closest( 
'.mw-search-result-heading' ).find( 'a.extiw' ).length > 0
+                                                       ? 'iwclick'
+                                                       : 'click',
                                                params = {
                                                        // Only the primary 
anchor has the data-serp-pos attribute, but we
                                                        // might be updating a 
sub-link like a section.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4ccbb887cfcdd28ccd07891f178f7e83abddb06c
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