Add amc boolean to MobileWebMainMenuClickTracking sampling
Now that we can determine client side whether or not a user is in AMC mode from Ie000fc8f938a76d10c2566f17f933cef40aa1665, let's add this data to MobileWebMainMenuClickTracking sampling. Per T218627, if the user has amc enabled, the sampling rate will be 100%. If not, the sampling rate will follow wgMinervaSchemaMainMenuClickTrackingSampleRate. Additional changes: * Removes an outdated comment at top of schema.js (this has already been moved) * Corrects jsdoc comment for defaults.mode * Updates EventLoggingSchemas entry for MobileWebMainMenuClickTracking in skin.json to accommodate new amc field. Depends-On: Ie000fc8f938a76d10c2566f17f933cef40aa1665 Bug: T218627 Change-Id: I950a6efd1040c3a270d09bff298ee1781a010328
This commit is contained in:
parent
a81f1492d2
commit
517e4f537a
@ -1,14 +1,12 @@
|
||||
/**
|
||||
* This module is loaded by resources/skins.minerva.scripts/menu/MainMenu.js
|
||||
* inside the Minerva skin. It should be moved to Minerva at our earliest possible
|
||||
* convenience.
|
||||
*/
|
||||
mw.loader.using( [
|
||||
'ext.eventLogging.subscriber'
|
||||
] ).then( function () {
|
||||
var M = mw.mobileFrontend,
|
||||
user = mw.user,
|
||||
editCount = mw.config.get( 'wgUserEditCount' ),
|
||||
// Need to make amc default to false because it will not exist in mw.config
|
||||
// if using desktop Minerva or if MobileFrontend extension is not installed.
|
||||
amc = mw.config.get( 'wgMFAmc', false ),
|
||||
// Schema provided by ext.eventLogging.subscriber class
|
||||
Schema = mw.eventLog.Schema, // resource-modules-disable-line
|
||||
context = M.require( 'mobile.startup' ).context,
|
||||
@ -24,7 +22,9 @@ mw.loader.using( [
|
||||
mw.config.get( 'wgMinervaSchemaMainMenuClickTrackingSampleRate' ),
|
||||
/**
|
||||
* @property {Object} defaults Default options hash.
|
||||
* @property {string} defaults.mobileMode whether user is in stable or beta
|
||||
* @property {string} defaults.mode whether user is in stable, beta, or desktop
|
||||
* @property {boolean} defaults.amc whether or not the user has advanced
|
||||
* contributions mode enabled (true) or disabled (false)
|
||||
* @property {string} [defaults.username] Username if the user is logged in,
|
||||
* otherwise - undefined.
|
||||
* Assigning undefined will make event logger omit this property when sending
|
||||
@ -36,6 +36,7 @@ mw.loader.using( [
|
||||
*/
|
||||
{
|
||||
mode: context.getMode() || 'desktop',
|
||||
amc: amc,
|
||||
username: user.getName() || undefined,
|
||||
// FIXME: Use edit bucket here (T210106)
|
||||
userEditCount: typeof editCount === 'number' ? editCount : undefined
|
||||
@ -43,6 +44,12 @@ mw.loader.using( [
|
||||
);
|
||||
|
||||
mw.trackSubscribe( 'minerva.schemaMobileWebMainMenuClickTracking', function ( topic, data ) {
|
||||
if ( amc ) {
|
||||
// T218627: Sampling rate should be 100% if user has amc enabled
|
||||
schemaMobileWebMainMenuClickTracking.log( data, 1 );
|
||||
return;
|
||||
}
|
||||
|
||||
schemaMobileWebMainMenuClickTracking.log( data );
|
||||
} );
|
||||
} );
|
||||
|
Loading…
Reference in New Issue
Block a user