Page MenuHomePhabricator

WikiEditor records all edits as platform = desktop in EventLogging
Open, Needs TriagePublic

Description

It looks like WikiEditor is only capable of recording edits as platform = "desktop" (rather than "tablet" or "phone") in its doEventLogging hook handler (which is marked with a FIXME). This would be inaccurate in the following relatively common cases:

  • Someone is using a phone or tablet to edit with the Wikitext editor on the desktop site (which I do commonly)
  • Someone is using a phone or tablet to edit on the mobile site but with no JavaScript (e.g. Opera Mini, Android 2)

Documentation for the EventLogging schema can be found at https://meta.wikimedia.org/wiki/Schema:EditAttemptStep.

Requirements

  • Upstream the mobile device detector from MobileFrontend into Mediawiki Core so that it could be used in multiple places
  • Update all schema that depend on MobileFrontend to ensure there is an explicit integration field that can log this relationship

Done

  • - [ ] Implementation: all ===Requirements are met
  • QA: Product Analytics verifies the updated schema are logging events as expected
  • Documentation: The documentation of all schema that were changed to fulfill the ===Requirements above are updated to reflect said change(s)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Milimetric subscribed.

needs to be fixed in instrumentation

This is slightly more complicated than just making WikiEditor detect whether it's being accessed by a mobile UA (server-side and client-side, because it's logging from both), because we'd probably still want to differentiate between MobileFrontend and WikiEditor. As-is, that desktop / phone split for platform is the only way to tell, I think.

Probably the right thing here would be to make MobileFrontend have an integration that's not page.

@Mayakp.wiki - How does Turnillo split between "Mobile web" editing and "Other" editing in the edits_hourly dashboard? Is it relying on the EditAttemptStep schema or doing something else?

@Mayakp.wiki - Nevermind, I figured it out. It looks like the edits_hourly dashboard relies on the revision_tags in the database.

... we'd probably still want to differentiate between MobileFrontend and WikiEditor. As-is, that desktop / phone split for platform is the only way to tell, I think.

Yeah, this seems like an oversight in the current schema. I agree that adding something like mobile-page to the integration field would probably be the best solution. We can probably split that off as a separate bug though, as this bug is just about the platform field.

kaldari renamed this task from WikiEditor records all edits as desktop edits in EventLogging to WikiEditor records all edits as platform = desktop in EventLogging.Apr 14 2020, 8:01 PM

FYI, MobileFrontend has code to detect phones and tablets in UADeviceDetector.php. It seems like that code should really live in core rather than MobileFrontend, otherwise, it's going to be complicated to detect people using a phone or tablet to edit with the Wikitext editor on the desktop site.

Hi @kaldari , you are right. platform in the edits_hourly dashboard is derived from the revision_tags in mediawiki_history table. To clarify, edits dashboards in Turnilo (or Superset) are not built using eventlogging (editattemptstep) data.

As of now, the Product Analytics team has had discussions about using Screen Width as a potential way to identify different devices. However, as you mentioned in your last comment, we are dependent on having this information available in mediawiki first, following which the data can be made available downstream for analytics.

Restricted Application edited projects, added Analytics; removed Analytics-Radar. · View Herald TranscriptJun 10 2020, 6:33 AM
Restricted Application edited projects, added Analytics; removed Analytics-Radar. · View Herald TranscriptJun 10 2020, 6:36 AM

Someone is using a phone or tablet to edit with the Wikitext editor on the desktop site (which I do commonly)

Just to point out, in case it wasn't obvious we get lots of edits from desktop site (Vector) on a mobile device which are incorrectly tagged as desktop edits and we get mobile edits from from desktop devices, so this is actually consistent. If platform = mobile for this editor, it would be inconsistent with everything else.

The revision tagging for "mobile edit" applies to anything going through MobileFrontend only so should not be used as an exact measure of "edits on mobile" - it's actually edits via the mobile site not via a mobile browser.

For example, I did this edit here on my desktop browser using the mobile domain and it has been marked as a "mobile edit":
https://en.wikipedia.org/w/index.php?title=User:Jdlrobson/draft&type=revision&diff=979642779&oldid=944260536&diffmode=source

@Jdlrobson - This task is about EventLogging via the EditAttemptStep schema, not revision tagging. EditAttemptStep doesn't even have a "platform = mobile" option. Platform can be set to desktop, tablet, phone, or other, and is supposed to indicate the "device through which the user is attempting to edit the page" per https://meta.wikimedia.org/wiki/Schema:EditAttemptStep.

The EditAttemptSchema hardcodes phone for the mobile editor - https://gerrit.wikimedia.org/g/mediawiki/extensions/MobileFrontend/+/774c791467ab457c1d41c7328f0240d7e22aa2e6/src/mobile.init/eventLogging/schemaEditAttemptStep.js#38 - until recently that was logging desktop Minerva edit's as 'phone'. I'm not sure how VisualEditor does it, but I imagine it also relies on mobile/desktop domain to determine platform value.

It sounds like you will also need to change these places as well as the WikiEditor to be based on browser user agent rather than domain to be consistent? The only reason I bring this up is the task doesn't tag MobileFrontend or VisualEditor.

VisualEditor does ve.init.target.constructor.static.platformType || 'other' (approximately). In practice this means that anything using DesktopArticleTarget reports desktop and anything using MobileArticleTarget reports phone. Since the thing which picks which of those you're using is whether you're on MobileFrontend or not, in practice, yeah: platform: phone means "is on mobilefrontend".

I stand by my previous suggestion: we should make MobileFrontend have a different integration, and change the platform to actually refer to the device being used. We'd just need to document when we made that change, and make sure it didn't wildly disrupt any ongoing analytics work.

...and make sure it didn't wildly disrupt any ongoing analytics work.

ping @SNowick_WMF and Maya (who's already here)

I commented elsewhere but I'm ambivalent about whether we actually need to do all the refactoring of MobileFrontend to extract the device detector. We need something that will determine that which is consistent between client- and server-side code, but if someone else has already implemented that for another schema in eventlogging (which is at least plausible, though I haven't investigated) we might as well just use that.

I wonder whether the right thing to do here would be to add an automatic definition of platform to eventgate-wikimedia -- there's some other automatically populated fields there, and this one would essentially be some processing of the existing user-agent that's stored. That'd avoid us needing to separately implement it client-side. We'd need to get more consensus that it's definitely a useful and widely applicable field, though, since I assume they'd rather not stick something only one or two schemas will ever use in there.

+1 to having a better definition if "isMobile" based on user agent string in EventLogging. The existing platform field used on many schemas is a bugbear of mine, as it is misleading - people may be using en.m.wikipedia.org on a desktop browser or en.wikipedia.org on a mobile browser so it likely impacts our numbers

@phuedx No change there. The current state is still that platform: mobile/desktop from web solely means whether MobileFrontend is active, and says nothing about the device being used.