Commit graph

48 commits

Author SHA1 Message Date
Fomafix b799a886ca Remove redundant closure for all modules with packageFiles
Modules loaded with packageFiles are always executed in module scope
(with a closure), even in debug mode.

The behaviour of non-packageFiles debug mode is the only reason files
have closures.

https: //www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript#Closure
Change-Id: Idd7ffde7900adbca914c43a6bf7cb1b3fbf92bfa
2024-03-06 15:07:43 +00:00
DLynch 3e568552b6 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
2023-06-09 15:20:01 -05:00
Bartosz Dziewoński 929e8463fb Remove hacks that avoid duplicate event logging with MobileFrontend
This reverts 843efa2f46,
no longer needed after I6028fa4a34916a6cd20161009cf5893492286c2d.

Bug: T334263
Depends-On: I6028fa4a34916a6cd20161009cf5893492286c2d
Change-Id: Ie4506d46d350fb53d6d0264763c2d55fc142997e
2023-04-06 22:49:06 +00:00
Bartosz Dziewoński 414037f7a6 Centralize EditAttemptStep logging code in WikimediaEvents
PHP EditAttemptStep logging code is not moved.

* Use the new mw.track() handlers from WikimediaEvents
* Ensure that 'integration' and 'editor_interface' are set on all
  events, since they're not hard-coded in the handler any more
  (and there are no client-side init events that add defaults)

This must be merged together with WikimediaEvents change
Iace4d53a972396ca5b8713000570cc47c9986034 (but we can't use
Depends-On, because CI requires code here to be removed first).

Bug: T332438
Change-Id: I0ef0a96aafdf89a4ebe32131a85b18c25744bb2c
2023-03-18 13:57:06 +00:00
David Lynch 843efa2f46 Don't do logging if MobileFrontend is active for the current page
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.

Bug: T320281
Change-Id: Ib98d2cd6f2e541423e5aeebd3093bad97d6fcc4f
2023-03-07 11:58:43 -06:00
David Lynch 5b6226841d Log token for the DiscussionTools mobile a/b test
Bug: T321961
Change-Id: If06ba42491ea1ca58aec48a85d0b4a0187702123
2022-12-16 14:46:11 -06:00
jenkins-bot 613df636a1 Merge "ext.wikiEditor: Also log EditAttemptStep events via Metrics Platform" 2022-12-02 09:14:01 +00:00
David Lynch 429ab31cb5 Move logging hook registrations for realtime preview into document-ready
There were analytics validation errors because events were being logged
without a session ID. The session ID is only set on document-ready, as
it's fetched from a hidden input on the document.

Change-Id: Iaa24d430b780eaad54b78cb0d2ef0670fa2e32b1
2022-11-17 09:39:43 -06:00
Sam Smith f39dddaee5 ext.wikiEditor: Also log EditAttemptStep events via Metrics Platform
The EditAttemptStep instrument is a candidate for migration to the
Metrics Platform [0]. The first step of the migration is to log events
both using the Event Platform (i.e. via mw.eventLog.submit()) and using
the Metrics Platform Client (i.e. via mw.eventLog.dispatch()).

The Metrics Platform Client can mix in additional information -
so-called context attributes [1] - based on the stream configuration.
The majority of the default values mixed into each event via the
mw.eventLog.Schema defaults mechanism are already known to the Metrics
Platform Client.

Note well that the Metrics Platform Client will not log an event without
one or more streams being configured to receive that event. Therefore,
this change is a NOP.

An example stream configuration is given in [2].

[0] https://wikitech.wikimedia.org/wiki/Metrics_Platform
[1] https://gerrit.wikimedia.org/g/mediawiki/libs/metrics-platform/+/aed6738b845/js/src/StreamConfig.d.ts#31
[2] https://phabricator.wikimedia.org/T309013#7953227

Bug: T309013
Bug: T320281
Change-Id: Ia08bac484fb3a2209879531def859a01290120fd
2022-11-14 08:40:35 +00:00
hmonroy 08c4dd35a4 Realtime Preview: add event tracking to load action
Trigger preview-realtime-loaded when the realtime preview pain loads.

Bug: T306176
Change-Id: If66c3db20a48ae8882412c068a0253f8cccfc1d3
2022-08-03 16:24:41 -07:00
hmonroy 45474e1e26 Realtime Preview: add event tracking to triggered events
Add following logging events:
  * preview-realtime-error-stopped: triggered when realtime preview
