Log bucket/token for the DiscussionTools mobile a/b test

Bug: T321961
Change-Id: I1e809c4405a561b75e59d2c27edbfc8a3e838f09
This commit is contained in:
David Lynch 2022-12-16 14:44:29 -06:00
parent 2c14ce80e2
commit e9b2965655

View file

@ -49,14 +49,21 @@
);
}
function addABTestData( data ) {
// DiscussionTools New Topic A/B test for logged out users
function addABTestData( data, addToken ) {
// DiscussionTools A/B test for logged out users
if ( !mw.config.get( 'wgDiscussionToolsABTest' ) ) {
return;
}
if ( 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;
}
}
}
function computeDuration( action, event, timeStamp ) {
@ -232,7 +239,7 @@
}
/* eslint-enable camelcase */
addABTestData( data );
addABTestData( data, true );
logEditViaMetricsPlatform( data, actionPrefix );