mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/WikiEditor
synced 2024-11-14 19:31:55 +00:00
Improve DiscussionTools a/b test bucket logging
Make sure it works on pages which don't trigger DT, such as full-page wikitext editing. Bug: T301497 Change-Id: I244381ee9e47bd3119e341cddb42e2ab38add4a8
This commit is contained in:
parent
4a1caf3390
commit
9c478c9290
|
@ -48,6 +48,25 @@
|
|||
};
|
||||
}
|
||||
|
||||
function addABTestData( data ) {
|
||||
// DiscussionTools New Topic A/B test for logged out users
|
||||
if ( !mw.config.get( 'wgDiscussionToolsABTest' ) ) {
|
||||
return;
|
||||
}
|
||||
if ( mw.user.isAnon() ) {
|
||||
var tokenData = mw.storage.getObject( 'DTNewTopicABToken' );
|
||||
if ( !tokenData ) {
|
||||
return;
|
||||
}
|
||||
var anonid = parseInt( tokenData.token.slice( 0, 8 ), 16 );
|
||||
data.bucket = anonid % 2 === 0 ? 'test' : 'control';
|
||||
// eslint-disable-next-line camelcase
|
||||
data.anonymous_user_id = tokenData.token;
|
||||
} else if ( mw.user.options.get( 'discussiontools-abtest2' ) ) {
|
||||
data.bucket = mw.user.options.get( 'discussiontools-abtest2' );
|
||||
}
|
||||
}
|
||||
|
||||
var actionPrefixMap = {
|
||||
firstChange: 'first_change',
|
||||
saveIntent: 'save_intent',
|
||||
|
@ -83,12 +102,7 @@
|
|||
data.user_class = 'IP';
|
||||
}
|
||||
|
||||
if ( mw.config.get( 'wgDiscussionToolsABTestBucket' ) ) {
|
||||
data.bucket = mw.config.get( 'wgDiscussionToolsABTestBucket' );
|
||||
if ( mw.config.get( 'wgDiscussionToolsAnonymousUserId' ) ) {
|
||||
data.anonymous_user_id = mw.config.get( 'wgDiscussionToolsAnonymousUserId' );
|
||||
}
|
||||
}
|
||||
addABTestData( data );
|
||||
|
||||
// Schema's kind of a mess of special properties
|
||||
if ( data.action === 'init' || data.action === 'abort' || data.action === 'saveFailure' ) {
|
||||
|
@ -122,12 +136,7 @@
|
|||
integration: 'page',
|
||||
editor_interface: 'wikitext'
|
||||
};
|
||||
if ( mw.config.get( 'wgDiscussionToolsABTestBucket' ) ) {
|
||||
data.bucket = mw.config.get( 'wgDiscussionToolsABTestBucket' );
|
||||
if ( mw.config.get( 'wgDiscussionToolsAnonymousUserId' ) ) {
|
||||
data.anonymous_user_id = mw.config.get( 'wgDiscussionToolsAnonymousUserId' );
|
||||
}
|
||||
}
|
||||
addABTestData( data );
|
||||
/* eslint-enable camelcase */
|
||||
return data;
|
||||
} );
|
||||
|
|
Loading…
Reference in a new issue