auto-load is stopped.
  * preview-realtime-reload-error:  triggered when realtime preview pane
shows an error message and the reload button shown in this message is clicked.
  * preview-realtime-reload-hover:  triggered when the reload button
that shows on hover in the realtime preview pane is clicked.
  * preview-realtime-reload-manual: triggered when the reload button in
the realtime preview pane manual bar is clicked.

Bug: T306176
Change-Id: I0785b0a8e88125a9bb30ff5c64c8a7c50b556c63
2022-07-26 12:06:04 -07:00
David Lynch ce2ecf084f Update schema logging of bucket for new DiscussionTools A/B test
Bug: T304030
Depends-On: I5e57bb9b7958576f3a04373748331a86f4626fb5
Change-Id: I084d26c95d5be78eddb4edd1b42aa52eef909356
2022-05-19 09:50:04 -05:00
Sam Wilson 119f25e424 Add event logging for Realtime Preview enabling and disabling
Add two new actions for the 'preview' feature:

* preview-realtime-on – The WikiEditor 'Preview' toolbar button
  was clicked to turn the preview panel on.
* preview-realtime-off – The WikiEditor 'Preview' toolbar button
  was clicked to turn the preview panel off.
* preview-realtime-inuse – Fired without user interaction when the
  WikiEditor preview feature is already on when the editing form is
  opened.

This also adds a new hook for the last of these to use and to match
the enable/disable hooks.

Bug: T298218
Change-Id: I1a2545c2b0491c1d07f9508fab70967d03d61594
2022-04-04 14:25:16 +08:00
Ammarpad 6c90478689 Do not add toolbar when textbox is hidden
If the textbox is not visible, the toolbar cannot be used.

Bug: T303122
Change-Id: Ie676f3e588ba74b59c9586b05e7348ef57059b01
2022-03-08 06:10:23 +01:00
David Lynch 9c6dee2372 Misnamed field on a/b test logging
Bug: T301497
Change-Id: I9469ec8b6e745ae9181e5ffe21036f2de417680a
2022-02-11 19:58:16 -06:00
David Lynch 9c478c9290 Improve DiscussionTools a/b test bucket logging
Make sure it works on pages which don't trigger DT, such as full-page
wikitext editing.

Bug: T301497
Change-Id: I244381ee9e47bd3119e341cddb42e2ab38add4a8
2022-02-11 15:41:53 -06:00
David Lynch fda6c3c117 New bucket for abtest data
Bug: T291308
Change-Id: I7aa47139e3fe552833798d6b8daacc1b30517915
2022-02-02 15:50:21 -06:00
Ed Sanders b4f144057e Tag WikiEditor edits with a hidden tag
Bug: T249038
Change-Id: Ia4267bc430ba0f12cce496ebf6f8c1773ae355a6
2021-12-07 23:30:27 +00:00
Sam Wilson a2cccc57af Add live-preview logging
Log on every click (by any means, including accesskey) of the
main editing preview button.

Bug: T290521
Change-Id: I67d821445c5e39034bcb121beccf17a765a311ed
2021-11-04 10:09:56 +08:00
Ed Sanders 344da9de80 Move var declarations inline
Change-Id: I841ed46dfde9a6e2a5927e49ac3383d6e17bda66
2021-06-15 15:45:13 +01:00
David Lynch cb1c5d49aa Log whether Javascript was supported on saveSuccess
Adds a hidden field to the edit page form, with JS that will set its
value. Server-side then checks for that value and logs whether it was
correctly set.

Bug: T263505
Change-Id: I8be06385aa6d97e5536cfc252d34297e1c000a32
2021-04-30 17:45:40 -05:00
David Lynch e052e46f94 Log the DiscussionTools a/b test bucket for relevant schemas
If someone is enrolled the DT a/b test, we want to know about their
editing here as well.

Bug: T273096
Change-Id: If2bb04011c8ca54e8c7ffd073e21bec45e92460c
2021-01-29 20:56:14 -06:00
Niklas Laxström c10d08d87b Export crude public interface for WikiEditor
Bug: T250862
Change-Id: Iac8778f0d0a0150acc99569d84422bc9817dfcc7
2021-01-21 12:22:52 +00:00
David Lynch fa2b80e22a Edit page normally lacks wgRevisionId, but has form field parentRevId
Bug: T230133
Change-Id: I5e3defe22aee58e36d662ef051ebfb3ff1b64dde
2020-12-21 12:27:46 -06:00
David Lynch 7ab9ac2a73 Update VisualEditorFeatureUse with new fields
Bug: T252925
Change-Id: Id6f3748bfd3865e7bb0e4ef5e882206438063e0f
2020-06-09 15:57:07 -05:00
David Lynch a107382fc5 Implement firstChange logging
Also, clean up the invalid logging of some prefixed schema items.

