mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/WikiEditor
synced 2024-11-30 19:15:43 +00:00
Merge "Improve DiscussionTools a/b test bucket logging"
This commit is contained in:
commit
1418002309
|
@ -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 = {
|
var actionPrefixMap = {
|
||||||
firstChange: 'first_change',
|
firstChange: 'first_change',
|
||||||
saveIntent: 'save_intent',
|
saveIntent: 'save_intent',
|
||||||
|
@ -83,12 +102,7 @@
|
||||||
data.user_class = 'IP';
|
data.user_class = 'IP';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( mw.config.get( 'wgDiscussionToolsABTestBucket' ) ) {
|
addABTestData( data );
|
||||||
data.bucket = mw.config.get( 'wgDiscussionToolsABTestBucket' );
|
|
||||||
if ( mw.config.get( 'wgDiscussionToolsAnonymousUserId' ) ) {
|
|
||||||
data.anonymous_user_id = mw.config.get( 'wgDiscussionToolsAnonymousUserId' );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Schema's kind of a mess of special properties
|
// Schema's kind of a mess of special properties
|
||||||
if ( data.action === 'init' || data.action === 'abort' || data.action === 'saveFailure' ) {
|
if ( data.action === 'init' || data.action === 'abort' || data.action === 'saveFailure' ) {
|
||||||
|
@ -122,12 +136,7 @@
|
||||||
integration: 'page',
|
integration: 'page',
|
||||||
editor_interface: 'wikitext'
|
editor_interface: 'wikitext'
|
||||||
};
|
};
|
||||||
if ( mw.config.get( 'wgDiscussionToolsABTestBucket' ) ) {
|
addABTestData( data );
|
||||||
data.bucket = mw.config.get( 'wgDiscussionToolsABTestBucket' );
|
|
||||||
if ( mw.config.get( 'wgDiscussionToolsAnonymousUserId' ) ) {
|
|
||||||
data.anonymous_user_id = mw.config.get( 'wgDiscussionToolsAnonymousUserId' );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* eslint-enable camelcase */
|
/* eslint-enable camelcase */
|
||||||
return data;
|
return data;
|
||||||
} );
|
} );
|
||||||
|
|
Loading…
Reference in a new issue