Log token for the DiscussionTools mobile a/b test

Bug: T321961
Change-Id: If06ba42491ea1ca58aec48a85d0b4a0187702123
This commit is contained in:
David Lynch 2022-12-16 14:46:11 -06:00
parent dbad7f8987
commit 5b6226841d

View file

@ -57,7 +57,7 @@
}; };
} }
function addABTestData( data ) { function addABTestData( data, addToken ) {
// DiscussionTools New Topic A/B test for logged out users // DiscussionTools New Topic A/B test for logged out users
if ( !mw.config.get( 'wgDiscussionToolsABTest' ) ) { if ( !mw.config.get( 'wgDiscussionToolsABTest' ) ) {
return; return;
@ -65,6 +65,13 @@
if ( mw.config.get( 'wgDiscussionToolsABTestBucket' ) ) { if ( mw.config.get( 'wgDiscussionToolsABTestBucket' ) ) {
data.bucket = mw.config.get( 'wgDiscussionToolsABTestBucket' ); data.bucket = mw.config.get( 'wgDiscussionToolsABTestBucket' );
} }
if ( mw.user.isAnon() && addToken ) {
var token = mw.cookie.get( 'DTABid', '' );
if ( token ) {
// eslint-disable-next-line camelcase
data.anonymous_user_token = token;
}
}
} }
var actionPrefixMap = { var actionPrefixMap = {
@ -104,7 +111,7 @@
data.user_class = 'IP'; data.user_class = 'IP';
} }
addABTestData( data ); addABTestData( data, true );
// 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' ) {