Depends-On: I79e04dda6323ebb05b129bb96c0323db112bcdd0
Bug: T229079
Change-Id: I73eae25d83b8d3f73128d3b800b267a8288a76e8
2019-09-10 09:38:49 -05:00
Roan Kattouw d23d096281 Convert ext.wikiEditor module to packageFiles
This allows us to bundle the wgWikiEditorMagicWords and
mw.msg.wikiEditor(?!) config vars that were previously exported globally
in the startup module.

This code is old and crufty, so this is a somewhat minimal conversion:
* Use require() for jquery.wikiEditor.{dialogs,toolbar}.config.js,
  and for jquery.wikiEditor.{dialogs,toolbar}.js
* Don't attempt to convert jquery.wikiEditor.js to something
  require-based, instead just run it and let it set the $.wikiEditor and
  $.fn.wikiEditor globals
* Consolidate ext.wikiEditor.{dialogs,toolbars}.js into
   ext.wikiEditor.js

Bug: T222828
Change-Id: Ia75d685cbde786e8fceb6db36f2436b2beea1499
2019-08-05 22:24:56 +00:00
Fomafix 3a306ff7fb Use lightweight mw.util.getParamValue() instead of mw.Uri()
Change-Id: I27eea6544a7dfe503d0cac1e24228eca9834ca95
2019-07-17 17:41:23 +02:00
David Lynch 7bbbf1a886 Log editor switches to visualeditorfeatureuse
Also, avoid distorting the logging of abort when VE is switched to from
WikiEditor. Log it immediately, rather than waiting until the end of the VE
session triggers a page-unload.

Bug: T221191
Change-Id: I3ddccd8df973a289f3bcdc4cdc42df1ab23ce6a4
2019-07-03 23:36:23 -05:00
Dan Andreescu 7d61121793 Remove mentions of schema.* ResourceLoader modules
These modules are deprecated and will be removed, see parent task for
details and deprecation information.

Bug: T223286
Change-Id: I72a1ab68f94842b2fa9bcd84c21ea736a48e0614
2019-05-14 21:19:34 -04:00
Ed Sanders 583ad04b87 build: Update eslint-config-wikimedia to 0.10.0
Change-Id: I5fea8a1d6c91ea69c3490101ea38ce4626bd7e11
2019-01-08 23:32:56 +00:00
Ed Sanders 4fa41179e8 Remove obsolete aliases from closures
Bug: T208951
Change-Id: I0b2993912de221e810414e46708c19be163922f6
2018-11-12 22:28:40 +00:00
Roan Kattouw d700202f85 Update EventLogging code for Edit->EditAttemptStep schema migration
The schema itself is being renamed, and many of the field names are
different.

Bug: T207803
Depends-On: I2949c9782669b75cf17978698c8cef21fdee6dea
Change-Id: I07d9bc1530005914043911b7906c1602522c9162
2018-10-29 11:38:07 -07:00
Roan Kattouw 55b89c1ede Oversample Schema:Edit events when configured to do so
Respect the config var exported by WikimediaEvents that, if set to true,
forces oversampling. When oversampling, all events are logged even if
they would have been sampled out. The isOversample property is set to
true if the event was oversampled and would not otherwise have been
logged.

Bug: T206543
Depends-On: I5fdf5fdd2dc0d99a0a0d7eb7ab2e3dce4798009b
Change-Id: I7e504884a888c4d080cd4762549b72489126ed65
2018-10-18 10:58:45 -07:00
Roan Kattouw e54a4420ca Use Schema:Edit sampling rate config from WikimediaEvents
Instead of hard-coding the 6.25% sampling rate, allow it to be
controlled by the config variable in the WikimediaEvents extension
(which also defines the RL module for the Edit schema).

Also use sampling code from EventLogging so we can configure the
sampling rate as a number, rather than using a hex-digit based strategy.

