Revert "Remove hacks that avoid duplicate event logging with MobileFrontend"

This reverts commit 929e8463fb.

Reason for revert: we're still seeing double-logging of some events, so this is apparently still needed until we can track down what's causing that.

Change-Id: Ifc32dfc7aa2ca67169759ecd8c278f1aea2dbef8
This commit is contained in:
DLynch 2023-06-09 19:49:54 +00:00 committed by David Lynch
parent fa73b4d7f0
commit 3e568552b6
2 changed files with 19 additions and 0 deletions

View file

@ -124,6 +124,13 @@ class Hooks implements
if ( !$extensionRegistry->isLoaded( 'EventLogging' ) || !$extensionRegistry->isLoaded( 'WikimediaEvents' ) ) {
return;
}
if ( $extensionRegistry->isLoaded( 'MobileFrontend' ) ) {
$mobFrontContext = MediaWikiServices::getInstance()->getService( 'MobileFrontend.Context' );
if ( $mobFrontContext->shouldDisplayMobileView() ) {
// on a MobileFrontend page the logging should be handled by it
return;
}
}
$inSample = $this->inEventSample( $data['editing_session_id'] );
$shouldOversample = WikimediaEventsHooks::shouldSchemaEditAttemptStepOversample( $article->getContext() );

View file

@ -9,6 +9,12 @@
require( './jquery.wikiEditor.js' );
function logEditEvent( data ) {
if ( mw.config.get( 'wgMFMode' ) !== null ) {
// Visiting a ?action=edit URL can, depending on user settings, result
// in the MobileFrontend overlay appearing on top of WikiEditor. In
// these cases, don't log anything.
return;
}
mw.track( 'editAttemptStep', $.extend( {
// eslint-disable-next-line camelcase
editor_interface: 'wikitext',
@ -18,6 +24,12 @@
}
function logEditFeature( feature, action ) {
if ( mw.config.get( 'wgMFMode' ) !== null ) {
// Visiting a ?action=edit URL can, depending on user settings, result
// in the MobileFrontend overlay appearing on top of WikiEditor. In
// these cases, don't log anything.
return;
}
mw.track( 'visualEditorFeatureUse', {
feature: feature,
action: action,