Bug: T206543
Depends-On: I00383cec62f6c2a0137b329565b0ca84bfbb223f
Depends-On: Ib746fc708e7b752cebc5fd8d080e40819dfa34f3
Change-Id: I2956efc9294768742dd49dcb36770f0509e4090f
2018-10-17 14:30:03 -07:00
David Lynch 046e9b6374 Track time-to-ready/loaded via window.performance
Change-Id: Iadb9c131ca6730c20d4b166e686942f9b404e198
2017-12-11 11:53:14 -06:00
Ed Sanders 0322d628aa Track action=loaded when the editor is *fully* ready
Change-Id: I29ee776bdfe5d89ddffb97175588ed037ef0beee
2017-12-06 16:32:27 +00:00
Ed Sanders 781504057a Make toolbar and dialog part of the core module
Bug: T163793
Change-Id: Ia6d02b51d4e04f148d836827640ff132366c4bee
2017-05-03 11:54:23 -07:00
paladox bdb67f719c build: Test JS code with jshint and jscs via npm
Change-Id: I039bc4c17fbba3c74a5050066b20af05434ca482
2015-11-18 12:06:36 +00:00
Alex Monk 7eba01c398 Finish updates for Schema:Edit
Follows-up Ib5fc6004

Bug: T111421
Change-Id: I3f1148ed7ec424875d73b0eb6571c8f38180685f
2015-09-04 20:46:56 +01:00
James D. Forrester ab9dbac995 Reduce 'Edit' EventLogging schema sampling rate to 6.25% (1/16th)
Bug: T103036
Change-Id: Ib437c2542f9f6ed4d333047383ff66e637b5065e
2015-06-18 16:39:29 -07:00
Roan Kattouw d1270ed4b6 Populate abort.type in Schema:Edit logging
Using document.activeElement at the time of the unload
event as a proxy for whether the user is switching to VE.

Switching to VE is weighed more heavily than whether or not
the user made changes: switching to VE causes abort.type to be
'switchwithout' regardless of whether changes were made; only
if the user isn't switching to VE do we look at whether changes
were made and use 'abort' or 'nochange' as appropriate.

When wgAction === 'submit' (i.e. we're on a preview / show changes
view), it is assumed that the user has made changes.

Bug: T95938
Change-Id: Ic91b87c4fc5b601e1fd98b237100d808e97400bd
2015-05-04 18:15:18 -07:00
Roan Kattouw cc5ca3a2f6 Perform 25% sampling on the client side as well
Needed because session IDs can be generated on the client
from the unload handler (when the back button is used).

Bug: T95919
Change-Id: Iac921bc36806205fc11ac76154ed8b3890f10d31
2015-04-28 14:55:54 -07:00
Roan Kattouw 418baf1efa Regenerate editingStatsId on unload
So that the ID isn't reused when the user uses the back button
to navigate back to an edit page.

It would be more natural to use pageshow for this, but that
event also fires on initial load. There is a .persisted property
that indicates whether the page was recycled, but that
property doesn't work in Chrome:
https://code.google.com/p/chromium/issues/detail?id=344507

Doing this from pagehide doesn't work either, because that
runs before unload (at least in Chrome) and causes the
abort event to be emitted with the new ID. So instead,
regenerate the ID in the unload handler after the
abort event has been sent.

Bug: T95919
Change-Id: I20a602a7896e75ffa116dcd2c137306ca84164b6
2015-04-21 01:01:41 +00:00
Roan Kattouw 1a96528f69 Remove extraneous comma
Change-Id: Ica0bb9f5a266e265647ade4a13e1e1d368c928d2
2015-04-19 15:35:39 -07:00
Alex Monk 596a790d00 Try to unbreak WikiEditor modules
Some very weird issues going on involving multiple wikiEditor instances being
set up on the same textarea element. It's probably a race condition of some
sort and I'm hoping that restoring the modules like this will fix it.

Bug: T93384
Change-Id: I44c9c013993220ab709893d239614552d7b25d46
2015-04-07 19:51:58 +01:00
goibhniu bddd21b300 Peserve jQuery references to avoid conflicts
* Added closures for jQuery where missing.
* Added closures for mediaWiki where missing.
* Using ready( $ ) where possible.
* Removed empty CSS block.

Change-Id: Ifdd4b10063221a4967d812eafd43858623ec5d28
2013-11-06 23:34:46 +01:00
Trevor Parscal 089b73aa5d * Moved ResourceLoader modules into the ext.* space - this is the convention that should be followed in the future
* Moved test resource to the modules folder and registered it
* Fixed tests file to use $ not $j
* Cleaned up syntax in module definitions
2010-09-20 20:06:18 +00:00
Renamed from modules/wikiEditor.js (Browse further)